com.sas.services.information
Class FilterComponent

com.sas.services.information.FilterComponent
All Implemented Interfaces:
java.io.Serializable

public class FilterComponent
implements java.io.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:
Serialized Form

Field Summary
static int ALL_OF
          All subcomponents of this component must be true for this component to be true.
static int ANY_OF
          If any of the subcomponents of this component are true, this component is true.
static int CONTAINS
          For this component to test true, the entity should have a key with a value that contains the value in this component.
static int DAVSERVERNOTTEST
          For this component to test true, the test must fail on the server
static int DAVSERVERTEST
          For this component to test true, the test must pass on the server
static int ENDSWITH
          For this component to test true, the entity should have a key with a value that ends with the value in this component.
static int EQUALS
          For this component to test true, the entity should have a key with a value that equals the value in this component.
static int FULLTEXT
          For this component to test true, the entity should contain the value specified in this component (full text search).
static int GT
          For this component to test true, the entity should have a key with a value that is greater than the value in this component.
static int GTE
          For 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 int LT
          For this component to test true, the entity should have a key with a value that is less than the value in this component.
static int LTE
          For 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 int NE
          For this component to test true, the entity value specified should be not equal to the value provided.
static int STARTSWITH
          For this component to test true, the entity should have a key with a value that starts with the value in this component.
 
Constructor Summary
FilterComponent()
          Default constructor.
FilterComponent(java.lang.String key, int relation, java.lang.String value)
          Create a new component with a key, a relation and a value.
 
Method Summary
 void addAssociationPathComponent(com.sas.services.information.AssociationPathComponent newComponent)
          Add an association path component to this component.
 void addAssociationPathComponent(com.sas.services.information.AssociationPathComponent newComponent, int aggregation)
          Add an association path component to this component.
 void addComponent(FilterComponent newComponent)
          Add a subcomponent to this component.
 boolean containsAssociationPathComponents()
          Does this filter component contain any association path filters
 boolean containsComponents()
          Does this filter component contain any sub components
 int getAggregation()
          Get the aggregation operator to use to test this component.
 java.util.Iterator<com.sas.services.information.AssociationPathComponent> getAssociationPathComponents()
          Returns an iterator of the association path components of this component
 java.util.Iterator getComponents()
          Return an iterator of the subcomponents of this component.
 java.lang.String getKey()
          Get the attribute name to test for this component.
 int getRelation()
          Get the type of relation to check.
 java.lang.String getValue()
          Get the value to look for.
 void setAggregation(int aggregator)
          Set the type of aggregation to use to test this component and its subscomponents.
 void setFilter(java.lang.String key, int relation, java.lang.String value)
          Set the filter component elements.
 

Field Detail

ALL_OF

public static final int ALL_OF
All subcomponents of this component must be true for this component to be true.

See Also:
Constant Field Values

ANY_OF

public static final int ANY_OF
If any of the subcomponents of this component are true, this component is true.

See Also:
Constant Field Values

EQUALS

public static final int EQUALS
For this component to test true, the entity should have a key with a value that equals the value in this component.

See Also:
Constant Field Values

CONTAINS

public static final int CONTAINS
For this component to test true, the entity should have a key with a value that contains the value in this component.

See Also:
Constant Field Values

STARTSWITH

public static final int STARTSWITH
For this component to test true, the entity should have a key with a value that starts with the value in this component.

See Also:
Constant Field Values

ENDSWITH

public static final int ENDSWITH
For this component to test true, the entity should have a key with a value that ends with the value in this component.

See Also:
Constant Field Values

DAVSERVERTEST

public static final int DAVSERVERTEST
For this component to test true, the test must pass on the server

See Also:
Constant Field Values

DAVSERVERNOTTEST

public static final int DAVSERVERNOTTEST
For this component to test true, the test must fail on the server

See Also:
Constant Field Values

LT

public static final int LT
For 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:
Constant Field Values

LTE

public static final int LTE
For 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:
Constant Field Values

GT

public static final int GT
For 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:
Constant Field Values

GTE

public static final int GTE
For 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:
Constant Field Values

FULLTEXT

public static final int FULLTEXT
For this component to test true, the entity should contain the value specified in this component (full text search).

See Also:
Constant Field Values

NE

public static final int NE
For this component to test true, the entity value specified should be not equal to the value provided.

See Also:
Constant Field Values
Constructor Detail

FilterComponent

public FilterComponent()
Default constructor.


FilterComponent

public FilterComponent(java.lang.String key,
                       int relation,
                       java.lang.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 Detail

setFilter

public void setFilter(java.lang.String key,
                      int relation,
                      java.lang.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 java.lang.String getKey()
Get the attribute name to test for this component.

Returns:
The key to test for in the repository.

getValue

public java.lang.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

public void addComponent(FilterComponent newComponent)
Add a subcomponent to this component.

Parameters:
newComponent - A new subcomponent to add to this component to make complex search filters.

getComponents

public java.util.Iterator getComponents()
Return an iterator of the subcomponents of this component.

Returns:
An iterator containing the subcomponents of this component.

containsComponents

public boolean containsComponents()
Does this filter component contain any sub components

Returns:
true if any subcomponents exist

addAssociationPathComponent

public void addAssociationPathComponent(com.sas.services.information.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(com.sas.services.information.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 aggregation parameter.

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 java.util.Iterator<com.sas.services.information.AssociationPathComponent> getAssociationPathComponents()
Returns an iterator of the association path components of this component

Returns:
An iterator containing the association path components of this component

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.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.