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 -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfetchAndValidateParentCatalogs(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.voidsetCatalogService(CatalogService<Catalog> catalogService) Lazy injection to avoid circular dependency exceptions.booleansupports(Class<?> serviceClass, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) voidvalidate(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected voidvalidateForModification(Catalog requestedCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, org.springframework.validation.Errors errors) voidvalidateForReplace(Object businessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) voidvalidateForUpdate(Object updatedBusinessInstance, org.springframework.validation.Errors errors, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) protected voidvalidateLocale(org.springframework.validation.Errors errors) protected voidvalidateName(org.springframework.validation.Errors errors) protected voidvalidateParents(Catalog catalog, org.springframework.validation.Errors errors) This just performs basic field validations on the requested parents.protected voidvalidateType(Catalog catalog, org.springframework.validation.Errors errors) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
supportsin 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:
validatein 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:
validateForUpdatein 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:
validateForReplacein 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.
-