Class RuleFieldValidator
java.lang.Object
org.broadleafcommerce.openadmin.server.service.persistence.validation.RuleFieldValidator
- All Implemented Interfaces:
PopulateValueRequestValidator,org.springframework.core.Ordered
@Component("blRuleFieldValidator")
public class RuleFieldValidator
extends Object
implements PopulateValueRequestValidator
Validates that a rule can be parsed out successfully. Most of this comes from
RuleFieldPersistenceProvider.- Author:
- Phillip Verheyden (phillipuniverse)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected RuleFieldExtractionUtilityprotected org.broadleafcommerce.common.sandbox.SandBoxHelperFields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleancanHandleValidation(PopulateValueRequest populateValueRequest) protected StringintgetOrder()protected booleanprotected booleanisAllowedQuantityRule(String mvel) Quantity based rules are stored afterRuleFieldPersistenceProvider.clearMvelString(org.broadleafcommerce.openadmin.web.rulebuilder.DataDTOToMVELTranslator, java.lang.String, java.lang.String, org.broadleafcommerce.openadmin.web.rulebuilder.dto.DataDTO)unescapes their quotes, so they are checked the way they are storedvalidate(PopulateValueRequest populateValueRequest, Serializable instance) Validates a population request prior to invoking anyFieldPersistenceProviders.
-
Field Details
-
ERROR_KEY_EXPRESSION_NOT_ALLOWED
- See Also:
-
ruleFieldExtractionUtility
-
sandBoxHelper
protected org.broadleafcommerce.common.sandbox.SandBoxHelper sandBoxHelper
-
-
Constructor Details
-
RuleFieldValidator
public RuleFieldValidator()
-
-
Method Details
-
validate
public PropertyValidationResult validate(PopulateValueRequest populateValueRequest, Serializable instance) Description copied from interface:PopulateValueRequestValidatorValidates a population request prior to invoking anyFieldPersistenceProviders. If no validation could be performed for the givenPopulateValueRequestthen return true to let it pass on to a differentPopulateValueRequestValidatoror on to aFieldPersistenceProvider.- Specified by:
validatein interfacePopulateValueRequestValidator- Parameters:
populateValueRequest- thePopulateValueRequestthat should be validatedinstance- the Hibernate entity that will attempt to be populated- Returns:
- false if the
PopulateValueRequestfailed validation. In this case, the request should not be passed to anyFieldPersistenceProviders.
-
isAllowed
- Returns:
- true if the mvel is empty or does not use new, reflection, a blocked method or a statement separator
-
isAllowedQuantityRule
Quantity based rules are stored afterRuleFieldPersistenceProvider.clearMvelString(org.broadleafcommerce.openadmin.web.rulebuilder.DataDTOToMVELTranslator, java.lang.String, java.lang.String, org.broadleafcommerce.openadmin.web.rulebuilder.dto.DataDTO)unescapes their quotes, so they are checked the way they are stored -
getMvelParsingErrorMesage
-
canHandleValidation
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceorg.springframework.core.Ordered
-