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
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
prefixWithValidationMessageKey
(String errorCode) void
validateForCreate
(@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 onapplicationCatalog
that should specifically apply when creating and assigning a Catalog from an application context.void
validateForReplace
(@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 onreplacement
that should specifically apply when replacing one of anApplication
's catalog refs from an application context.protected void
validateImmutableFieldsForGlobalCatalogRefReplacement
(ApplicationCatalogRef original, ApplicationCatalogRef replacement, org.springframework.validation.Errors errors) When anApplicationCatalogRef
is 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 onapplicationCatalog
that should specifically apply when creating and assigning a Catalog from an application context.This should be invoked before any validations on
Catalog
orApplication
apply.- 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 toapplicationCatalog
on 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 onreplacement
that should specifically apply when replacing one of anApplication
's catalog refs from an application context.This should be invoked before any validations on
Catalog
orApplication
apply.- Parameters:
application
- the application for which anApplicationCatalogRef
is 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()
onoriginal
original
- theApplicationCatalogRef
that currently exists on theApplication
and is being replacedreplacement
- theApplicationCatalogRef
that will replaceoriginal
on the application. This is the object that should be validated.contextInfo
- context information surrounding sandboxing and multitenant stateerrors
- the errors object bound to thereplacement
on which errors can be registered- See Also:
-
validateImmutableFieldsForGlobalCatalogRefReplacement
protected void validateImmutableFieldsForGlobalCatalogRefReplacement(ApplicationCatalogRef original, ApplicationCatalogRef replacement, org.springframework.validation.Errors errors) When anApplicationCatalogRef
is for a catalog not created by the current application, certain fields are immutable from the application context.- Parameters:
original
- theApplicationCatalogRef
that currently exists on theApplication
and is being replacedreplacement
- theApplicationCatalogRef
that will replaceoriginal
on the applicationerrors
- the errors object bound to thereplacement
on which errors can be registered
-
prefixWithValidationMessageKey
-