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:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ALL_OF`
  All subcomponents of this component must be true for this component to be true.
  `static final int`
  `ANY_OF`
  If any of the subcomponents of this component are true, this component is true.
  `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.
  `static final int`
  `DAVSERVERNOTTEST`
  For this component to test true, the test must fail on the server
  `static final int`
  `DAVSERVERTEST`
  For this component to test true, the test must pass on the server
  `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.
  `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.
  `static final int`
  `FULLTEXT`
  For this component to test true, the entity should contain the value specified in this component (full text search).
  `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.
  `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.
  `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.
  `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.
  `static final int`
  `NE`
  For this component to test true, the entity value specified should be not equal to the value provided.
  `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.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FilterComponent()`
  Default constructor.
  `FilterComponent(String key, int relation, String value)`
  Create a new component with a key, a relation and a value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addAssociationPathComponent(AssociationPathComponent newComponent)`
  Add an association path component to this component.
  `void`
  `addAssociationPathComponent(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.
  `List<AssociationPathComponent>`
  `getAssociationComponents()`
  `Iterator<AssociationPathComponent>`
  `getAssociationPathComponents()`
  Returns an iterator of the association path components of this component
  `Iterator`
  `getComponents()`
  Return an iterator of the subcomponents of this component.
  `String`
  `getKey()`
  Get the attribute name to test for this component.
  `int`
  `getRelation()`
  Get the type of relation to check.
  `List<FilterComponent>`
  `getSubcomponentList()`
  `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(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_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 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

    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 Iterator getComponents()
    Return an iterator of the subcomponents of this component.

    Returns:
      An iterator containing the subcomponents of this component.

  - ### getSubcomponentList

    public List<FilterComponent> 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 `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 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.