Class ProductOptionValidationServiceImpl
java.lang.Object
org.broadleafcommerce.core.order.service.ProductOptionValidationServiceImpl
- All Implemented Interfaces:
ProductOptionValidationService
@Service("blProductOptionValidationService")
public class ProductOptionValidationServiceImpl
extends Object
implements ProductOptionValidationService
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Integerprotected org.springframework.core.env.EnvironmentOption types whose value is entered freely rather than chosen from an enumerated list, so there is no allowed value list to check the submitted value against.protected ProductOptionDaoprotected booleanprotected static final Integerprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindSkuIdsForProductOptionValues(Long productId, String attributeName, String attributeValue, List<Long> possibleSkuIds) booleanhasProductOptionValidationStrategy(ProductOption productOption) booleanisAddOrNoneType(ProductOption productOption) protected booleanisNonEnumeratedOptionType(ProductOption productOption) protected booleanisRequiredAttributeNotProvided(ProductOption productOption, String attributeValue) booleanisSubmitType(ProductOption productOption) protected booleanrequiresValidation(ProductOption productOption, String value) validate(ProductOption productOption, String value) protected voidvalidateOptionValueIsAllowed(ProductOption productOption, String attributeValue) Rejects a value that is not one of the option's allowed values.voidvalidateProductOptionAttributes(Product product, Map<String, String> attributeValues) For each submitted attribute that corresponds to a product option on the product, validates that the submitted value is one the option allows.protected BooleanvalidateRegex(String regex, String value) voidvalidateWithoutException(ProductOption productOption, String attributeValue, ActivityMessages messages)
-
Field Details
-
ADD_TYPE_RANK
-
SUBMIT_TYPE_RANK
-
NON_ENUMERATED_OPTION_TYPES
Option types whose value is entered freely rather than chosen from an enumerated list, so there is no allowed value list to check the submitted value against. -
productOptionDao
-
environment
@Autowired protected org.springframework.core.env.Environment environment -
xssExploitProtectionEnabled
@Value("${exploitProtection.xssEnabled:false}") protected boolean xssExploitProtectionEnabled -
siteXssWrapperEnabled
@Value("${blc.site.enable.xssWrapper:false}") protected boolean siteXssWrapperEnabled
-
-
Constructor Details
-
ProductOptionValidationServiceImpl
public ProductOptionValidationServiceImpl()
-
-
Method Details
-
validate
- Specified by:
validatein interfaceProductOptionValidationService
-
validateProductOptionAttributes
Description copied from interface:ProductOptionValidationServiceFor each submitted attribute that corresponds to a product option on the product, validates that the submitted value is one the option allows. A value that is not one of an enumerated option'sallowed valuesis rejected. Non-enumerated option types (free entry, e.g. text or date) are excluded, since their value is not chosen from a list. An attribute that does not match a product option is left alone, since order item attributes are a generic key-value store also used for custom, non-option attributes.- Specified by:
validateProductOptionAttributesin interfaceProductOptionValidationService- Parameters:
product- the product the attributes are being validated againstattributeValues- the submitted item attribute name/value pairs
-
validateOptionValueIsAllowed
Rejects a value that is not one of the option's allowed values. Only applies to enumerated options, i.e. those with a non-emptyProductOption.getAllowedValues(). Non-enumerated option types (NON_ENUMERATED_OPTION_TYPES, e.g. a text or date input) are excluded, since their value is entered freely rather than chosen from a list. A missing value is allowed here, since the required check is handled byvalidate(ProductOption, String). -
isNonEnumeratedOptionType
-
isRequiredAttributeNotProvided
protected boolean isRequiredAttributeNotProvided(ProductOption productOption, String attributeValue) -
requiresValidation
-
validateRegex
-
hasProductOptionValidationStrategy
- Specified by:
hasProductOptionValidationStrategyin interfaceProductOptionValidationService
-
isSubmitType
- Specified by:
isSubmitTypein interfaceProductOptionValidationService
-
isAddOrNoneType
- Specified by:
isAddOrNoneTypein interfaceProductOptionValidationService
-
validateWithoutException
public void validateWithoutException(ProductOption productOption, String attributeValue, ActivityMessages messages) - Specified by:
validateWithoutExceptionin interfaceProductOptionValidationService
-
findSkuIdsForProductOptionValues
public List<Long> findSkuIdsForProductOptionValues(Long productId, String attributeName, String attributeValue, List<Long> possibleSkuIds) - Specified by:
findSkuIdsForProductOptionValuesin interfaceProductOptionValidationService
-