Class CategoryProductValidator

java.lang.Object
com.broadleafcommerce.catalog.service.validation.CategoryProductValidator
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator

public class CategoryProductValidator extends Object implements com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
Validations for CategoryProduct.
Author:
Samarth Dhruva (samarthd)
  • Constructor Details

    • CategoryProductValidator

      public CategoryProductValidator()
  • Method Details

    • setCategoryProductService

      @Autowired @Lazy public void setCategoryProductService(CategoryProductService<CategoryProduct> categoryProductService)
      Lazy injection since this validator is itself a service component. This avoids circular dependency exceptions
      Parameters:
      categoryProductService - the category product service
    • supports

      public boolean supports(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      supports in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
    • validate

      public void validate(@NonNull Object businessInstance, @NonNull org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      validate in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
    • validateForCreate

      public void validateForCreate(@NonNull @NonNull Object businessInstance, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Specified by:
      validateForCreate in interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator
    • validateCategory

      protected void validateCategory(org.springframework.validation.Errors errors)
    • validateProduct

      protected void validateProduct(org.springframework.validation.Errors errors)
    • validatePrimary

      protected void validatePrimary(CategoryProduct categoryProduct, org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • validateCategoryProductDoesNotExist

      protected void validateCategoryProductDoesNotExist(@NonNull @NonNull CategoryProduct businessInstance, @NonNull @NonNull org.springframework.validation.Errors errors, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    • getCategoryProductService

      @NonNull protected CategoryProductService<CategoryProduct> getCategoryProductService()