Exemple #1
0
  protected List<FilterDescription> generateFilterDescriptions(
      Filter filter, Set<DimensionType> excludeDims, User user) {

    List<FilterDescription> list = new ArrayList<FilterDescription>();

    Set<DimensionType> filterDims = filter.getRestrictedDimensions();
    filterDims.removeAll(excludeDims);

    for (DimensionType type : filterDims) {

      list.add(
          new FilterDescription(
              type, pivotDAO.getFilterLabels(type, filter.getRestrictions(type))));
    }

    if (filter.getMinDate() != null || filter.getMaxDate() != null) {
      DateRangeFormat format = new DateRangeFormat(user.getLocaleInstance());

      list.add(
          new FilterDescription(
              DimensionType.Date, format.format(filter.getMinDate(), filter.getMaxDate())));
    }

    return list;
  }
Exemple #2
0
  protected Filter resolveElementFilter(T element, DateRange dateRange) {

    Filter filter = new Filter(element.getFilter());

    if (dateRange != null) {
      if (filter.getMinDate() == null) {
        filter.setMinDate(dateRange.getMinDate());
      }
      if (filter.getMaxDate() == null) {
        filter.setMaxDate(dateRange.getMaxDate());
      }
    }
    return filter;
  }