Package org.openbravo.client.application
Class DynamicExpressionParser
- java.lang.Object
-
- org.openbravo.client.application.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 Summary
Fields Modifier and Type Field Description static String
REPLACE_DISPLAY_LOGIC_SERVER_PATTERN
-
Constructor Summary
Constructors Constructor Description DynamicExpressionParser(String code, Parameter parameter, boolean parameterDisplayLogic)
DynamicExpressionParser(String code, Parameter parameter, List<Parameter> parameters, boolean parameterDisplayLogic)
Constructor to be used when the parameter is not a process parameter.DynamicExpressionParser(String code, Process process, boolean parameterDisplayLogic)
DynamicExpressionParser(String code, Tab tab)
DynamicExpressionParser(String code, Tab tab, boolean tabLevelDisplayLogic)
DynamicExpressionParser(String code, Tab tab, ApplicationDictionaryCachedStructures cachedStructures)
DynamicExpressionParser(String code, Tab tab, ApplicationDictionaryCachedStructures cachedStructures, Field field)
DynamicExpressionParser(String code, Tab tab, Field field)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Field>
getFields()
Returns the list of Fields used in the dynamic expressionString
getJSExpression()
Gets a JavaScript expression based on the dynamic expression, e.g @SomeColumn@!'Y' results in currentValues.someColumn !== true.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 tabsList<Parameter>
getParameters()
Returns the list of Parameters used in the dynamic expressionList<String>
getSessionAttributes()
Returns the list of session attribute names used in the dynamic expressionvoid
parse()
static String
replaceSystemPreferencesInDisplayLogic(String displayLogic)
Given the Display logic expression, it replaces the preferences properties with its valuesString
toString()
-
-
-
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, ApplicationDictionaryCachedStructures cachedStructures)
-
DynamicExpressionParser
public DynamicExpressionParser(String code, Tab tab, ApplicationDictionaryCachedStructures cachedStructures, 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
-
toString
public String toString()
- Overrides:
toString
in classObject
- See Also:
getJSExpression()
-
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
-
-