Class AbstractFilterTranslator<T>

java.lang.Object
org.identityconnectors.framework.common.objects.filter.AbstractFilterTranslator<T>
Type Parameters:
T - The result type of the translator. Commonly this will be a string, but there are cases where you might need to return a more complex data structure. For example if you are building a SQL query, you will need not *just* the base WHERE clause but a list of tables that need to be joined together.
All Implemented Interfaces:
FilterTranslator<T>

public abstract class AbstractFilterTranslator<T> extends Object implements FilterTranslator<T>
Base class to make it easier to implement Search. A search filter may contain operators (such as 'contains' or 'in') or may contain logical operators (such as 'AND', 'OR' or 'NOT') that a connector cannot implement using the native API of the target system or application. A connector developer should subclass AbstractFilterTranslator in order to declare which filter operations the connector does support. This allows the FilterTranslator instance to analyze a specified search filter and reduce the filter to its most efficient form. The default (and worst-case) behavior is to return a null expression, which means that the connector should return "everything" (that is, should return all values for every requested attribute) and rely on the common code in the framework to perform filtering. This "fallback" behavior is good (in that it ensures consistency of search behavior across connector implementations) but it is obviously better for performance and scalability if each connector performs as much filtering as the native API of the target can support.

A subclass should override each of the following methods where possible:

  1. createAndExpression(T, T)
  2. createOrExpression(T, T)
  3. createContainsExpression(ContainsFilter, boolean)
  4. createEndsWithExpression(EndsWithFilter, boolean)
  5. createEqualsExpression(EqualsFilter, boolean)
  6. createGreaterThanExpression(GreaterThanFilter, boolean)
  7. createGreaterThanOrEqualExpression(GreaterThanOrEqualFilter, boolean)
  8. createStartsWithExpression(StartsWithFilter, boolean)
  9. createContainsAllValuesExpression(ContainsAllValuesFilter, boolean)

Translation can then be performed using translate(Filter).

  • Constructor Details

    • AbstractFilterTranslator

      public AbstractFilterTranslator()
  • Method Details

    • translate

      public final List<T> translate(Filter filter)
      Main method to be called to translate a filter
      Specified by:
      translate in interface FilterTranslator<T>
      Parameters:
      filter - The filter to translate.
      Returns:
      The list of queries to be performed. The list size() may be one of the following:
      1. 0 - This signifies fetch everything. This may occur if your filter was null or one of your create* methods returned null.
      2. 1 - List contains a single query that will return the results from the filter. Note that the results may be a superset of those specified by the filter in the case that one of your create* methods returned null. That is OK from a behavior standpoint since ConnectorFacade performs a second level of filtering. However it is undesirable from a performance standpoint.
      3. 1 - List contains multiple queries that must be performed in order to meet the filter that was passed in. Note that this only occurs if your createOrExpression(T, T) method can return null. If this happens, it is the responsibility of the connector implementor to perform each query and combine the results. In order to eliminate duplicates, the connector implementation must keep an in-memory HashSet of those UID that have been visited thus far. This will not scale well if your result sets are large. Therefore it is recommended that if at all possible you implement createOrExpression(T, T)