Class StatService

java.lang.Object
sk.iway.iwcm.stat.rest.StatService

public class StatService extends Object
Main goal of this Service is help with extended filters that all Stat section pages contains and to reduce dudplicity codes.
  • Method Details

    • processDateRangeString

      public static Date[] processDateRangeString(String stringRange)
    • processDateRangeString

      public static Date[] processDateRangeString(String stringRange, String statType)
      Function will handle String on input and retun array of 2 Date values. This values represent date range from-to. In case of input that contain "daterange:" prefix (added by date picker), function can handle this prefix. If input is empty 1 month range is returned. If input contain two values in milliseconds separeted by "-", this values will be used for date range. If input contain only one value without "-", this value will represent dateFrom, dateTo will be computed and range will be 1 month. If input contain only one value that start with "-", this represent dateTo, dateFrom will be computed and range will be 1 month. Any other input will be clasified as invalid and default 1 month range will be returned.
      Parameters:
      stringRange - string of milliseconds represent date
      Returns:
      array with 2 Date values
    • stringToChartTypeEnum

      public static ChartType stringToChartTypeEnum(String chartType)
      Function is case-insensitive, and if input string value is equal to one of ChartType enum, this enum value will be returned. If input is null/empty/or does not match any of ChartType values, function will return NOT_CHART enum value as default value.
      Parameters:
      chartType - String value that represent one of ChartTzpe enum values
      Returns:
      ChartType enum value
    • processMapToStatFilter

      public static FilterHeaderDto processMapToStatFilter(Map<String,String> params, String specialDateName, Identity user)
      Function handle Map of parameters returned by Overrided searchItem and use them for creating new FilterHeaderDto variable (where this handled params are set). If any param is not found in map, default value will be set. Default values are defined by FilterHeaderDto itself. Because not every class has same name for date range value (mostly refered as dayDate), there is option use input parameter specialDateName and set what param we want find in map, that repsent dayDate. If specialDateName isnt set, function will use default param name dayDate.
      Parameters:
      params - map of params return by overrided function searchItem
      specialDateName - name of param that is in map and represent date range param dayDate
      Returns:
      FilterHeaderDto variable that contain handled params
    • processRequestToStatFilter

      public static FilterHeaderDto processRequestToStatFilter(javax.servlet.http.HttpServletRequest request, String specialDateName)
      Function handle parameters from request and use them for creating new FilterHeaderDto variable (where thi handled params are set). If any param is not found in map, default value will be set. Default values are defined by FilterHeaderDto itself. Because not every class has same name for date range value (mostly refered as dayDate), there is option use input parameter specialDateName and set what param we want find in map, that repsent dayDate. If specialDateName isnt set, function will use default param name dayDate.
      Parameters:
      request - request that contain params to handle
      specialDateName - name of param that is in map and represent date range param dayDate
      Returns:
      FilterHeaderDto variable that contain handled params
    • getSearchEnginesTableData

      public static List<SearchEnginesDTO> getSearchEnginesTableData(FilterHeaderDto filter)
    • getSearchEnginesPieChartData

      public static List<SearchEnginesDTO> getSearchEnginesPieChartData(Date from, Date to, String rootGroupIdQuery)