Class DefaultBusinessTypeFieldsValidator
java.lang.Object
com.broadleafcommerce.catalog.service.validation.product.type.DefaultBusinessTypeFieldsValidator
- All Implemented Interfaces:
ProductTypeValidator
The default validator that is used to validate products whose
types
are DefaultProductType.STANDARD
.- Author:
- Sunny Yu
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected BusinessTypeService<BusinessType>
protected Field
getFieldByName
(String fieldName, Product product) protected Object
getFieldValue
(Field field, Product product) void
setBusinessTypeService
(BusinessTypeService<BusinessType> businessTypeService) protected void
validateBusinessTypeFields
(Product businessInstance, String action, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.validation.Errors errors) protected Boolean
validateEmail
(Object fieldValue) protected Boolean
validateIsAtLeast
(Object fieldValue, Object argument, Product product) protected Boolean
validateLessThan
(Object fieldValue, Object argument) protected Boolean
validateLowercase
(Object fieldValue) protected Boolean
validateMaxLength
(Object fieldValue, Object argument) protected Boolean
validateMaxNumber
(Object fieldValue, Object argument) protected Boolean
validateMethod
(String methodName, Object fieldValue, Object argument, Product product) protected Boolean
validateMinLength
(Object fieldValue, Object argument) protected Boolean
validateMinNumber
(Object fieldValue, Object argument) protected Boolean
validateMoreThan
(Object fieldValue, Object argument) protected void
validateProductFields
(Product product, String action, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) void
validateProductForCreate
(Product product, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for create.void
validateProductForReplace
(Product product, org.springframework.validation.Errors errors, Product existingProduct, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for replace.void
validateProductForUpdate
(Product product, org.springframework.validation.Errors errors, Product existingProduct, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Validate the product for update.protected Boolean
validateRegex
(Object fieldValue, Object argument) protected void
validateRequired
(org.springframework.validation.Errors errors, BusinessTypeField field, String fieldName, Object fieldValue) protected Boolean
validateUppercase
(Object fieldValue) protected Boolean
validateUrl
(Object fieldValue) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.catalog.service.validation.product.type.ProductTypeValidator
canValidateCreate, canValidateReplace, canValidateUpdate, validateDefaultPrice
-
Field Details
-
UPDATE
- See Also:
-
CREATE
- See Also:
-
-
Constructor Details
-
DefaultBusinessTypeFieldsValidator
public DefaultBusinessTypeFieldsValidator()
-
-
Method Details
-
validateProductForCreate
public void validateProductForCreate(Product product, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ProductTypeValidator
Validate the product for create.- Specified by:
validateProductForCreate
in interfaceProductTypeValidator
- Parameters:
product
- the product to validateerrors
- holder for validation context information. When adding field validation errors, the field names should be in the context of the productcontext
- current context this validation is running in
-
validateProductForUpdate
public void validateProductForUpdate(Product product, org.springframework.validation.Errors errors, Product existingProduct, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ProductTypeValidator
Validate the product for update.- Specified by:
validateProductForUpdate
in interfaceProductTypeValidator
- Parameters:
product
- the product to validateerrors
- holder for validation context information. When adding field validation errors, the field names should be in the context of the productexistingProduct
- the current product in the databasecontext
- current context this validation is running in
-
validateProductForReplace
public void validateProductForReplace(Product product, org.springframework.validation.Errors errors, Product existingProduct, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Description copied from interface:ProductTypeValidator
Validate the product for replace.- Specified by:
validateProductForReplace
in interfaceProductTypeValidator
- Parameters:
product
- the product to validateerrors
- holder for validation context information. When adding field validation errors, the field names should be in the context of the productexistingProduct
- the current product in the databasecontext
- current context this validation is running in
-
validateProductFields
-
validateBusinessTypeFields
-
validateMethod
-
validateUrl
-
validateRegex
-
validateIsAtLeast
-
validateLessThan
-
validateMoreThan
-
validateUppercase
-
validateLowercase
-
validateEmail
-
validateMaxNumber
-
validateMinNumber
-
validateMaxLength
-
validateMinLength
-
validateRequired
protected void validateRequired(org.springframework.validation.Errors errors, BusinessTypeField field, String fieldName, Object fieldValue) -
getFieldByName
-
getFieldValue
- Throws:
IllegalAccessException
-
getBusinessTypeService
-
setBusinessTypeService
@Autowired @Lazy public void setBusinessTypeService(BusinessTypeService<BusinessType> businessTypeService)
-