Ejemplo n.º 1
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;
  }
Ejemplo n.º 2
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;
  }
Ejemplo n.º 3
0
  /** {@inheritDoc} */
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    GetSites getSites = (GetSites) o;

    if (!filter.equals(getSites.filter)) return false;
    if (seekToSiteId != null
        ? !seekToSiteId.equals(getSites.seekToSiteId)
        : getSites.seekToSiteId != null) return false;

    return true;
  }
Ejemplo n.º 4
0
 /** {@inheritDoc} */
 @Override
 public int hashCode() {
   int result = filter.hashCode();
   result = 31 * result + (seekToSiteId != null ? seekToSiteId.hashCode() : 0);
   return result;
 }