Class CatalogValidator

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

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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    fetchAndValidateParentCatalogs(Catalog catalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.validation.Errors errors)
    Performs deeper validation on existence and vendor-associations of parent catalogs.
    Lazy injection to avoid circular dependency exceptions.
    void
    Lazy injection to avoid circular dependency exceptions.
    boolean
    supports(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    void
    validate(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    protected void
    validateForModification(Catalog requestedCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.validation.Errors errors)
     
    void
    validateForReplace(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    void
    validateForUpdate(Object updatedBusinessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
     
    protected void
    validateLocale(org.springframework.validation.Errors errors)
     
    protected void
    validateName(org.springframework.validation.Errors errors)
     
    protected void
    validateParents(Catalog catalog, org.springframework.validation.Errors errors)
    This just performs basic field validations on the requested parents.
    protected void
    validateType(Catalog catalog, org.springframework.validation.Errors errors)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.mapping.validation.EntityValidator

    validateForCreate
  • Constructor Details

    • CatalogValidator

      public CatalogValidator()
  • Method Details

    • 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
    • validateName

      protected void validateName(org.springframework.validation.Errors errors)
    • validateLocale

      protected void validateLocale(org.springframework.validation.Errors errors)
    • validateType

      protected void validateType(Catalog catalog, org.springframework.validation.Errors errors)
    • validateParents

      protected void validateParents(Catalog catalog, org.springframework.validation.Errors errors)
      This just performs basic field validations on the requested parents. For deeper validations, see fetchAndValidateParentCatalogs(Catalog, ContextInfo, Errors).
      Parameters:
      catalog - the catalog to validate
      errors - errors instance on which to register errors
    • fetchAndValidateParentCatalogs

      protected void fetchAndValidateParentCatalogs(Catalog catalog, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.validation.Errors errors)
      Performs deeper validation on existence and vendor-associations of parent catalogs. Should only be run after all other basic field validations pass, such as validateParents(Catalog, Errors).
      Parameters:
      catalog - the catalog whose parents should be validated
      contextInfo - context information around multitenant state
      errors - errors instance on which to register errors
    • validateForUpdate

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

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

      protected void validateForModification(Catalog requestedCatalog, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.validation.Errors errors)
    • getCatalogService

      protected CatalogService<Catalog> getCatalogService()
      Lazy injection to avoid circular dependency exceptions.
    • setCatalogService

      @Autowired @Lazy public void setCatalogService(CatalogService<Catalog> catalogService)
      Lazy injection to avoid circular dependency exceptions.