Package com.im.df.api.dml
Class Operators
- java.lang.Object
-
- com.im.df.api.dml.Operators
-
public final class Operators extends java.lang.ObjectThe well known built-in operators forDFTermExpression.- Author:
- Petr Hamernik
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOperators.AfterOperatorUsed in date fields instead ofGREATER_THAN.static classOperators.AllDataOperatorRepresents all data.static classOperators.BeforeOperatorUsed in date fields instead ofLESS_THAN.static classOperators.BetweenOperatorA special class for Between operator.static classOperators.EqualsForDecimalsOperatorA special class for "=" operator for decimal numbers.static classOperators.ErrorOperatorA special class for "ERROR" operator.static classOperators.GeForDecimalsOperatorResponsible for ">=" operator for decimal numbers.static classOperators.IgnoreOperatorA special class for dumb IGNORE operator.static classOperators.LeForDecimalsOperatorResponsible for "<=" operator for decimal numbers.static classOperators.ListOperatorIN LIST and NOT IN LIST operators.static classOperators.NullOperatorIS NULL/ IS NOT NULL operators.static classOperators.RelativeDateOperatorOperator for relative date queries.static classOperators.ShortcutOperatorShortcut operator is used to define a shortcut for existing operator with predefined operands.static classOperators.SimpleFieldValuesOperatorCurrently we support only "Field Operator [Value, [Value, ...]]" formats.static classOperators.SimpleLogicalOperatorClass for AND/OR operators.static classOperators.SimpleTextOperatorOperators for strings.static classOperators.StructureOperatorClass for all Structure based operators.
-
Field Summary
Fields Modifier and Type Field Description static DFOperatorAFTERAfter operator, used in date fields instead ofGREATER_THANoperator.static DFOperatorALL_DATAA special operator without operands which represents all data (SELECT * FROM ...).static DFOperatorANDLogical AND operator.static DFOperatorBEFOREBefore operator, used in date fields instead ofLESS_THANoperator.static DFOperatorBETWEENBetween operator - works for text, int, date and float.static java.lang.StringCASE_INSENSITIVE_SEARCHFlag for running textual queries in case insensitive mode.static DFOperatorCONTAINSCONTAINS text based operator (a short cut for LIKE '%foo%').static DFOperatorENDS_WITHENDS_WITH text based operator (a short cut for LIKE '%foo').static DFOperatorEQUALSEqual operator - works for text, int, date.static DFOperatorEQUALS_FOR_DECIMALSEquals for decimals - works for float.static DFOperatorERRORThis is just an dump operator.static DFOperatorFALSEUnary FALSE operator - can be applied to boolean fields.static DFOperatorGREATER_OR_EQUALS_FOR_DECIMALSGreater or equal for decimals.static DFOperatorGREATER_THANGreater than operator - works for text, int and float.static DFOperatorGREATER_THAN_OR_EQUALGreater than or equal operator - works for text, int.static DFOperatorIGNOREThis is just dumb operator.static DFOperatorIN_LISTThis operator takes two or more operands.static DFOperatorLASTLast operator, used for relative date queries.static DFOperatorLAST_14_DAYSShortcut for Last 14 Days query.static DFOperatorLAST_7_DAYSShortcut for Last 7 Days query.static DFOperatorLESS_OR_EQUALS_FOR_DECIMALSLess or equal for decimals.static DFOperatorLESS_THANLess than operator - works for text, int and float.static DFOperatorLESS_THAN_OR_EQUALLess than or equal operator - works for text, int.static DFOperatorLIKELIKE text based operator.static DFOperatorNOT_CONTAINSNOT_CONTAINS text based operator (a short cut for NOT LIKE '%foo%').static DFOperatorNOT_ENDS_WITHNOT_ENDS_WITH text based operator (a short cut for NOT LIKE '%foo').static DFOperatorNOT_EQUALSNot equal operator - works for text, int, date.static DFOperatorNOT_IN_LISTThis operator takes two or more operands.static DFOperatorNOT_LIKENOT LIKE text based operator.static DFOperatorNOT_NULLUnary operator - takes any field and test if the value is NOT NULL.static DFOperatorNOT_STARTS_WITHNOT_STARTS_WITH text based operator (a short cut for NOT LIKE 'foo%').static DFOperatorNULLUnary operator - takes any field and test if the value is NULL.static DFOperatorORLogical OR operator.static java.lang.StringSORTED_BY_LISTFlag for sorting result set using a list.static DFOperatorSTARTS_WITHSTARTS_WITH text based operator (a short cut for LIKE 'foo%').static DFOperatorSTRUCTURE_EXACTStructure search operator.static DFOperatorSTRUCTURE_EXACT_FRAGMENTStructure search operator.static DFOperatorSTRUCTURE_PERFECTStructure search operator.static DFOperatorSTRUCTURE_SIMILARITYStructure search operator.static DFOperatorSTRUCTURE_SUBSTRUCTUREStructure search operator.static DFOperatorSTRUCTURE_SUPERSTRUCTUREStructure search operator.static DFOperatorTODAYShortcut for Last 1 Days query.static DFOperatorTRUEUnary TRUE operator - can be applied to boolean fields.static DFOperatorVOIDUnary operator - takes any field and tests if the value is NULL OR child row NOT EXISTS.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DFTermExpressionconvertLegacyOperators(DFTermExpression expr)static java.util.List<DFOperator>getAll()Get array of all operators currently registered into the system.static java.util.List<DFOperator>getAllIncludingSpecial()Get all operators registered in the system including special operators (currently ERROR and IGNORE).static java.util.List<DFOperator>getAllLogical()static java.util.List<DFOperator>getAllStructural()Returns all structural operators.static java.util.List<DFOperator>getAllStructural(DFField field)Get the appropriate structure search operators for the JChem table type.static DFOperatorgetDefaultOperatorFor(DFField field)Returns default search operator for givenfield.static java.util.List<DFOperator>getMarkushStructural()static java.util.List<DFOperator>getOperatorsAcceptableFor(DFField field)static java.util.List<DFOperator>getQueryStructural()static booleanisAndOr(DFOperator operator)static booleanisCaseInsensitive(java.util.Map<java.lang.String,java.lang.Object> options)Is search case insensitive?static booleanisSortedByList(java.util.Map<java.lang.String,java.lang.Object> options)Is search result set sorted by a list?
-
-
-
Field Detail
-
CASE_INSENSITIVE_SEARCH
public static final java.lang.String CASE_INSENSITIVE_SEARCH
Flag for running textual queries in case insensitive mode. In case you want to use case insensitive search theDFTermExpression's options map have to contain {#link Operators#CASE_INSENSITIVE_SEARCH} as key and a booleantrueas value.
An example usage:
Map<String, Object> opts = new HashMap<String, Object>();
opts.put(Operators.CASE_INSENSITIVE_SEARCH, true);
DFTermExpression query = DFTermsFactory.createFieldOperatorValueExpr(Operators.LIKE, field, opts, pattern);- Since:
- 16.4.18
- See Also:
- Constant Field Values
-
SORTED_BY_LIST
public static final java.lang.String SORTED_BY_LIST
Flag for sorting result set using a list. Used to optimize list sorting on some DBs (currently Oracle and MySQL) - IN list SQL query is additionally sorted only if sort is not defined and this flag isfalseor not present. Used as a key forDFTermExpression's options.- Since:
- 19.10.0
- See Also:
- Constant Field Values
-
EQUALS
public static final DFOperator EQUALS
Equal operator - works for text, int, date.
-
NOT_EQUALS
public static final DFOperator NOT_EQUALS
Not equal operator - works for text, int, date.
-
LESS_THAN
public static final DFOperator LESS_THAN
Less than operator - works for text, int and float.
-
LESS_THAN_OR_EQUAL
public static final DFOperator LESS_THAN_OR_EQUAL
Less than or equal operator - works for text, int.
-
GREATER_THAN
public static final DFOperator GREATER_THAN
Greater than operator - works for text, int and float.
-
GREATER_THAN_OR_EQUAL
public static final DFOperator GREATER_THAN_OR_EQUAL
Greater than or equal operator - works for text, int.
-
LIKE
public static final DFOperator LIKE
LIKE text based operator.
-
NOT_LIKE
public static final DFOperator NOT_LIKE
NOT LIKE text based operator.
-
STARTS_WITH
public static final DFOperator STARTS_WITH
STARTS_WITH text based operator (a short cut for LIKE 'foo%').
-
NOT_STARTS_WITH
public static final DFOperator NOT_STARTS_WITH
NOT_STARTS_WITH text based operator (a short cut for NOT LIKE 'foo%').
-
ENDS_WITH
public static final DFOperator ENDS_WITH
ENDS_WITH text based operator (a short cut for LIKE '%foo').
-
NOT_ENDS_WITH
public static final DFOperator NOT_ENDS_WITH
NOT_ENDS_WITH text based operator (a short cut for NOT LIKE '%foo').
-
CONTAINS
public static final DFOperator CONTAINS
CONTAINS text based operator (a short cut for LIKE '%foo%').
-
NOT_CONTAINS
public static final DFOperator NOT_CONTAINS
NOT_CONTAINS text based operator (a short cut for NOT LIKE '%foo%').
-
BETWEEN
public static final DFOperator BETWEEN
Between operator - works for text, int, date and float.
-
EQUALS_FOR_DECIMALS
public static final DFOperator EQUALS_FOR_DECIMALS
Equals for decimals - works for float.
-
LESS_OR_EQUALS_FOR_DECIMALS
public static final DFOperator LESS_OR_EQUALS_FOR_DECIMALS
Less or equal for decimals.
-
GREATER_OR_EQUALS_FOR_DECIMALS
public static final DFOperator GREATER_OR_EQUALS_FOR_DECIMALS
Greater or equal for decimals.
-
LAST
public static final DFOperator LAST
Last operator, used for relative date queries.
-
BEFORE
public static final DFOperator BEFORE
Before operator, used in date fields instead ofLESS_THANoperator.
-
AFTER
public static final DFOperator AFTER
After operator, used in date fields instead ofGREATER_THANoperator.
-
TODAY
public static final DFOperator TODAY
Shortcut for Last 1 Days query.
-
LAST_7_DAYS
public static final DFOperator LAST_7_DAYS
Shortcut for Last 7 Days query.
-
LAST_14_DAYS
public static final DFOperator LAST_14_DAYS
Shortcut for Last 14 Days query.
-
AND
public static final DFOperator AND
Logical AND operator. It accepts two or more operands, but the current implementation also works with a single operand (this can be changed in the future, because it's not correct).
-
OR
public static final DFOperator OR
Logical OR operator. It accepts two or more operands, but the current implementation also works with a single operand (this can be changed in the future, because it's not correct).
-
TRUE
public static final DFOperator TRUE
Unary TRUE operator - can be applied to boolean fields.
-
FALSE
public static final DFOperator FALSE
Unary FALSE operator - can be applied to boolean fields.
-
NULL
public static final DFOperator NULL
Unary operator - takes any field and test if the value is NULL.
-
NOT_NULL
public static final DFOperator NOT_NULL
Unary operator - takes any field and test if the value is NOT NULL.
-
VOID
public static final DFOperator VOID
Unary operator - takes any field and tests if the value is NULL OR child row NOT EXISTS. Supported by SQL query, but not by Conditional formatting.
-
IN_LIST
public static final DFOperator IN_LIST
This operator takes two or more operands. The first operand should be field and next operands should be values. It tests if the field value is one of the value from the list.
-
NOT_IN_LIST
public static final DFOperator NOT_IN_LIST
This operator takes two or more operands. The first operand should be field and next operands should be values. It tests if the field value is not one of the value from the list.
-
STRUCTURE_PERFECT
public static final DFOperator STRUCTURE_PERFECT
Structure search operator. The first operand must beDFFieldwithDFFieldStructureCapability, as the second operand is expected constant Molecule value and as third operand it takes String with Chemical terms filter.
-
STRUCTURE_EXACT
public static final DFOperator STRUCTURE_EXACT
Structure search operator. The description is the same likeSTRUCTURE_PERFECT.
-
STRUCTURE_SUBSTRUCTURE
public static final DFOperator STRUCTURE_SUBSTRUCTURE
Structure search operator. The description is the same likeSTRUCTURE_PERFECT.
-
STRUCTURE_SUPERSTRUCTURE
public static final DFOperator STRUCTURE_SUPERSTRUCTURE
Structure search operator. The description is the same likeSTRUCTURE_PERFECT.
-
STRUCTURE_SIMILARITY
public static final DFOperator STRUCTURE_SIMILARITY
Structure search operator. The description is the same likeSTRUCTURE_PERFECT.
-
STRUCTURE_EXACT_FRAGMENT
public static final DFOperator STRUCTURE_EXACT_FRAGMENT
Structure search operator. The description is the same likeSTRUCTURE_PERFECT.
-
IGNORE
public static final DFOperator IGNORE
This is just dumb operator. It means ignore all its operands (possibly including whole subtree). Do not use this operator if you don't have really good reasons to do it. It should be removed from API
-
ERROR
public static final DFOperator ERROR
This is just an dump operator. It is used only for transfer of incorrect parts of expression between different UI components. For example query in form and query builder can communicate using this error operator if the query is not fully valid.
-
ALL_DATA
public static final DFOperator ALL_DATA
A special operator without operands which represents all data (SELECT * FROM ...). It is used byDFTermExpression.ALL_DATA
-
-
Method Detail
-
isCaseInsensitive
public static boolean isCaseInsensitive(java.util.Map<java.lang.String,java.lang.Object> options)
Is search case insensitive?- Parameters:
options- search options, cannot benull- Returns:
trueif options have case insensitive search set, otherwisefalse- Since:
- 18.25.0
-
isSortedByList
public static boolean isSortedByList(java.util.Map<java.lang.String,java.lang.Object> options)
Is search result set sorted by a list?- Parameters:
options- search options, cannot benull- Returns:
trueif options have sorted by list set, otherwisefalse- Since:
- 19.10.0
-
getAll
public static java.util.List<DFOperator> getAll()
Get array of all operators currently registered into the system.TODO P2: It will be possible to register operators into the DIF when this SPI will be defined. This will be done together with new types of
DFFieldregistration.- Returns:
- The list of operators. Currently returns always new instance, so you can do anything with it.
-
getAllIncludingSpecial
public static java.util.List<DFOperator> getAllIncludingSpecial()
Get all operators registered in the system including special operators (currently ERROR and IGNORE).- Returns:
- The list of all operators
-
getAllStructural
public static java.util.List<DFOperator> getAllStructural(DFField field)
Get the appropriate structure search operators for the JChem table type.- Parameters:
field- The structure field- Returns:
- The list of valid search operators.
- Since:
- 17.1.9
- See Also:
For returning all structural operators.
-
getAllStructural
public static java.util.List<DFOperator> getAllStructural()
Returns all structural operators.- Returns:
- The list of all structural operators.
- Since:
- 17.1.9
- See Also:
getAllStructural(com.im.df.api.ddl.DFField)
-
getMarkushStructural
public static java.util.List<DFOperator> getMarkushStructural()
-
getQueryStructural
public static java.util.List<DFOperator> getQueryStructural()
-
getAllLogical
public static java.util.List<DFOperator> getAllLogical()
-
isAndOr
public static boolean isAndOr(DFOperator operator)
- Parameters:
operator- The operator to be tested.- Returns:
- True if operator is AND or OR.
-
getOperatorsAcceptableFor
public static java.util.List<DFOperator> getOperatorsAcceptableFor(DFField field)
-
getDefaultOperatorFor
public static DFOperator getDefaultOperatorFor(DFField field)
Returns default search operator for givenfield. Recognizesfieldtype (capability) and also fetches default structure search type forfieldschema.- Parameters:
field- for which operator is required- Returns:
- operator. Never returns null. If no default is found, returns first acceptable operator by the field type
- Since:
- 22.1.0
- See Also:
getOperatorsAcceptableFor(com.im.df.api.ddl.DFField),getAllStructural(com.im.df.api.ddl.DFField),getAll()
-
convertLegacyOperators
public static DFTermExpression convertLegacyOperators(DFTermExpression expr)
-
-