Package com.im.df.api.dml
Class Operators
- java.lang.Object
-
- com.im.df.api.dml.Operators
-
public final class Operators extends java.lang.Object
The well known built-in operators forDFTermExpression
.- Author:
- Petr Hamernik
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Operators.AfterOperator
Used in date fields instead ofGREATER_THAN
.static class
Operators.AllDataOperator
Represents all data.static class
Operators.BeforeOperator
Used in date fields instead ofLESS_THAN
.static class
Operators.BetweenOperator
A special class for Between operator.static class
Operators.EqualsForDecimalsOperator
A special class for "=" operator for decimal numbers.static class
Operators.ErrorOperator
A special class for "ERROR" operator.static class
Operators.GeForDecimalsOperator
Responsible for ">=" operator for decimal numbers.static class
Operators.IgnoreOperator
A special class for dumb IGNORE operator.static class
Operators.LeForDecimalsOperator
Responsible for "<=" operator for decimal numbers.static class
Operators.ListOperator
IN LIST and NOT IN LIST operators.static class
Operators.NullOperator
IS NULL/ IS NOT NULL operators.static class
Operators.RelativeDateOperator
Operator for relative date queries.static class
Operators.ShortcutOperator
Shortcut operator is used to define a shortcut for existing operator with predefined operands.static class
Operators.SimpleFieldValuesOperator
Currently we support only "Field Operator [Value, [Value, ...]]" formats.static class
Operators.SimpleLogicalOperator
Class for AND/OR operators.static class
Operators.SimpleTextOperator
Operators for strings.static class
Operators.StructureOperator
Class for all Structure based operators.
-
Field Summary
Fields Modifier and Type Field Description static DFOperator
AFTER
After operator, used in date fields instead ofGREATER_THAN
operator.static DFOperator
ALL_DATA
A special operator without operands which represents all data (SELECT * FROM ...).static DFOperator
AND
Logical AND operator.static DFOperator
BEFORE
Before operator, used in date fields instead ofLESS_THAN
operator.static DFOperator
BETWEEN
Between operator - works for text, int, date and float.static java.lang.String
CASE_INSENSITIVE_SEARCH
Flag for running textual queries in case insensitive mode.static DFOperator
CONTAINS
CONTAINS text based operator (a short cut for LIKE '%foo%').static DFOperator
ENDS_WITH
ENDS_WITH text based operator (a short cut for LIKE '%foo').static DFOperator
EQUALS
Equal operator - works for text, int, date.static DFOperator
EQUALS_FOR_DECIMALS
Equals for decimals - works for float.static DFOperator
ERROR
This is just an dump operator.static DFOperator
FALSE
Unary FALSE operator - can be applied to boolean fields.static DFOperator
GREATER_OR_EQUALS_FOR_DECIMALS
Greater or equal for decimals.static DFOperator
GREATER_THAN
Greater than operator - works for text, int and float.static DFOperator
GREATER_THAN_OR_EQUAL
Greater than or equal operator - works for text, int.static DFOperator
IGNORE
This is just dumb operator.static DFOperator
IN_LIST
This operator takes two or more operands.static DFOperator
LAST
Last operator, used for relative date queries.static DFOperator
LAST_14_DAYS
Shortcut for Last 14 Days query.static DFOperator
LAST_7_DAYS
Shortcut for Last 7 Days query.static DFOperator
LESS_OR_EQUALS_FOR_DECIMALS
Less or equal for decimals.static DFOperator
LESS_THAN
Less than operator - works for text, int and float.static DFOperator
LESS_THAN_OR_EQUAL
Less than or equal operator - works for text, int.static DFOperator
LIKE
LIKE text based operator.static DFOperator
NOT_CONTAINS
NOT_CONTAINS text based operator (a short cut for NOT LIKE '%foo%').static DFOperator
NOT_ENDS_WITH
NOT_ENDS_WITH text based operator (a short cut for NOT LIKE '%foo').static DFOperator
NOT_EQUALS
Not equal operator - works for text, int, date.static DFOperator
NOT_IN_LIST
This operator takes two or more operands.static DFOperator
NOT_LIKE
NOT LIKE text based operator.static DFOperator
NOT_NULL
Unary operator - takes any field and test if the value is NOT NULL.static DFOperator
NOT_STARTS_WITH
NOT_STARTS_WITH text based operator (a short cut for NOT LIKE 'foo%').static DFOperator
NULL
Unary operator - takes any field and test if the value is NULL.static DFOperator
OR
Logical OR operator.static java.lang.String
SORTED_BY_LIST
Flag for sorting result set using a list.static DFOperator
STARTS_WITH
STARTS_WITH text based operator (a short cut for LIKE 'foo%').static DFOperator
STRUCTURE_EXACT
Structure search operator.static DFOperator
STRUCTURE_EXACT_FRAGMENT
Structure search operator.static DFOperator
STRUCTURE_PERFECT
Structure search operator.static DFOperator
STRUCTURE_SIMILARITY
Structure search operator.static DFOperator
STRUCTURE_SUBSTRUCTURE
Structure search operator.static DFOperator
STRUCTURE_SUPERSTRUCTURE
Structure search operator.static DFOperator
TODAY
Shortcut for Last 1 Days query.static DFOperator
TRUE
Unary TRUE operator - can be applied to boolean fields.static DFOperator
VOID
Unary 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 DFTermExpression
convertLegacyOperators(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 DFOperator
getDefaultOperatorFor(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 boolean
isAndOr(DFOperator operator)
static boolean
isCaseInsensitive(java.util.Map<java.lang.String,java.lang.Object> options)
Is search case insensitive?static boolean
isSortedByList(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 booleantrue
as 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 isfalse
or 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_THAN
operator.
-
AFTER
public static final DFOperator AFTER
After operator, used in date fields instead ofGREATER_THAN
operator.
-
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 beDFField
withDFFieldStructureCapability
, 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:
true
if 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:
true
if 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
DFField
registration.- 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
. Recognizesfield
type (capability) and also fetches default structure search type forfield
schema.- 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)
-
-