public interface IDfExpressionSet extends IDfExpression
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");
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.
Modifier and Type | Field and Description |
---|---|
static int |
LOGICAL_OP_AND
Logical operator: AND.
|
static int |
LOGICAL_OP_DEFAULT
Logical operator: default (that is, AND).
|
static int |
LOGICAL_OP_OR
Logical operator: OR.
|
DATE_FORMAT_DEFAULT, EXPR_TYPE_FULLTEXT, EXPR_TYPE_MLT, EXPR_TYPE_RELATIVE_DATE, EXPR_TYPE_SET, EXPR_TYPE_SIMPLE_ATTR, EXPR_TYPE_UNDEFINED, EXPR_TYPE_VALUE_LIST_ATTR, EXPR_TYPE_VALUE_RANGE_ATTR
Modifier and Type | Method and Description |
---|---|
void |
addExpression(IDfExpression expression)
Add an expression in this expression set.
|
IDfExpressionSet |
addExpressionSet()
Adds an expression set to this expression set.
|
IDfExpressionSet |
addExpressionSet(int logicalOperator)
Adds an expression set to this expression set.
|
IDfFullTextExpression |
addFullTextExpression(java.lang.String strValue)
Adds a full-text search expression to this expression set.
|
IDfRelativeDateExpression |
addRelativeDateExpression(java.lang.String attrName,
int searchOpCode,
boolean isRepeated,
int relativeTime,
int timeUnit)
Adds a relative date expression to this expression set.
|
IDfSimpleAttrExpression |
addSimpleAttrExpression(java.lang.String attrName,
int valueDataType,
int searchOp,
boolean isCaseSensitive,
boolean isRepeated,
java.lang.String value)
Adds a simple attribute value expression to this expression set.
|
IDfValueListAttrExpression |
addValueListAttrExpression(java.lang.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.
|
IDfValueListAttrExpression |
addValueListAttrExpression(java.lang.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.
|
IDfValueRangeAttrExpression |
addValueRangeAttrExpression(java.lang.String attrName,
int valueDataType,
int searchOp,
boolean isCaseSensitive,
boolean isRepeated,
java.lang.String fromValue,
java.lang.String toValue)
Adds a search expression that requires the attribute value to be within a range.
|
PositionalOperator |
getDistance()
Get the proximity operator used to run proximity search..
|
int |
getExpressionCount()
Gets the number of expressions contained in this expression set.
|
IDfEnumeration |
getExpressions()
Gets the list of expressions contained by this expression set.
|
int |
getLogicalOperator()
Gets the logical operator applied between each expression of this set.
|
void |
setDistance(PositionalOperator positionalOperator)
Sets the positional operator used to run proximity search.
|
void |
setLogicalOperator(int logicalOperator)
Sets the logical operator applied between each expression of this set.
|
acceptVisitor, getDateFormat, getExpressionType, setDateFormat
static final int LOGICAL_OP_AND
static final int LOGICAL_OP_OR
static final int LOGICAL_OP_DEFAULT
int getExpressionCount()
IDfEnumeration getExpressions()
IDfEnumeration
of IDfExpression
)IDfExpression
IDfSimpleAttrExpression addSimpleAttrExpression(java.lang.String attrName, int valueDataType, int searchOp, boolean isCaseSensitive, boolean isRepeated, java.lang.String value)
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).IDfValue.DF_STRING
,
IDfSimpleAttrExpression.SEARCH_OP_CONTAINS
IDfRelativeDateExpression addRelativeDateExpression(java.lang.String attrName, int searchOpCode, boolean isRepeated, int relativeTime, int timeUnit)
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.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
).IDfSimpleAttrExpression.SEARCH_OP_GREATER_EQUAL
IDfValueRangeAttrExpression addValueRangeAttrExpression(java.lang.String attrName, int valueDataType, int searchOp, boolean isCaseSensitive, boolean isRepeated, java.lang.String fromValue, java.lang.String toValue)
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).IDfValue.DF_STRING
,
IDfSimpleAttrExpression.SEARCH_OP_CONTAINS
IDfValueListAttrExpression addValueListAttrExpression(java.lang.String attrName, int valueDataType, int searchOp, boolean isCaseSensitive, boolean isRepeated)
IDfValueListAttrExpression
returned.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.IDfValue.DF_STRING
,
IDfSimpleAttrExpression.SEARCH_OP_CONTAINS
IDfValueListAttrExpression addValueListAttrExpression(java.lang.String attrName, int valueDataType, int searchOp, boolean isCaseSensitive, boolean isRepeated, IDfList valueList)
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.IDfValue.DF_STRING
,
IDfSimpleAttrExpression.SEARCH_OP_CONTAINS
IDfFullTextExpression addFullTextExpression(java.lang.String strValue)
strValue
- The string to look for in full text.IDfExpressionSet addExpressionSet()
AND
).IDfExpressionSet addExpressionSet(int logicalOperator)
logicalOperator
- The logical operator applied to the set (AND
or OR
).void addExpression(IDfExpression expression)
expression
- an expression created through IDfExpressionSet methods or through DfExpressionFactoryint getLogicalOperator()
LOGICAL_OP_AND
or LOGICAL_OP_OR
).LOGICAL_OP_AND
,
LOGICAL_OP_OR
void setLogicalOperator(int logicalOperator)
logicalOperator
- The logical operator (either LOGICAL_OP_AND
or LOGICAL_OP_OR
).LOGICAL_OP_AND
,
LOGICAL_OP_OR
void setDistance(PositionalOperator positionalOperator)
positionalOperator
- bean containing the constraints to define the proximity searchPositionalOperator getDistance()
Copyright 1994-2023 OpenText Corporation. All rights reserved.