Class DefaultBusinessTypeFieldsValidator

java.lang.Object
com.broadleafcommerce.catalog.service.validation.product.type.DefaultBusinessTypeFieldsValidator
All Implemented Interfaces:
ProductTypeValidator

public class DefaultBusinessTypeFieldsValidator extends Object implements ProductTypeValidator
The default validator that is used to validate products whose types are DefaultProductType.STANDARD.
Author:
Sunny Yu
  • Field Details

  • 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 interface ProductTypeValidator
      Parameters:
      product - the product to validate
      errors - holder for validation context information. When adding field validation errors, the field names should be in the context of the product
      context - 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 interface ProductTypeValidator
      Parameters:
      product - the product to validate
      errors - holder for validation context information. When adding field validation errors, the field names should be in the context of the product
      existingProduct - the current product in the database
      context - 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 interface ProductTypeValidator
      Parameters:
      product - the product to validate
      errors - holder for validation context information. When adding field validation errors, the field names should be in the context of the product
      existingProduct - the current product in the database
      context - current context this validation is running in
    • validateProductFields

      protected void validateProductFields(Product product, String action, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    • validateBusinessTypeFields

      protected void validateBusinessTypeFields(Product businessInstance, String action, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.validation.Errors errors)
    • validateMethod

      protected Boolean validateMethod(String methodName, Object fieldValue, Object argument, Product product)
    • validateUrl

      protected Boolean validateUrl(Object fieldValue)
    • validateRegex

      protected Boolean validateRegex(Object fieldValue, Object argument)
    • validateIsAtLeast

      protected Boolean validateIsAtLeast(Object fieldValue, Object argument, Product product)
    • validateLessThan

      protected Boolean validateLessThan(Object fieldValue, Object argument)
    • validateMoreThan

      protected Boolean validateMoreThan(Object fieldValue, Object argument)
    • validateUppercase

      protected Boolean validateUppercase(Object fieldValue)
    • validateLowercase

      protected Boolean validateLowercase(Object fieldValue)
    • validateEmail

      protected Boolean validateEmail(Object fieldValue)
    • validateMaxNumber

      protected Boolean validateMaxNumber(Object fieldValue, Object argument)
    • validateMinNumber

      protected Boolean validateMinNumber(Object fieldValue, Object argument)
    • validateMaxLength

      protected Boolean validateMaxLength(Object fieldValue, Object argument)
    • validateMinLength

      protected Boolean validateMinLength(Object fieldValue, Object argument)
    • validateRequired

      protected void validateRequired(org.springframework.validation.Errors errors, BusinessTypeField field, String fieldName, Object fieldValue)
    • getFieldByName

      protected Field getFieldByName(String fieldName, Product product)
    • getFieldValue

      protected Object getFieldValue(Field field, Product product) throws IllegalAccessException
      Throws:
      IllegalAccessException
    • getBusinessTypeService

      @NonNull protected BusinessTypeService<BusinessType> getBusinessTypeService()
    • setBusinessTypeService

      @Autowired @Lazy public void setBusinessTypeService(BusinessTypeService<BusinessType> businessTypeService)