Class DynamicExpressionParser


  • public class DynamicExpressionParser
    extends Object
    Parses a dynamic expressions and extracts information, e.g. The expression is using a field or an auxiliary input, etc.

    The transformation of @Expression@ is the following:

    • @ColumnName@ are transformed into property name, e.g. @DocStatus@ into documentStatus
    • @AuxiliarInput@ is transformed just removes the @, e.g. @FinancialManagementDep@ into FinancialManagementDep
    • Field Detail

      • REPLACE_DISPLAY_LOGIC_SERVER_PATTERN

        public static final String REPLACE_DISPLAY_LOGIC_SERVER_PATTERN
        See Also:
        Constant Field Values
    • Constructor Detail

      • DynamicExpressionParser

        public DynamicExpressionParser​(String code,
                                       Process process,
                                       boolean parameterDisplayLogic)
      • DynamicExpressionParser

        public DynamicExpressionParser​(String code,
                                       Parameter parameter,
                                       boolean parameterDisplayLogic)
      • DynamicExpressionParser

        public DynamicExpressionParser​(String code,
                                       Parameter parameter,
                                       List<Parameter> parameters,
                                       boolean parameterDisplayLogic)
        Constructor to be used when the parameter is not a process parameter. In this case the list of related parameters is given as a constructor parameter.
        Parameters:
        code - the code with the Dynamic Expression to parse.
        parameter - the parameter where the expression is defined.
        parameters - the list of related parameters.
        parameterDisplayLogic - boolean to determine if the expression is based in a Parameter
      • DynamicExpressionParser

        public DynamicExpressionParser​(String code,
                                       Tab tab,
                                       boolean tabLevelDisplayLogic)
      • DynamicExpressionParser

        public DynamicExpressionParser​(String code,
                                       Tab tab)
      • DynamicExpressionParser

        public DynamicExpressionParser​(String code,
                                       Tab tab,
                                       Field field)
    • Method Detail

      • parse

        public void parse()
      • getJSExpression

        public String getJSExpression()
        Gets a JavaScript expression based on the dynamic expression, e.g @SomeColumn@!'Y' results in currentValues.someColumn !== true.

        Note: Field comparison with 'Y' or 'N' are transformed in true or false

        Returns:
        A JavaScript expression
      • getFields

        public List<Field> getFields()
        Returns the list of Fields used in the dynamic expression
      • getOtherTokensInExpression

        public List<String> getOtherTokensInExpression()
        Returns the list of tokens that are not fields of the tab It is only used when parsing the display logic of the tabs
      • getParameters

        public List<Parameter> getParameters()
        Returns the list of Parameters used in the dynamic expression
      • getSessionAttributes

        public List<String> getSessionAttributes()
        Returns the list of session attribute names used in the dynamic expression
      • replaceSystemPreferencesInDisplayLogic

        public static String replaceSystemPreferencesInDisplayLogic​(String displayLogic)
        Given the Display logic expression, it replaces the preferences properties with its values
        Parameters:
        displayLogic - DisplayLogic to be replaced
        Returns:
        Returns the Display logic expression with the properties replaced