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
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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.protected CatalogService<Catalog>
Lazy injection to avoid circular dependency exceptions.void
setCatalogService
(CatalogService<Catalog> catalogService) 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 interfacecom.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 interfacecom.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
-
validateParents
This just performs basic field validations on the requested parents. For deeper validations, seefetchAndValidateParentCatalogs(Catalog, ContextInfo, Errors)
.- Parameters:
catalog
- the catalog to validateerrors
- 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 asvalidateParents(Catalog, Errors)
.- Parameters:
catalog
- the catalog whose parents should be validatedcontextInfo
- context information around multitenant stateerrors
- 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 interfacecom.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 interfacecom.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
Lazy injection to avoid circular dependency exceptions. -
setCatalogService
Lazy injection to avoid circular dependency exceptions.
-