Class GenericFacetOption

java.lang.Object
com.appiancorp.common.query.FacetOption<Object>
com.appiancorp.common.query.GenericFacetOption
All Implemented Interfaces:
com.appiancorp.common.query.ReadOnlyFacetOption

@GwtCompatible public final class GenericFacetOption extends FacetOption<Object>

This class holds the metadata for an individual option for a facet. The key piece of metadata of a facet option is the filters that should be applied when that facet is selected. For example:

  • a "Color" facet could have the option "Black" which specifies a single filter: color = black
  • a "Closing Date" facet could have the option "1st Quarter" which specifies the filters: closingDate >= 2012-01-01 and closingDate < 2012-04-01
  • Constructor Details

    • GenericFacetOption

      public GenericFacetOption(String id, String name, List<Filter<Object>> filters)
      Constructs a new facet option. The isApplied property is set to false, and the dataCount property is set to FacetOption.COUNT_NOT_AVAILABLE.
      Parameters:
      id - the id of this option
      name - the name of this option
      filters - the list of filters to add to a query when this option is selected
    • GenericFacetOption

      public GenericFacetOption(String id, String name, List<Filter<Object>> filters, boolean isApplied, int dataCount)
      Constructs a new facet option.
      Parameters:
      id - the id of this option
      name - the name of this option
      filters - the list of filters to add to a query when this option is selected
      isApplied - whether this option is selected or not
      dataCount - the number of objects whose data matches the filters of this option
  • Method Details

    • getFilters

      public List<Filter<Object>> getFilters()
      Specified by:
      getFilters in class FacetOption<Object>
      Returns:
      The list of filters to add to a query when this option is selected.
    • setFilters

      protected void setFilters(List<Filter<Object>> filters)
      Description copied from class: FacetOption
      Sets the list of filters to add to a query when this option is selected.
      Specified by:
      setFilters in class FacetOption<Object>
      Parameters:
      filters - the list of filters
    • getFiltersAsCriteria

      public Criteria getFiltersAsCriteria()
      Specified by:
      getFiltersAsCriteria in interface com.appiancorp.common.query.ReadOnlyFacetOption
      Specified by:
      getFiltersAsCriteria in class FacetOption<Object>
      Returns:
      This option's filters wrapped in a criteria if needed.