Interface IDfExpressionSet

All Superinterfaces:
IDfExpression

public interface IDfExpressionSet extends IDfExpression
Defines a set of search expressions.
Add other search expressions to this set to construct a full search expression.

This set of search expressions is used in IDfQueryBuilder to construct a search query.

Usage samples:
Construct the search expression ((A contains VALUE1) and (B equals VALUE2))

 IDfExpressionSet rootExprSet = queryBuilder.getRootExpressionSet();
 rootExprSet.addSimpleAttrExpression("A", IDfValue.DF_STRING, IDfSimpleAttrExpression.SEARCH_OP_CONTAINS, true,
 false,
 "VALUE1");
 rootExprSet.addSimpleAttrExpression("B", IDfValue.DF_STRING, IDfSimpleAttrExpression.SEARCH_OP_EQUAL, true, false,
 "VALUE2");

Construct the search expression ((A contains VALUE1) or (B equals VALUE2 and C equals VALUE3))
 IDfExpressionSet rootExprSet = queryBuilder.getRootExpressionSet();
 IDfExpressionSet exprSetOr = rootExprSet.addExpressionSet(IDfExpressionSet.LOGICAL_OP_OR);
 exprSetOr.addSimpleAttrExpression("A", IDfValue.DF_STRING, IDfSimpleAttrExpression.SEARCH_OP_CONTAINS, true, false,
 "VALUE1");
 IDfExpressionSet exprSetAnd = exprSetOr.addExpressionSet(IDfExpressionSet.LOGICAL_OP_AND);
 exprSetAnd.addSimpleAttrExpression("B", IDfValue.DF_STRING, IDfSimpleAttrExpression.SEARCH_OP_EQUAL, true, false,
 "VALUE2");
 exprSetAnd.addSimpleAttrExpression("C", IDfValue.DF_STRING, IDfSimpleAttrExpression.SEARCH_OP_EQUAL, true, false,
 "VALUE3");
 With external sources, the OR operator is not supported between two different attributes.
 
