public class Util
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
arrayContainsString(java.lang.String[] array,
java.lang.String str)
Determines if the specified
String array contains the specified string. |
static void |
clearTime(java.util.Calendar calendar)
Clears the time information by setting it back to midnight.
|
static long |
createTimeStamp(java.util.Calendar cal)
Creates a timestamp (format: yyyymmddhhmmss) from the specified
Calendar , |
static boolean |
equalsNullAware(java.lang.Object obj1,
java.lang.Object obj2)
Compares two objects by their respective
Object.equals(java.lang.Object) methods. |
static java.lang.String |
getChartIdFromRequest(SlingHttpServletRequest req)
Gets a chart id for rendering from the specified request, if applicable.
|
static java.lang.String |
getChartLayoutFromRequest(SlingHttpServletRequest req)
Determines a provided chart layout from the specified request, if applicable.
|
static java.lang.Integer[] |
getRenderSizeFromRequest(SlingHttpServletRequest req)
Determines a predefines size from the specified request, if applicable.
|
static java.lang.String |
getRenderTypeFromRequest(SlingHttpServletRequest req)
Gets the render type from the reuest.
|
static boolean |
isSingleViewRendering(SlingHttpServletRequest req)
Checks if the specified request triggers a single view rendering.
|
static void |
writeToJSON(JSONWriter writer,
com.day.cq.reporting.impl.snapshots.AggregationInterval interval,
java.util.Calendar cal,
java.util.TimeZone timeZone,
java.util.Locale locale)
Writes the specified
Calendar to the specified JSONWriter . |
public static long createTimeStamp(java.util.Calendar cal)
Calendar
,cal
- The calendarpublic static void writeToJSON(JSONWriter writer, com.day.cq.reporting.impl.snapshots.AggregationInterval interval, java.util.Calendar cal, java.util.TimeZone timeZone, java.util.Locale locale) throws JSONException
Calendar
to the specified JSONWriter
.writer
- The writerinterval
- The aggregation interval to create display values forcal
- The calendartimeZone
- The time zonelocale
- The localeJSONException
- if writing data failedpublic static void clearTime(java.util.Calendar calendar)
calendar
- The calendar to clear time information frompublic static boolean arrayContainsString(java.lang.String[] array, java.lang.String str)
String
array contains the specified string.array
- The arraystr
- The stringtrue
if the array contains the given stringpublic static java.lang.String getRenderTypeFromRequest(SlingHttpServletRequest req)
req
- The request to determine the render type fromConst.RENDER_TYPE_TABULAR
or
Const.RENDER_TYPE_CHART
; null
for rendering the
chart in default modepublic static java.lang.String getChartIdFromRequest(SlingHttpServletRequest req)
req
- The requestnull
if no chart id is available/requiredpublic static boolean isSingleViewRendering(SlingHttpServletRequest req)
req
- The request to be analyzedtrue
if a single view rendering is triggered by the requestpublic static java.lang.Integer[] getRenderSizeFromRequest(SlingHttpServletRequest req)
req
- The requestnull
,
indicating that the respective dimension has to be autocalculatedpublic static java.lang.String getChartLayoutFromRequest(SlingHttpServletRequest req)
req
- The requestnull
(if no
chart layout was provided)public static boolean equalsNullAware(java.lang.Object obj1, java.lang.Object obj2)
Compares two objects by their respective Object.equals(java.lang.Object)
methods. Both objects
may be null
.
obj1
- The first objectobj2
- The second objecttrue
if both objects are equalCopyright © 2010 - 2020 Adobe. All Rights Reserved