Package com.day.cq.reporting.helpers
Class Util
java.lang.Object
com.day.cq.reporting.helpers.Util
Class that provides some helper functionality.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanarrayContainsString(String[] array, String str) Determines if the specifiedStringarray contains the specified string.static voidClears the time information by setting it back to midnight.static longcreateTimeStamp(Calendar cal) Creates a timestamp (format: yyyymmddhhmmss) from the specifiedCalendar,static booleanequalsNullAware(Object obj1, Object obj2) Compares two objects by their respectiveObject.equals(java.lang.Object)methods.static StringGets a chart id for rendering from the specified request, if applicable.static StringDetermines a provided chart layout from the specified request, if applicable.static Integer[]Determines a predefines size from the specified request, if applicable.static StringGets the render type from the reuest.static booleanChecks if the specified request triggers a single view rendering.static voidwriteToJSON(JSONWriter writer, com.day.cq.reporting.impl.snapshots.AggregationInterval interval, Calendar cal, TimeZone timeZone, Locale locale) Writes the specifiedCalendarto the specifiedJSONWriter.
-
Method Details
-
createTimeStamp
Creates a timestamp (format: yyyymmddhhmmss) from the specifiedCalendar,- Parameters:
cal- The calendar- Returns:
- The timestamp
-
writeToJSON
public static void writeToJSON(JSONWriter writer, com.day.cq.reporting.impl.snapshots.AggregationInterval interval, Calendar cal, TimeZone timeZone, Locale locale) throws JSONException Writes the specifiedCalendarto the specifiedJSONWriter.- Parameters:
writer- The writerinterval- The aggregation interval to create display values forcal- The calendartimeZone- The time zonelocale- The locale- Throws:
JSONException- if writing data failed
-
clearTime
Clears the time information by setting it back to midnight.- Parameters:
calendar- The calendar to clear time information from
-
arrayContainsString
Determines if the specifiedStringarray contains the specified string.- Parameters:
array- The arraystr- The string- Returns:
trueif the array contains the given string
-
getRenderTypeFromRequest
Gets the render type from the reuest.- Parameters:
req- The request to determine the render type from- Returns:
- The render type (
Const.RENDER_TYPE_TABULARorConst.RENDER_TYPE_CHART;nullfor rendering the chart in default mode
-
getChartIdFromRequest
Gets a chart id for rendering from the specified request, if applicable.- Parameters:
req- The request- Returns:
- The chart id;
nullif no chart id is available/required
-
isSingleViewRendering
Checks if the specified request triggers a single view rendering.- Parameters:
req- The request to be analyzed- Returns:
trueif a single view rendering is triggered by the request
-
getRenderSizeFromRequest
Determines a predefines size from the specified request, if applicable.- Parameters:
req- The request- Returns:
- A two element array specifiying a predefined width (first element) and
height (second element); each of the element may be
null, indicating that the respective dimension has to be autocalculated
-
getChartLayoutFromRequest
Determines a provided chart layout from the specified request, if applicable.- Parameters:
req- The request- Returns:
- The chart layout ("horizontal", "vertical" or
null(if no chart layout was provided)
-
equalsNullAware
Compares two objects by their respective
Object.equals(java.lang.Object)methods. Both objects may benull.- Parameters:
obj1- The first objectobj2- The second object- Returns:
trueif both objects are equal
-