Class DataDTOToMVELTranslator
java.lang.Object
org.broadleafcommerce.openadmin.web.rulebuilder.DataDTOToMVELTranslator
Utility class to convert a DataDTO/ExpressionDTO into an MVEL string
- Author:
- Elbert Bautista (elbertbautista)
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
buildCollectionExpression
(StringBuffer sb, String entityKey, String field, Object[] value, SupportedFieldType type, SupportedFieldType secondaryType, String operator, boolean includeParenthesis, boolean isFieldComparison, boolean ignoreCase, boolean isNegation, boolean ignoreQuotes) protected void
buildExpression
(StringBuffer sb, String entityKey, String field, Object[] value, SupportedFieldType type, SupportedFieldType secondaryType, String operator, boolean includeParenthesis, boolean isFieldComparison, boolean ignoreCase, boolean isNegation, boolean ignoreQuotes) protected void
buildExpression
(ExpressionDTO expressionDTO, StringBuffer sb, String entityKey, BLCOperator operator, RuleBuilderFieldService fieldService) protected String
buildFieldName
(String entityKey, String fieldName) protected void
buildMVEL
(DataDTO dataDTO, StringBuffer sb, String entityKey, String groupOperator, RuleBuilderFieldService fieldService) createMVEL
(String entityKey, DataDTO dataDTO, RuleBuilderFieldService fieldService) protected String
escapeInternalMiltyQuotes
(String processedValue) protected String
escapeInternalQuotes
(String processedValue) protected Object[]
extractBasicValues
(Object value) protected String
formatField
(String entityKey, SupportedFieldType type, String field, boolean ignoreCase) protected String
formatValue
(String fieldName, String entityKey, SupportedFieldType type, SupportedFieldType secondaryType, Object[] value, boolean isFieldComparison, boolean ignoreCase, boolean ignoreQuotes) boolean
isProjection
(Object value)
-
Field Details
-
CONTAINS_OPERATOR
- See Also:
-
STARTS_WITH_OPERATOR
- See Also:
-
ENDS_WITH_OPERATOR
- See Also:
-
EQUALS_OPERATOR
- See Also:
-
NOT_EQUALS_OPERATOR
- See Also:
-
GREATER_THAN_EQUALS_OPERATOR
- See Also:
-
LESS_THAN_EQUALS_OPERATOR
- See Also:
-
GREATER_THAN_OPERATOR
- See Also:
-
LESS_THAN_OPERATOR
- See Also:
-
COLLECTION_OPERATOR
- See Also:
-
SIZE_GREATER_THAN_OPERATOR
- See Also:
-
SIZE_GREATER_THAN_EQUALS_OPERATOR
- See Also:
-
SIZE_LESS_THAN_OPERATOR
- See Also:
-
SIZE_LESS_THAN_EQUALS_OPERATOR
- See Also:
-
SIZE_EQUALS_OPERATOR
- See Also:
-
ZERO_OPERATOR
- See Also:
-
OLD_CONTAINS_OPERATOR
- See Also:
-
OLD_STARTS_WITH_OPERATOR
- See Also:
-
OLD_ENDS_WITH_OPERATOR
- See Also:
-
-
Constructor Details
-
DataDTOToMVELTranslator
public DataDTOToMVELTranslator()
-
-
Method Details
-
createMVEL
public String createMVEL(String entityKey, DataDTO dataDTO, RuleBuilderFieldService fieldService) throws MVELTranslationException - Throws:
MVELTranslationException
-
buildMVEL
protected void buildMVEL(DataDTO dataDTO, StringBuffer sb, String entityKey, String groupOperator, RuleBuilderFieldService fieldService) throws MVELTranslationException - Throws:
MVELTranslationException
-
buildExpression
protected void buildExpression(ExpressionDTO expressionDTO, StringBuffer sb, String entityKey, BLCOperator operator, RuleBuilderFieldService fieldService) throws MVELTranslationException - Throws:
MVELTranslationException
-
extractBasicValues
-
escapeInternalQuotes
-
escapeInternalMiltyQuotes
-
isProjection
-
buildCollectionExpression
protected void buildCollectionExpression(StringBuffer sb, String entityKey, String field, Object[] value, SupportedFieldType type, SupportedFieldType secondaryType, String operator, boolean includeParenthesis, boolean isFieldComparison, boolean ignoreCase, boolean isNegation, boolean ignoreQuotes) throws MVELTranslationException - Throws:
MVELTranslationException
-
buildExpression
protected void buildExpression(StringBuffer sb, String entityKey, String field, Object[] value, SupportedFieldType type, SupportedFieldType secondaryType, String operator, boolean includeParenthesis, boolean isFieldComparison, boolean ignoreCase, boolean isNegation, boolean ignoreQuotes) throws MVELTranslationException - Throws:
MVELTranslationException
-
buildFieldName
-
formatField
protected String formatField(String entityKey, SupportedFieldType type, String field, boolean ignoreCase) -
formatValue
protected String formatValue(String fieldName, String entityKey, SupportedFieldType type, SupportedFieldType secondaryType, Object[] value, boolean isFieldComparison, boolean ignoreCase, boolean ignoreQuotes) throws MVELTranslationException - Throws:
MVELTranslationException
-