Class PredicateQlt

  • All Implemented Interfaces:
    Querylet

    public final class PredicateQlt
    extends AbstractQlt<com.tibco.patterns.learn.jaxb.model.PredicateQueryType>
    A Predicate querylet for evaluating a predicate expression.

    A field in one of the records in the record pair can be referred as the table record field using this notation: $"FieldName" . Fields in the other record in the pair can be referred to as the query record fields using this notation: ${FieldName} . References to query fields are replaced with given field values when a NetricsQuery is constructed, thus any text query fields must be quoted before using them in predicate expressions: "${FieldName}" .

    The predicate expression must be symmetric, i.e. its evaluation result must be the same for record pairs (A, B) and (B, A) for any records A and B.

    • Constructor Summary

      Constructors 
      Constructor Description
      PredicateQlt​(java.lang.String predicate, java.util.List<java.lang.String> allFields)
      Creates predicate querylet with the given predicate expression.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String asJavaCode​(java.lang.String qltVarName, java.lang.String valuesVarName, java.lang.String fieldNamesVarName)
      Builds the predicate query Java source using the predicate expression string.
      java.util.List<java.lang.String> getFieldNames()  
      com.netrics.likeit.NetricsQuery getNetricsQlt​(java.lang.String[] values)
      Constructs a NetricsQuery querylet from the stored XML structure and the given field values.
      java.lang.String getPredicate()  
      void setPredicate​(java.lang.String value)
      Sets the predicate expression.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PredicateQlt

        public PredicateQlt​(java.lang.String predicate,
                            java.util.List<java.lang.String> allFields)
        Creates predicate querylet with the given predicate expression.
        Parameters:
        predicate - - the predicate expression.
        allFields - - all non-key fields in the data table.
        Throws:
        java.lang.IllegalArgumentException - if predicate expression does not use any fields or if it uses different query fields and table fields.
    • Method Detail

      • setPredicate

        public void setPredicate​(java.lang.String value)
        Sets the predicate expression.
        Parameters:
        value - - the new predicate expression.
        Throws:
        java.lang.IllegalArgumentException - if predicate expression does not use any fields or if it uses different query fields and table fields.
      • getPredicate

        public java.lang.String getPredicate()
        Returns:
        the predicate expression.
      • getNetricsQlt

        public com.netrics.likeit.NetricsQuery getNetricsQlt​(java.lang.String[] values)
        Constructs a NetricsQuery querylet from the stored XML structure and the given field values. The references to the query field values ${queryField} in the stored predicate expression are replaced with the given values.
        Parameters:
        values - - query field values for all non-key fields.
        Returns:
        a querylet that contains the predicate expression with replaced query values.
      • getFieldNames

        public java.util.List<java.lang.String> getFieldNames()
        Returns:
        the names of fields used in the predicate expression
      • asJavaCode

        public java.lang.String asJavaCode​(java.lang.String qltVarName,
                                           java.lang.String valuesVarName,
                                           java.lang.String fieldNamesVarName)
        Builds the predicate query Java source using the predicate expression string.
        Parameters:
        valuesVarName - - the generated Java code replaces references to query field names in the predicate expression with values in this variable.
        fieldNamesVarName - - the generated Java code replaces the default field names used in the predicate expression with custom field names in this variable.
        qltVarName - - the name of the variable to which the querylet is assigned.
        Returns:
        a string with Java code that creates the given querylet.