Class DefaultTrashContentPageValidator
- java.lang.Object
-
- de.hybris.platform.cmsfacades.cmsitems.validator.DefaultTrashContentPageValidator
-
- All Implemented Interfaces:
Validator<ContentPageModel>
public class DefaultTrashContentPageValidator extends java.lang.Object implements 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 Constructor Description DefaultTrashContentPageValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddValidationError(java.lang.String field, java.lang.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 CatalogLevelServicegetCatalogLevelService()protected CMSAdminPageServicegetCmsAdminPageService()protected ValidationErrorsProvidergetValidationErrorsProvider()protected 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.
-
-
-
Method Detail
-
validate
public void validate(ContentPageModel validatee)
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
protected boolean isPageBeingTrashed(ContentPageModel contentPageModel)
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
protected boolean isPageUndeletable(ContentPageModel contentPageModel)
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
protected boolean isOrWasOnlyTopLevelHomepage(ContentPageModel contentPageModel)
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
protected boolean catalogDoesNotHaveFallbackHomepage(ContentPageModel contentPageModel)
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
protected void addValidationError(java.lang.String field, java.lang.String errorCode)This method pushes a new validation error.- Parameters:
field- The field affected by the error.errorCode- The code identifying the type of error.
-
getValidationErrorsProvider
protected ValidationErrorsProvider getValidationErrorsProvider()
-
setValidationErrorsProvider
public void setValidationErrorsProvider(ValidationErrorsProvider validationErrorsProvider)
-
getCmsAdminPageService
protected CMSAdminPageService getCmsAdminPageService()
-
setCmsAdminPageService
public void setCmsAdminPageService(CMSAdminPageService cmsAdminPageService)
-
getCatalogLevelService
protected CatalogLevelService getCatalogLevelService()
-
setCatalogLevelService
public void setCatalogLevelService(CatalogLevelService catalogLevelService)
-
-