Class DefaultTrashContentPageValidator

java.lang.Object
de.hybris.platform.cmsfacades.cmsitems.validator.DefaultTrashContentPageValidator
All Implemented Interfaces:
Validator<ContentPageModel>

public class DefaultTrashContentPageValidator extends 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 Details

    • DefaultTrashContentPageValidator

      public DefaultTrashContentPageValidator()
  • Method Details

    • validate

      public void validate(ContentPageModel validatee)
      Description copied from interface: Validator
      Method to perform validation on a given object.
      Specified by:
      validate in interface Validator<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(String field, 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)