Class Operators


  • public final class Operators
    extends java.lang.Object
    The well known built-in operators for DFTermExpression.
    Author:
    Petr Hamernik
    • 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 the DFTermExpression's options map have to contain {#link Operators#CASE_INSENSITIVE_SEARCH} as key and a boolean true 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 is false or not present. Used as a key for DFTermExpression'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 of LESS_THAN operator.
      • AFTER

        public static final DFOperator AFTER
        After operator, used in date fields instead of GREATER_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 be DFField with DFFieldStructureCapability, 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 like STRUCTURE_PERFECT.
      • STRUCTURE_SUBSTRUCTURE

        public static final DFOperator STRUCTURE_SUBSTRUCTURE
        Structure search operator. The description is the same like STRUCTURE_PERFECT.
      • STRUCTURE_SUPERSTRUCTURE

        public static final DFOperator STRUCTURE_SUPERSTRUCTURE
        Structure search operator. The description is the same like STRUCTURE_PERFECT.
      • STRUCTURE_SIMILARITY

        public static final DFOperator STRUCTURE_SIMILARITY
        Structure search operator. The description is the same like STRUCTURE_PERFECT.
      • STRUCTURE_EXACT_FRAGMENT

        public static final DFOperator STRUCTURE_EXACT_FRAGMENT
        Structure search operator. The description is the same like STRUCTURE_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.
    • 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 be null
        Returns:
        true if options have case insensitive search set, otherwise false
        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 be null
        Returns:
        true if options have sorted by list set, otherwise false
        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.
      • 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)
        Return true if operator is AND or OR, false otherwise.
        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)