See Also:
  • Field Details

    • LOGICAL_OP_AND

      static final int LOGICAL_OP_AND
      Logical operator: AND.
      See Also:
    • LOGICAL_OP_OR

      static final int LOGICAL_OP_OR
      Logical operator: OR.
      See Also:
    • LOGICAL_OP_DEFAULT

      static final int LOGICAL_OP_DEFAULT
      Logical operator: default (that is, AND).
      See Also:
  • Method Details

    • getExpressionCount

      int getExpressionCount()
      Gets the number of expressions contained in this expression set.
      Returns:
      The number of expressions.
    • getExpressions

      IDfEnumeration getExpressions()
      Gets the list of expressions contained by this expression set.
      Returns:
      The list of expressions (IDfEnumeration of IDfExpression)
      See Also:
    • addSimpleAttrExpression

      IDfSimpleAttrExpression addSimpleAttrExpression(String attrName, int valueDataType, int searchOp, boolean isCaseSensitive, boolean isRepeated, String value)
      Adds a simple attribute value expression to this expression set.
      Parameters:
      attrName - The attribute name.
      valueDataType - The data type of the value (constants defined in IDfValue, such as DF_STRING).
      searchOp - The search operation code (constants defined in IDfAttrExpression and IDfSimpleAttrExpression, such as SEARCH_OP_CONTAINS).
      isCaseSensitive - true if the search operation is case sensitive; false otherwise. When the backend is not a database, searching is always case insensitive; this property will be ignored.
      isRepeated - true if the attribute is repeated; false otherwise.
      value - The expected value of the search operation; or null if there is no value (for example: for IS_NULL or IS_NOT_NULL operator).
      Returns:
      The new simple attribute value expression created and added.
      See Also:
    • addRelativeDateExpression

      IDfRelativeDateExpression addRelativeDateExpression(String attrName, int searchOpCode, boolean isRepeated, int relativeTime, int timeUnit)
      Adds a relative date expression to this expression set. For example, if searchOpCode=GREATER_THAN, relativeTime=-3, timeUnit=MONTH, then the expression defines a constraint on a date that must be greater than the current date minus 3 months.
      Parameters:
      attrName - The attribute name.
      searchOpCode - The search operation code (constants defined in IDfAttrExpression and IDfSimpleAttrExpression, such as SEARCH_OP_CONTAINS).
      isRepeated - true if the attribute is repeated; false otherwise.
      relativeTime - The relative time to add to the actual date of the query execution.
      timeUnit - The time unit (Calendar.MINUTE, Calendar.DAY_OF_MONTH, Calendar.MONTH, Calendar.YEAR).
      Returns:
      The new relative date expression created and added.
      See Also:
    • addValueRangeAttrExpression

      IDfValueRangeAttrExpression addValueRangeAttrExpression(String attrName, int valueDataType, int searchOp, boolean isCaseSensitive, boolean isRepeated, String fromValue, String toValue)
      Adds a search expression that requires the attribute value to be within a range.
      Parameters:
      attrName - The attribute name.
      valueDataType - The data type of the value (constants defined in IDfValue, for example, DF_STRING).
      searchOp - The search operation code (constants defined in IDfAttrExpression and IDfSimpleAttrExpression, for example, SEARCH_OP_CONTAINS).
      isCaseSensitive - true if the search operation is case sensitive; false otherwise. When the backend is not a database, searching is always case insensitive; this property will be ignored.
      isRepeated - true if the attribute is repeated; false otherwise.
      fromValue - The minimum value of the range (included).
      toValue - The maximum value of the range (included).
      Returns:
      The new search expression created and added.
      See Also:
    • addValueListAttrExpression

      IDfValueListAttrExpression addValueListAttrExpression(String attrName, int valueDataType, int searchOp, boolean isCaseSensitive, boolean isRepeated)
      Adds a search expression that requires the attribute value to be included in a list of values. The list of values is initially empty. New values can be added directly on the IDfValueListAttrExpression returned.
      Parameters:
      attrName - The attribute name.
      valueDataType - The data type of the value (constants defined in IDfValue, for example, DF_STRING).
      searchOp - The search operation code (constants defined in IDfAttrExpression and IDfSimpleAttrExpression, for example, SEARCH_OP_CONTAINS).
      isCaseSensitive - true if the search operation is case sensitive; false otherwise. When the backend is not a database, searching is always case insensitive; this property will be ignored.
      isRepeated - true if the attribute is repeated; false otherwise.
      Returns:
      The new search expression created and added.
      See Also:
    • addValueListAttrExpression

      IDfValueListAttrExpression addValueListAttrExpression(String attrName, int valueDataType, int searchOp, boolean isCaseSensitive, boolean isRepeated, IDfList valueList)
      Adds a search expression that requires the attribute value to be included in a list of values.
      Parameters:
      attrName - The attribute name.
      valueDataType - The data type of the value (constants defined in IDfValue, for example, DF_STRING).
      searchOp - The search operation code (constants defined in IDfAttrExpression and IDfSimpleAttrExpression, for example, SEARCH_OP_CONTAINS).
      isCaseSensitive - true if the search operation is case sensitive; false otherwise. When the backend is not a database, searching is always case insensitive; this property will be ignored.
      isRepeated - true if the attribute is repeated; false otherwise.
      valueList - The list of values (IDfList of String). The non-string values are skipped.
      Returns:
      The new search expression created and added.
      See Also:
    • addFullTextExpression

      IDfFullTextExpression addFullTextExpression(String strValue)
      Adds a full-text search expression to this expression set.
      Parameters:
      strValue - The string to look for in full text.
      Returns:
      The new full-text search expression created and added.
    • addExpressionSet

      IDfExpressionSet addExpressionSet()
      Adds an expression set to this expression set. The new expression set is created with the default logical operator (that is, AND).
      Returns:
      The new expression set created and added.
    • addExpressionSet

      IDfExpressionSet addExpressionSet(int logicalOperator)
      Adds an expression set to this expression set.
      Parameters:
      logicalOperator - The logical operator applied to the set (AND or OR).
      Returns:
      The new expression set created and added.
    • addExpression

      void addExpression(IDfExpression expression)
      Add an expression in this expression set.
      Parameters:
      expression - an expression created through IDfExpressionSet methods or through DfExpressionFactory
    • getLogicalOperator

      int getLogicalOperator()
      Gets the logical operator applied between each expression of this set.
      Returns:
      The logical operator (either LOGICAL_OP_AND or LOGICAL_OP_OR).
      See Also:
    • setLogicalOperator

      void setLogicalOperator(int logicalOperator)
      Sets the logical operator applied between each expression of this set.
      Parameters:
      logicalOperator - The logical operator (either LOGICAL_OP_AND or LOGICAL_OP_OR).
      See Also:
    • setDistance

      void setDistance(PositionalOperator positionalOperator)
      Sets the positional operator used to run proximity search. This distance will be used only if the expression set contains IDfFulltextExpression objects (at least 2). Proximity searches are only supported when the DFC search service generates xQuery.
      Parameters:
      positionalOperator - bean containing the constraints to define the proximity search
    • getDistance

      PositionalOperator getDistance()
      Get the proximity operator used to run proximity search..
      Returns:
      the proximity operator