Class DefaultTrashContentPageValidator
java.lang.Object
de.hybris.platform.cmsfacades.cmsitems.validator.DefaultTrashContentPageValidator
- All Implemented Interfaces:
Validator<ContentPageModel>
Validator to ensure that a content page can be moved to trash. These are the scenarios that it checks:
- It's possible to delete a homepage of a non-top level catalog.
- It shouldn't be possible to delete a homepage in a top level catalog.
- It should be possible to swap a homepage, even in a top level catalog.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddValidationError(String field, String errorCode) This method pushes a new validation error.protected booleancatalogDoesNotHaveFallbackHomepage(ContentPageModel contentPageModel) This method checks if the current catalog does not have a fallback page.protected CatalogLevelServiceprotected CMSAdminPageServiceprotected ValidationErrorsProviderprotected booleanisOrWasOnlyTopLevelHomepage(ContentPageModel contentPageModel) This method checks if the provided page is the top level homepage.protected booleanisPageBeingTrashed(ContentPageModel contentPageModel) This method checks if the provided page is being moved to the trash list.protected booleanisPageUndeletable(ContentPageModel contentPageModel) This method checks if the provided page can be removed.voidsetCatalogLevelService(CatalogLevelService catalogLevelService) voidsetCmsAdminPageService(CMSAdminPageService cmsAdminPageService) voidsetValidationErrorsProvider(ValidationErrorsProvider validationErrorsProvider) voidvalidate(ContentPageModel validatee) Method to perform validation on a given object.
-
Constructor Details
-
DefaultTrashContentPageValidator
public DefaultTrashContentPageValidator()
-
-
Method Details
-
validate
Description copied from interface:ValidatorMethod to perform validation on a given object.- Specified by:
validatein interfaceValidator<ContentPageModel>- Parameters:
validatee- the inpected object being validated.
-
isPageBeingTrashed
This method checks if the provided page is being moved to the trash list.- Parameters:
contentPageModel- The page to check.- Returns:
- true, if the page is being moved to the trash list. False, otherwise.
-
isPageUndeletable
This method checks if the provided page can be removed. A page cannot be removed if it's a default page and is the top level homepage.- Parameters:
contentPageModel- The page to be checked.- Returns:
- true, if the page cannot be removed. False, otherwise.
-
isOrWasOnlyTopLevelHomepage
This method checks if the provided page is the top level homepage.- Parameters:
contentPageModel- The page to be checked- Returns:
- true, if the page is the top level homepage. False, otherwise.
-
catalogDoesNotHaveFallbackHomepage
This method checks if the current catalog does not have a fallback page. This is the case if the catalog is a top-level catalog and it does not have a homepage or the current homepage is the page that is being removed.- Parameters:
contentPageModel- The page that is being removed.- Returns:
- true if the catalog does not have a fallback page, false otherwise.
-
addValidationError
This method pushes a new validation error.- Parameters:
field- The field affected by the error.errorCode- The code identifying the type of error.
-
getValidationErrorsProvider
-
setValidationErrorsProvider
-
getCmsAdminPageService
-
setCmsAdminPageService
-
getCatalogLevelService
-
setCatalogLevelService
-