org.broadleafcommerce.openadmin.web.rulebuilder
Class DataDTOToMVELTranslator

java.lang.Object
  extended by org.broadleafcommerce.openadmin.web.rulebuilder.DataDTOToMVELTranslator

public class DataDTOToMVELTranslator
extends Object

Utility class to convert a DataDTO/ExpressionDTO into an MVEL string

Author:
Elbert Bautista (elbertbautista)

Constructor Summary
DataDTOToMVELTranslator()
           
 
Method Summary
protected  void buildExpression(ExpressionDTO expressionDTO, StringBuffer sb, String entityKey, BLCOperator operator, RuleBuilderFieldService fieldService)
           
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 buildMVEL(DataDTO dataDTO, StringBuffer sb, String entityKey, String groupOperator, RuleBuilderFieldService fieldService)
           
 String createMVEL(String entityKey, DataDTO dataDTO, RuleBuilderFieldService fieldService)
           
protected  Object[] extractBasicValues(Object value)
           
protected  Object[] extractDate(ExpressionDTO expressionDTO, BLCOperator operator, String key)
           
protected  String formatField(String entityKey, SupportedFieldType type, String field, boolean ignoreCase, boolean isNegation)
           
protected  String formatValue(String fieldName, String entityKey, SupportedFieldType type, SupportedFieldType secondaryType, Object[] value, boolean isFieldComparison, boolean ignoreCase, boolean ignoreQuotes)
           
 boolean isProjection(Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataDTOToMVELTranslator

public DataDTOToMVELTranslator()
Method Detail

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

extractDate

protected Object[] extractDate(ExpressionDTO expressionDTO,
                               BLCOperator operator,
                               String key)

extractBasicValues

protected Object[] extractBasicValues(Object value)

isProjection

public boolean isProjection(Object value)

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

formatField

protected String formatField(String entityKey,
                             SupportedFieldType type,
                             String field,
                             boolean ignoreCase,
                             boolean isNegation)

formatValue

protected String formatValue(String fieldName,
                             String entityKey,
                             SupportedFieldType type,
                             SupportedFieldType secondaryType,
                             Object[] value,
                             boolean isFieldComparison,
                             boolean ignoreCase,
                             boolean ignoreQuotes)
                      throws MVELTranslationException
Throws:
MVELTranslationException


Copyright © 2013. All Rights Reserved.