Class DefaultCMSContentPageService

    • Constructor Detail

      • DefaultCMSContentPageService

        public DefaultCMSContentPageService()
    • Method Detail

      • getHomepageInternal

        protected ContentPageModel getHomepageInternal()
        Gets the homepage by finding all content pages having ContentPageModel#isHomepage() equals TRUE, in all the catalog versions saved in the session.
        In the multi-country scenario, the list of catalog versions contains the catalog versions hierarchy for the active site.

        CMS restrictions will be evaluated on the homepage to ensure that the proper primary or variation page is returned.

        Returns:
        the homepage model
      • getPageForLabel

        protected ContentPageModel getPageForLabel​(java.lang.String label,
                                                   java.util.List<CmsPageStatus> pageStatuses,
                                                   boolean exactLabelMatch)
                                            throws CMSItemNotFoundException
        Gets the page for label by page status and label match type. When exactLabelMatch is TRUE, the page is found by matching exactly the provided labelOrId. Otherwise, the page containing a label that closely matches the provided labelOrId is returned instead.
        Parameters:
        label - the label
        pageStatuses - the page statuses. i.e. (deleted, active)
        exactLabelMatch - determines if the label of the result page should exactly match the provided labelOrId or not.
        Returns:
        the page for label
        Throws:
        CMSItemNotFoundException - thrown when item was not found
      • getSingleContentPage

        protected ContentPageModel getSingleContentPage​(java.util.List<java.lang.String> labels)
      • getSessionContentCatalogVersions

        protected java.util.Collection<CatalogVersionModel> getSessionContentCatalogVersions()
        Finds all catalog versions related to a content catalog that are saved in the session.
        Returns:
        a list of catalog versions related to a content catalog
      • getContentCatalogVersions

        protected java.util.Collection<CatalogVersionModel> getContentCatalogVersions()
        Finds all content catalog versions. If there is a preview content catalog version, it should return the intersection of preview Hierarchy and session.
        Returns:
        a list of catalog versions related to a content catalog
      • getContentCatalogVersionsOfHomepage

        protected java.util.Collection<CatalogVersionModel> getContentCatalogVersionsOfHomepage()
        For multiple content catalog, when content catalogVersions are not relatives, that's mean this request is come from storefront and may have multiple homepage in those content catalogs. If it set the default content catalog, it should use homepage of the default content catalog as the site homepage.
        Returns:
        a list of catalog versions
      • findPagesForBestLabelMatch

        public java.util.List<AbstractPageModel> findPagesForBestLabelMatch​(java.util.Collection<AbstractPageModel> pages,
                                                                            java.util.List<java.lang.String> labels)
        Description copied from interface: CMSContentPageService
        Finds all pages that matches one of the provided labels. Best page match is chosen by sorting the pages by their label (longest label first). When multiple pages have the same label size, then the first created page is chosen.
        Specified by:
        findPagesForBestLabelMatch in interface CMSContentPageService
        Parameters:
        pages - the list of pages to filter to find best matches
        labels - the list of labels used for filtering for best page matches
        Returns:
        pages exactly or best match the provided labels
      • findLabelVariations

        public java.util.List<java.lang.String> findLabelVariations​(java.lang.String label,
                                                                    boolean exactLabelMatch)
        Description copied from interface: CMSContentPageService
        Find possible variations of the provided label by splitting the sections using the slash as delimiter. The result list is sorted by the length of the label, starting with the longest label variation first. The result list also includes the provided label.
        Specified by:
        findLabelVariations in interface CMSContentPageService
        Parameters:
        label - the label from which the variations are generated
        exactLabelMatch - determines if the label of the result page should exactly match the provided label or not.
        Returns:
        list of label variations, including the provided label
      • findBestMatchLabelVariations

        protected java.util.List<java.lang.String> findBestMatchLabelVariations​(java.lang.String label,
                                                                                java.util.List<java.lang.String> labels)
        Find possible variations of the provided label by splitting the sections using the slash as delimiter. The result list is sorted by the length of the label, starting with the longest label variation first. The result list also includes the provided label.
        Parameters:
        label - the label from which the variations are generated
        labels - the list of label variations
        Returns:
        list of label variations, including the provided label
      • getPageForLabelOrIdAndMatchType

        public ContentPageModel getPageForLabelOrIdAndMatchType​(java.lang.String labelOrId,
                                                                boolean exactLabelMatch)
                                                         throws CMSItemNotFoundException
        Description copied from interface: CMSContentPageService
        Gets the page for label or id. When exactLabelMatch is TRUE, the page is found by matching exactly the provided labelOrId. Otherwise, the page containing a label that closely matches the provided labelOrId is returned instead.
        Specified by:
        getPageForLabelOrIdAndMatchType in interface CMSContentPageService
        Parameters:
        labelOrId - the label or id
        exactLabelMatch - determines if the label of the result page should exactly match the provided labelOrId or not.
        Returns:
        the page for label or id
        Throws:
        CMSItemNotFoundException - thrown when page was not found
      • getPageForLabelOrIdAndMatchType

        public ContentPageModel getPageForLabelOrIdAndMatchType​(java.lang.String labelOrId,
                                                                PagePreviewCriteriaData pagePreviewCriteria,
                                                                boolean exactLabelMatch)
                                                         throws CMSItemNotFoundException
        Description copied from interface: CMSContentPageService
        Gets the page matching the provided for label or id filtered by the PagePreviewCriteriaData information. When exactLabelMatch is TRUE, the page is found by matching exactly the provided labelOrId. Otherwise, the page containing a label that closely matches the provided labelOrId is returned instead.
        Specified by:
        getPageForLabelOrIdAndMatchType in interface CMSContentPageService
        Parameters:
        labelOrId - the label or id
        pagePreviewCriteria - the PagePreviewCriteriaData object.
        exactLabelMatch - determines if the label of the result page should exactly match the provided labelOrId or not.
        Returns:
        the page matching the search criteria
        Throws:
        CMSItemNotFoundException - thrown when no page is found
      • setCmsSiteService

        public void setCmsSiteService​(CMSSiteService cmsSiteService)
      • setCmsCatalogVersionService

        public void setCmsCatalogVersionService​(CMSCatalogVersionService cmsCatalogVersionService)
      • setCmsPreviewService

        public void setCmsPreviewService​(CMSPreviewService cmsPreviewService)