T
- the type of values in the facet option filters@GwtCompatible
public abstract class Facet<T>
extends java.lang.Object
implements com.appiancorp.common.query.ReadOnlyFacet<T>
This class holds the metadata for a facet and its options. For example, a Car record could have a Color facet with the options Black, White, Silver.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_OPTION |
static java.lang.String |
LOCAL_PART |
static javax.xml.namespace.QName |
QNAME |
static boolean |
VISIBLE_BY_DEFAULT |
protected static java.lang.String |
XML_ROOT_ELEMENT |
Modifier | Constructor and Description |
---|---|
protected |
Facet()
Default constructor, provided only for JAXB serialization.
|
protected |
Facet(java.lang.String name,
boolean isVisible,
java.lang.String defaultOption,
java.util.List<FacetOption<T>> options,
int numOmittedOptions,
int omittedOptionsDataCount,
boolean isExclusiveOptions,
java.lang.String facetType,
java.lang.String sourceRef)
Constructs a new facet.
|
Modifier and Type | Method and Description |
---|---|
static com.google.common.base.Equivalence<Facet<?>> |
equalDataCheck() |
boolean |
equals(java.lang.Object obj)
|
static <T> FacetOption<T> |
findOptionById(java.util.List<Facet<T>> facets,
java.lang.String facetOptionId)
Finds the first matching option by id, within the options of the given facets.
|
FacetOption<T> |
findOptionById(java.lang.String facetOptionId)
Finds an option by id.
|
static <T> com.appiancorp.common.query.ReadOnlyFacetOption<T> |
findOptionByIdReadOnly(java.util.List<com.appiancorp.common.query.ReadOnlyFacet<T>> facets,
java.lang.String facetOptionId) |
com.appiancorp.common.query.ReadOnlyFacetOption<T> |
findOptionByIdReadOnly(java.lang.String facetOptionId) |
java.util.List<FacetOption<T>> |
getAppliedOptions() |
java.lang.String |
getDefaultOption() |
java.lang.String |
getFacetType() |
java.lang.String |
getName() |
int |
getNumOmittedOptions() |
int |
getOmittedOptionsDataCount() |
abstract java.util.List<FacetOption<T>> |
getOptions() |
com.google.common.collect.ImmutableList<com.appiancorp.common.query.ReadOnlyFacetOption<T>> |
getOptionsReadOnly() |
java.lang.String |
getSourceRef() |
int |
getTotalNumOptions() |
int |
hashCode()
Returns a hash code that uses the
name property only. |
boolean |
isExclusiveOptions() |
boolean |
isVisible() |
static com.appian.core.base.ToStringFunction<Facet<?>> |
multilineToString(int indent)
Returns a function that generates a multi-line String representation of a facet.
|
void |
setAppliedOptions(Criteria appliedCriteria)
Sets the
isApplied property on the options of this facet, based on
the given query criteria. |
static <T> void |
setAppliedOptions(java.lang.Iterable<Facet<T>> facets,
Criteria appliedCriteria)
Sets the
isApplied property on the appropriate options of the given
facets, using setAppliedOptions(Criteria) . |
protected abstract void |
setOptions(java.util.List<FacetOption<T>> options)
Sets the options for this facet.
|
java.lang.String |
toString() |
protected static final java.lang.String XML_ROOT_ELEMENT
public static final java.lang.String LOCAL_PART
public static final javax.xml.namespace.QName QNAME
public static final java.lang.String DEFAULT_OPTION
public static final boolean VISIBLE_BY_DEFAULT
protected Facet()
protected Facet(java.lang.String name, boolean isVisible, java.lang.String defaultOption, java.util.List<FacetOption<T>> options, int numOmittedOptions, int omittedOptionsDataCount, boolean isExclusiveOptions, java.lang.String facetType, java.lang.String sourceRef)
name
- The name of the facet.options
- The list of options for this facet.isVisible
- Whether or not the facet will appear to the user.defaultOption
- The defaultOption to be applied.numOmittedOptions
- The number of additional options that are available, but are not included
in the provided list of options.omittedOptionsDataCount
- The number of objects that contain data matched by the omitted options.
This allows the UI to present the generic option "Other" along with a count.isExclusiveOptions
- Whether this facet's options are exclusive or not. See
isExclusiveOptions()
.facetType
- Type of the facet (whether it is List or DateRange)sourceRef
- Name of the field (of the record), on which the filter is applied.public java.lang.String getName()
getName
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
public boolean isVisible()
isVisible
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
public java.lang.String getDefaultOption()
getDefaultOption
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
public int getNumOmittedOptions()
getNumOmittedOptions
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
the list of options
. If this number is not available, returns
FacetOption.COUNT_NOT_AVAILABLE
.public int getTotalNumOptions()
options
plus the number of
omitted options
. If the number of omitted options is not available,
returns FacetOption.COUNT_NOT_AVAILABLE
.public int getOmittedOptionsDataCount()
getOmittedOptionsDataCount
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
FacetOption.COUNT_NOT_AVAILABLE
.public boolean isExclusiveOptions()
isExclusiveOptions
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
true
if the options are exclusive, and false
otherwise. If the options are
exclusive, only one of the options can be applied for a given query. If the options are not exclusive,
multiple options can be selected and applied in a given query. This is analogous to radio buttons vs
checkboxes.public java.lang.String getFacetType()
getFacetType
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
public java.lang.String getSourceRef()
getSourceRef
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
public abstract java.util.List<FacetOption<T>> getOptions()
protected abstract void setOptions(java.util.List<FacetOption<T>> options)
options
- the list of optionspublic com.google.common.collect.ImmutableList<com.appiancorp.common.query.ReadOnlyFacetOption<T>> getOptionsReadOnly()
getOptionsReadOnly
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
public java.util.List<FacetOption<T>> getAppliedOptions()
isApplied
property is set to true
).public void setAppliedOptions(Criteria appliedCriteria)
isApplied
property on the options of this facet, based on
the given query criteria.
An option's isApplied
property will be set to true
, if that option's
filters
are contained in the given criteria. Otherwise, the
isApplied
property will be set to false
.
appliedCriteria
- the criteria to use in order to determine which facet options are enabledpublic static <T> void setAppliedOptions(java.lang.Iterable<Facet<T>> facets, Criteria appliedCriteria)
isApplied
property on the appropriate options of the given
facets, using setAppliedOptions(Criteria)
.facets
- the facets to configureappliedCriteria
- the criteria to use in order to determine which facet options are enabledpublic FacetOption<T> findOptionById(java.lang.String facetOptionId)
facetOptionId
- the target option id
null
.public com.appiancorp.common.query.ReadOnlyFacetOption<T> findOptionByIdReadOnly(java.lang.String facetOptionId)
findOptionByIdReadOnly
in interface com.appiancorp.common.query.ReadOnlyFacet<T>
public static <T> FacetOption<T> findOptionById(java.util.List<Facet<T>> facets, java.lang.String facetOptionId)
facets
- the facets whose options should be searchedfacetOptionId
- the target option id
null
.public static <T> com.appiancorp.common.query.ReadOnlyFacetOption<T> findOptionByIdReadOnly(java.util.List<com.appiancorp.common.query.ReadOnlyFacet<T>> facets, java.lang.String facetOptionId)
public java.lang.String toString()
toString
in class java.lang.Object
public static com.appian.core.base.ToStringFunction<Facet<?>> multilineToString(int indent)
indent
- the indent to be used by the returned functionpublic int hashCode()
name
property only.
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
Facet
and has the same
name
as this facet.
equals
in class java.lang.Object
Copyright © 2003-2024 Appian Corporation. All Rights Reserved.