Package com.sas.services.information
Class FilterComponent
java.lang.Object
com.sas.services.information.FilterComponent
- All Implemented Interfaces:
Serializable
@SASScope("ALL")
public class FilterComponent
extends Object
implements Serializable
The FilterComponent is used to build a filter to use to search
a repository. It may have a key, value, relational operator,
subcomponents, and aggregation operator. These pieces are put
together by the Filter class to build a string to represent the
filter in several different repository-specific formats.
The relation operations are used to test values against key names. The aggregation operation is used to join the pieces of the component.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intAll subcomponents of this component must be true for this component to be true.static final intIf any of the subcomponents of this component are true, this component is true.static final intFor this component to test true, the entity should have a key with a value that contains the value in this component.static final intFor this component to test true, the test must fail on the serverstatic final intFor this component to test true, the test must pass on the serverstatic final intFor this component to test true, the entity should have a key with a value that ends with the value in this component.static final intFor this component to test true, the entity should have a key with a value that equals the value in this component.static final intFor this component to test true, the entity should contain the value specified in this component (full text search).static final intFor this component to test true, the entity should have a key with a value that is greater than the value in this component.static final intFor this component to test true, the entity should have a key with a value that is greater than or equal to the value in this component.static final intFor this component to test true, the entity should have a key with a value that is less than the value in this component.static final intFor this component to test true, the entity should have a key with a value that is less than or equal to the value in this component.static final intFor this component to test true, the entity value specified should be not equal to the value provided.static final intFor this component to test true, the entity should have a key with a value that starts with the value in this component. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.FilterComponent(String key, int relation, String value) Create a new component with a key, a relation and a value. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAssociationPathComponent(AssociationPathComponent newComponent) Add an association path component to this component.voidaddAssociationPathComponent(AssociationPathComponent newComponent, int aggregation) Add an association path component to this component.voidaddComponent(FilterComponent newComponent) Add a subcomponent to this component.booleanDoes this filter component contain any association path filtersbooleanDoes this filter component contain any sub componentsintGet the aggregation operator to use to test this component.List<AssociationPathComponent> Iterator<AssociationPathComponent> Returns an iterator of the association path components of this componentIteratorReturn an iterator of the subcomponents of this component.StringgetKey()Get the attribute name to test for this component.intGet the type of relation to check.List<FilterComponent> StringgetValue()Get the value to look for.voidsetAggregation(int aggregator) Set the type of aggregation to use to test this component and its subscomponents.voidsetFilter(String key, int relation, String value) Set the filter component elements.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
ALL_OF
public static final int ALL_OFAll subcomponents of this component must be true for this component to be true.- See Also:
-
ANY_OF
public static final int ANY_OFIf any of the subcomponents of this component are true, this component is true.- See Also:
-
EQUALS
public static final int EQUALSFor this component to test true, the entity should have a key with a value that equals the value in this component.- See Also:
-
CONTAINS
public static final int CONTAINSFor this component to test true, the entity should have a key with a value that contains the value in this component.- See Also:
-
STARTSWITH
public static final int STARTSWITHFor this component to test true, the entity should have a key with a value that starts with the value in this component.- See Also:
-
ENDSWITH
public static final int ENDSWITHFor this component to test true, the entity should have a key with a value that ends with the value in this component.- See Also:
-
DAVSERVERTEST
public static final int DAVSERVERTESTFor this component to test true, the test must pass on the server- See Also:
-
DAVSERVERNOTTEST
public static final int DAVSERVERNOTTESTFor this component to test true, the test must fail on the server- See Also:
-
LT
public static final int LTFor this component to test true, the entity should have a key with a value that is less than the value in this component.- See Also:
-
LTE
public static final int LTEFor this component to test true, the entity should have a key with a value that is less than or equal to the value in this component.- See Also:
-
GT
public static final int GTFor this component to test true, the entity should have a key with a value that is greater than the value in this component.- See Also:
-
GTE
public static final int GTEFor this component to test true, the entity should have a key with a value that is greater than or equal to the value in this component.- See Also:
-
FULLTEXT
public static final int FULLTEXTFor this component to test true, the entity should contain the value specified in this component (full text search).- See Also:
-
NE
public static final int NEFor this component to test true, the entity value specified should be not equal to the value provided.- See Also:
-
-
Constructor Details
-
FilterComponent
public FilterComponent()Default constructor. -
FilterComponent
public FilterComponent(String key, int relation, String value) Create a new component with a key, a relation and a value.- Parameters:
key- The attribute name to test against.relation- The relationship test to make.value- The value to test entities against.
-
-
Method Details
-
setFilter
public void setFilter(String key, int relation, String value) Set the filter component elements.- Parameters:
key- The attribute name to test against.relation- The relationship test to make.value- The value to test entities against.
-
getKey
public String getKey()Get the attribute name to test for this component.- Returns:
- The key to test for in the repository.
-
getValue
public String getValue()Get the value to look for.- Returns:
- The value for the key we want to find in the repository.
-
getRelation
public int getRelation()Get the type of relation to check.- Returns:
- The relation test to use (equals, contains, etc.)
-
addComponent
Add a subcomponent to this component.- Parameters:
newComponent- A new subcomponent to add to this component to make complex search filters.
-
getComponents
public Iterator getComponents()Return an iterator of the subcomponents of this component.- Returns:
- An iterator containing the subcomponents of this component.
-
getSubcomponentList
-
containsComponents
public boolean containsComponents()Does this filter component contain any sub components- Returns:
- true if any subcomponents exist
-
addAssociationPathComponent
public void addAssociationPathComponent(AssociationPathComponent newComponent) Add an association path component to this component. This should be used when users need to filter on objects not only by their attributes, but also by an association path.Multiple association paths are supported. Adding multiple components will "AND" the filters together.
- Parameters:
newComponent- a new association path subcomponent to add to this component.
-
addAssociationPathComponent
public void addAssociationPathComponent(AssociationPathComponent newComponent, int aggregation) Add an association path component to this component. This should be used when users need to filter on objects not only by their attributes, but also by an association path.By default, all association paths are concatenated together with the "AND" operator. Users may choose to override this by setting the
aggregationparameter.- Parameters:
newComponent- a new association path subcomponent to add to this component.aggregation- the aggregation operator to use for this association path (ALL_OF, ANY_OF).
-
getAssociationPathComponents
public Iterator<AssociationPathComponent> getAssociationPathComponents()Returns an iterator of the association path components of this component- Returns:
- An iterator containing the association path components of this component
-
getAssociationComponents
public List<AssociationPathComponent> getAssociationComponents() -
containsAssociationPathComponents
public boolean containsAssociationPathComponents()Does this filter component contain any association path filters- Returns:
- true if any filtering on any association paths
-
setAggregation
public void setAggregation(int aggregator) Set the type of aggregation to use to test this component and its subscomponents.- Parameters:
aggregator- The aggregation operator to use (ALL_OF, ANY_OF).
-
getAggregation
public int getAggregation()Get the aggregation operator to use to test this component.- Returns:
- The aggregation operator for this component.
-