Search in sources :

Example 1 with Expression

use of org.broadleafcommerce.openadmin.web.rulebuilder.statement.Expression in project BroadleafCommerce by BroadleafCommerce.

the class MVELToDataWrapperTranslator method appendExpression.

public void appendExpression(String phrase, RuleBuilderFieldService fieldService, DataDTO parentDTO, List<ExpressionDTO> myCriteriaList) throws MVELTranslationException {
    Expression expression = phraseTranslator.createExpression(phrase);
    FieldDTO field = fieldService.getField(expression.getField());
    if (field == null) {
        throw new MVELTranslationException(MVELTranslationException.SPECIFIED_FIELD_NOT_FOUND, "MVEL phrase is not " + "compatible with the RuleBuilderFieldService associated with the current rules builder. " + "Unable to find the field specified: (" + expression.getField() + ")");
    }
    SupportedFieldType type = fieldService.getSupportedFieldType(expression.getField());
    ExpressionDTO expressionDTO = createExpressionDTO(expression);
    postProcessCriteria(parentDTO, myCriteriaList, expressionDTO, type);
}
Also used : SupportedFieldType(org.broadleafcommerce.common.presentation.client.SupportedFieldType) Expression(org.broadleafcommerce.openadmin.web.rulebuilder.statement.Expression) FieldDTO(org.broadleafcommerce.openadmin.web.rulebuilder.dto.FieldDTO) ExpressionDTO(org.broadleafcommerce.openadmin.web.rulebuilder.dto.ExpressionDTO)

Aggregations

SupportedFieldType (org.broadleafcommerce.common.presentation.client.SupportedFieldType)1 ExpressionDTO (org.broadleafcommerce.openadmin.web.rulebuilder.dto.ExpressionDTO)1 FieldDTO (org.broadleafcommerce.openadmin.web.rulebuilder.dto.FieldDTO)1 Expression (org.broadleafcommerce.openadmin.web.rulebuilder.statement.Expression)1