Class ApplicationCatalogValidator
java.lang.Object
com.broadleafcommerce.tenant.service.validation.ApplicationCatalogValidator
A validator specifically intended for use in the
ApplicationCatalogService. It
intentionally does not implement EntityValidator, as it does not apply in the normal CRUD
flow.
Its purpose is to perform any validation that specifically applies to CRUD operations on
ApplicationCatalogRef from an application context.
- Author:
- Samarth Dhruva (samarthd)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringprefixWithValidationMessageKey(String errorCode) voidvalidateForCreate(@NonNull Application application, @NonNull ApplicationCatalog applicationCatalog, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @NonNull org.springframework.validation.Errors errors) This method is intended to perform any validation onapplicationCatalogthat should specifically apply when creating and assigning a Catalog from an application context.voidvalidateForReplace(@NonNull Application application, @NonNull Catalog referencedCatalog, @NonNull ApplicationCatalogRef original, @NonNull ApplicationCatalogRef replacement, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @NonNull org.springframework.validation.Errors errors) This method is intended to perform any validation onreplacementthat should specifically apply when replacing one of anApplication's catalog refs from an application context.protected voidvalidateImmutableFieldsForGlobalCatalogRefReplacement(ApplicationCatalogRef original, ApplicationCatalogRef replacement, org.springframework.validation.Errors errors) When anApplicationCatalogRefis for a catalog not created by the current application, certain fields are immutable from the application context.
-
Constructor Details
-
ApplicationCatalogValidator
public ApplicationCatalogValidator()
-
-
Method Details
-
validateForCreate
public void validateForCreate(@NonNull @NonNull Application application, @NonNull @NonNull ApplicationCatalog applicationCatalog, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @NonNull @NonNull org.springframework.validation.Errors errors) This method is intended to perform any validation onapplicationCatalogthat should specifically apply when creating and assigning a Catalog from an application context.This should be invoked before any validations on
CatalogorApplicationapply.- Parameters:
application- the application for which a catalog is being createdapplicationCatalog- the application catalog to validatecontextInfo- context information surrounding sandboxing and multitenant stateerrors- the errors object bound toapplicationCatalogon which errors can be registered- See Also:
-
validateForReplace
public void validateForReplace(@NonNull @NonNull Application application, @NonNull @NonNull Catalog referencedCatalog, @NonNull @NonNull ApplicationCatalogRef original, @NonNull @NonNull ApplicationCatalogRef replacement, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo, @NonNull @NonNull org.springframework.validation.Errors errors) This method is intended to perform any validation onreplacementthat should specifically apply when replacing one of anApplication's catalog refs from an application context.This should be invoked before any validations on
CatalogorApplicationapply.- Parameters:
application- the application for which anApplicationCatalogRefis being replaced. This should be the fully-hydrated value from the data store.referencedCatalog- the fully-hydrated catalog corresponding to the id referenced byApplicationCatalogRef.getId()onoriginaloriginal- theApplicationCatalogRefthat currently exists on theApplicationand is being replacedreplacement- theApplicationCatalogRefthat will replaceoriginalon the application. This is the object that should be validated.contextInfo- context information surrounding sandboxing and multitenant stateerrors- the errors object bound to thereplacementon which errors can be registered- See Also:
-
validateImmutableFieldsForGlobalCatalogRefReplacement
protected void validateImmutableFieldsForGlobalCatalogRefReplacement(ApplicationCatalogRef original, ApplicationCatalogRef replacement, org.springframework.validation.Errors errors) When anApplicationCatalogRefis for a catalog not created by the current application, certain fields are immutable from the application context.- Parameters:
original- theApplicationCatalogRefthat currently exists on theApplicationand is being replacedreplacement- theApplicationCatalogRefthat will replaceoriginalon the applicationerrors- the errors object bound to thereplacementon which errors can be registered
-
prefixWithValidationMessageKey
-