Class DefaultCMSAdminPageService

  • All Implemented Interfaces:
    CMSAdminPageService, java.io.Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean

    public class DefaultCMSAdminPageService
    extends AbstractCMSAdminService
    implements CMSAdminPageService
    Default implementation of the page service.
    See Also:
    Serialized Form
    • Constructor Detail

      • DefaultCMSAdminPageService

        public DefaultCMSAdminPageService()
    • Method Detail

      • createCategoryPage

        public CategoryPageModel createCategoryPage​(java.lang.String id,
                                                    java.lang.String name,
                                                    java.lang.String masterTemplateId,
                                                    boolean isDefault)
                                             throws CMSItemCreateException
        Creates the category page.
        Specified by:
        createCategoryPage in interface CMSAdminPageService
        Parameters:
        id - the id
        name - the name
        masterTemplateId - the master template id
        isDefault - the is default
        Returns:
        the category page model
        Throws:
        CMSItemCreateException - the cMS item create exception
      • createContentPage

        public ContentPageModel createContentPage​(java.lang.String id,
                                                  java.lang.String name,
                                                  java.lang.String masterTemplateId,
                                                  java.lang.String label)
                                           throws CMSItemCreateException
        Creates the content page.
        Specified by:
        createContentPage in interface CMSAdminPageService
        Parameters:
        id - the id
        name - the name
        masterTemplateId - the master template id
        label - the label
        Returns:
        the content page model
        Throws:
        CMSItemCreateException - the cMS item create exception
      • createPage

        public AbstractPageModel createPage​(java.lang.String composedType,
                                            java.lang.String id,
                                            java.lang.String name,
                                            java.lang.String masterTemplateId)
                                     throws CMSItemCreateException
        Creates the page.
        Specified by:
        createPage in interface CMSAdminPageService
        Parameters:
        composedType - the composed type
        id - the id
        name - the name
        masterTemplateId - the master template id
        Returns:
        the abstract page model
        Throws:
        CMSItemCreateException - the cMS item create exception
      • createProductPage

        public ProductPageModel createProductPage​(java.lang.String id,
                                                  java.lang.String name,
                                                  java.lang.String masterTemplateId,
                                                  boolean isDefault)
                                           throws CMSItemCreateException
        Creates the product page.
        Specified by:
        createProductPage in interface CMSAdminPageService
        Parameters:
        id - the id
        name - the name
        masterTemplateId - the master template id
        isDefault - the is default
        Returns:
        the product page model
        Throws:
        CMSItemCreateException - the cMS item create exception
      • getAllContentPagesForPageStatuses

        public java.util.Collection<ContentPageModel> getAllContentPagesForPageStatuses​(java.util.Collection<CatalogVersionModel> catalogVersions,
                                                                                        java.util.List<CmsPageStatus> pageStatuses)
        Gets the all content pages for a given list of page status.

        Pages will be sorted in reversed order of the multicountry hierarchy. Pages defined in the lowest catalog (e.g. local catalog) level will be the first ones in the result list. Therefore, pages defined in the top level catalog (e.g. global catalog) will be last in the result list.

        Specified by:
        getAllContentPagesForPageStatuses in interface CMSAdminPageService
        Parameters:
        catalogVersions - the catalog versions
        pageStatuses - a list of page status
        Returns:
        the all content pages
      • getPageTypeByCode

        public java.util.Optional<CMSPageTypeModel> getPageTypeByCode​(java.lang.String typeCode)
        Description copied from interface: CMSAdminPageService
        Returns the page type with the given type code.
        Specified by:
        getPageTypeByCode in interface CMSAdminPageService
        Parameters:
        typeCode - the type code of the page type to retrieve
        Returns:
        the page type matching the given type code
      • getAllPages

        public java.util.Collection<AbstractPageModel> getAllPages()
        Returns all pages which are assigned to the active catalog version
        Specified by:
        getAllPages in interface CMSAdminPageService
        Returns:
        all pages which are assigned to the active catalog version
      • getAllPagesForCatalogVersionAndPageStatuses

        public java.util.Collection<AbstractPageModel> getAllPagesForCatalogVersionAndPageStatuses​(CatalogVersionModel catalogVersion,
                                                                                                   java.util.List<CmsPageStatus> pageStatuses)
        Returns all pages which are assigned to the given catalog version and given page statuses
        Specified by:
        getAllPagesForCatalogVersionAndPageStatuses in interface CMSAdminPageService
        Parameters:
        catalogVersion - the catalog version model
        pageStatuses - a list of page statuses
        Returns:
        all pages which are assigned to the given catalog version with the given page status
      • getAllPagesByType

        public java.util.Collection<AbstractPageModel> getAllPagesByType​(java.lang.String type)
        Returns all pages which are assigned to the active catalog version and are of the given type
        Specified by:
        getAllPagesByType in interface CMSAdminPageService
        Parameters:
        type - should be a sub-type of AbstractPage
        Returns:
        all pages which are assigned to the active catalog version and are of the given type
      • getAllPagesMap

        public java.util.Map<java.lang.String,​java.util.Collection<AbstractPageModel>> getAllPagesMap()
        returns all pages of the active catalogVersion. The pages are grouped by its type
        Specified by:
        getAllPagesMap in interface CMSAdminPageService
        Returns:
        returns all pages of the active catalogVersion. The pages are grouped by its type
      • getAllPageTemplates

        public java.util.Collection<PageTemplateModel> getAllPageTemplates​(boolean active)
        returns all page templates (only of the active catalogVersion)
        Specified by:
        getAllPageTemplates in interface CMSAdminPageService
        Parameters:
        active - if set to true only page templates are returned which are set as active
        Returns:
        all page templates
      • getAllRestrictedPageTemplates

        public java.util.Collection<PageTemplateModel> getAllRestrictedPageTemplates​(boolean active,
                                                                                     CMSPageTypeModel type)
        returns all restricted page templates (only of the active catalogVersion)
        Specified by:
        getAllRestrictedPageTemplates in interface CMSAdminPageService
        Parameters:
        active - if set to true only page templates are returned which are set as active
        type - the page type to which the page template will be restricted
        Returns:
        all restricted page templates
      • getContentPages

        public java.util.Collection<ContentPageModel> getContentPages​(java.util.Collection<CatalogVersionModel> catalogVersions,
                                                                      java.lang.String label)
        Gets the content pages.
        Specified by:
        getContentPages in interface CMSAdminPageService
        Parameters:
        catalogVersions - the catalog versions
        label - the label
        Returns:
        the content pages
      • getPageForId

        protected AbstractPageModel getPageForId​(java.lang.String uid,
                                                 java.util.Collection<CatalogVersionModel> catalogVersions,
                                                 java.util.List<CmsPageStatus> pageStatuses)
        Returns the active page with the given id, catalog versions and page statuses.
        Parameters:
        uid - the id of the page
        catalogVersions - the catalog versions
        pageStatuses - the page statuses
        Returns:
        the page
      • pageExists

        public boolean pageExists​(java.lang.String id)
        Checks if a page exists in the active catalog version
        Specified by:
        pageExists in interface CMSAdminPageService
        Parameters:
        id - page id
        Returns:
        true if the page exists in the active catalog version; false otherwise
      • updatePage

        public void updatePage​(AbstractPageModel page,
                               java.lang.String name,
                               java.lang.String masterTemplateId)
                        throws CMSItemNotFoundException
        Updates the given page. Method explicitly saves object.
        Specified by:
        updatePage in interface CMSAdminPageService
        Parameters:
        page - the page model
        name - the new page name to be applied to the given page model
        masterTemplateId - the new page template to be applied to the given page model
        Throws:
        CMSItemNotFoundException - when an item model is not found
      • getHomepage

        public ContentPageModel getHomepage​(CMSSiteModel siteModel)
        Gets the homepage for a given CMS Site.

        This performs the search only in the active versions of the catalogs associated to the site.

        Specified by:
        getHomepage in interface CMSAdminPageService
        Parameters:
        siteModel - the site model
        Returns:
        the homepage model
      • getHomepage

        public ContentPageModel getHomepage​(java.util.List<CatalogVersionModel> catalogVersions)
        Gets the homepage for the given catalog versions.

        Pages will be sorted in reversed order of the multicountry hierarchy. Pages defined in the lowest catalog (e.g. local catalog) level will be the first ones in the result list. Therefore, pages defined in the top level catalog (e.g. global catalog) will be last in the result list.

        Specified by:
        getHomepage in interface CMSAdminPageService
        Parameters:
        catalogVersions - the catalog versions
        Returns:
        the homepage model from one of the catalog versions provided; can be NULL if no homepage is found or the given list of catalog version is empty.
      • findPagesByType

        public java.util.Collection<AbstractPageModel> findPagesByType​(ComposedTypeModel composedType,
                                                                       boolean isDefault)
        Description copied from interface: CMSAdminPageService
        Gets the all default or non-default active pages by page type from the active catalog version.
        Specified by:
        findPagesByType in interface CMSAdminPageService
        Parameters:
        composedType - the page type model
        isDefault - true to find default pages; false otherwise
        Returns:
        the all default or non-default pages for a given page type
      • findPagesByTypeAndPageStatuses

        public java.util.Collection<AbstractPageModel> findPagesByTypeAndPageStatuses​(ComposedTypeModel composedType,
                                                                                      boolean isDefault,
                                                                                      java.util.List<CmsPageStatus> pageStatuses)
        Description copied from interface: CMSAdminPageService
        Gets the all default or non-default pages by page type from the active catalog version.
        Specified by:
        findPagesByTypeAndPageStatuses in interface CMSAdminPageService
        Parameters:
        composedType - the page type model
        isDefault - true to find default pages; false otherwise
        pageStatuses - a list of page statuses
        Returns:
        the all default or non-default pages for a given page type
      • getCmsPageDao

        protected CMSPageDao getCmsPageDao()
      • setCmsPageDao

        public void setCmsPageDao​(CMSPageDao cmsPageDao)
      • setCmsPageTemplateDao

        public void setCmsPageTemplateDao​(CMSPageTemplateDao cmsPageTemplateDao)
      • getTypeService

        protected TypeService getTypeService()
      • setTypeService

        public void setTypeService​(TypeService typeService)
      • setCatalogVersionService

        public void setCatalogVersionService​(CatalogVersionService catalogVersionService)
      • getCmsItemCatalogLevelComparator

        protected java.util.Comparator<CMSItemModel> getCmsItemCatalogLevelComparator()
      • setCmsItemCatalogLevelComparator

        public void setCmsItemCatalogLevelComparator​(java.util.Comparator<CMSItemModel> cmsItemCatalogLevelComparator)
      • setCmsCatalogVersionService

        public void setCmsCatalogVersionService​(CMSCatalogVersionService cmsCatalogVersionService)
      • setPermissionCRUDService

        public void setPermissionCRUDService​(PermissionCRUDService permissionCRUDService)