Class DefaultCMSContentPageService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
-
- de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSPageService
-
- de.hybris.platform.cms2.servicelayer.services.impl.DefaultCMSContentPageService
-
- All Implemented Interfaces:
CMSContentPageService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultCMSContentPageService extends AbstractCMSPageService implements CMSContentPageService
Default implementation of theCMSContentPageService- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringSLASH-
Fields inherited from class de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
CURRENTCATALOGVERSION, CURRENTSITE
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultCMSContentPageService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.java.util.List<java.lang.String>findLabelVariations(java.lang.String label, boolean exactLabelMatch)Find possible variations of the provided label by splitting the sections using the slash as delimiter.java.util.List<AbstractPageModel>findPagesForBestLabelMatch(java.util.Collection<AbstractPageModel> pages, java.util.List<java.lang.String> labels)Finds all pages that matches one of the provided labels.protected java.util.Comparator<AbstractPageModel>getCmsItemCatalogLevelComparator()ContentPageModelgetDefaultPageForLabel(java.lang.String label, CatalogVersionModel version)Gets the default page by label and catalog version.ContentPageModelgetHomepage()Gets the homepageContentPageModelgetHomepage(PagePreviewCriteriaData pagePreviewCriteria)Returns homepage forPagePreviewCriteriaData.protected ContentPageModelgetHomepageInternal()Gets the homepage by finding all content pages havingContentPageModel#isHomepage()equals TRUE, in all the catalog versions saved in the session.protected ContentPageModelgetPageForLabel(java.lang.String label, java.util.List<CmsPageStatus> pageStatuses, boolean exactLabelMatch)Gets the page for label by page status and label match type.ContentPageModelgetPageForLabelAndPreview(java.lang.String label, PagePreviewCriteriaData pagePreviewCriteria)Gets the page for label andPagePreviewCriteriaData.ContentPageModelgetPageForLabelAndStatuses(java.lang.String label, java.util.List<CmsPageStatus> pageStatuses)Gets the page for label by page status.ContentPageModelgetPageForLabelOrIdAndMatchType(java.lang.String labelOrId, boolean exactLabelMatch)Gets the page for label or id.ContentPageModelgetPageForLabelOrIdAndMatchType(java.lang.String labelOrId, PagePreviewCriteriaData pagePreviewCriteria, boolean exactLabelMatch)Gets the page matching the provided for label or id filtered by thePagePreviewCriteriaDatainformation.protected java.util.Collection<CatalogVersionModel>getSessionContentCatalogVersions()Finds all catalog versions related to a content catalog that are saved in the session.voidsetCmsItemCatalogLevelComparator(java.util.Comparator<AbstractPageModel> cmsItemCatalogLevelComparator)-
Methods inherited from class de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSPageService
getCatalogVersionService, getCmsPageDao, getCmsRestrictionService, getCmsVersionDao, getCmsVersionService, getCmsVersionSessionContextProvider, getItemByCriteria, getPageForId, getPageForVersionUid, getSessionSearchRestrictionsDisabler, setCatalogVersionService, setCmsPageDao, setCmsRestrictionService, setCmsVersionDao, setCmsVersionService, setCmsVersionSessionContextProvider, setSessionSearchRestrictionsDisabler
-
Methods inherited from class de.hybris.platform.cms2.servicelayer.services.impl.AbstractCMSService
getBaseSiteService, getCurrentCatalogVersion, getCurrentSite, getSearchRestrictionService, getUserService, setBaseSiteService, setSearchRestrictionService, setUserService
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Field Detail
-
SLASH
protected static final java.lang.String SLASH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefaultPageForLabel
public ContentPageModel getDefaultPageForLabel(java.lang.String label, CatalogVersionModel version) throws CMSItemNotFoundException
Description copied from interface:CMSContentPageServiceGets the default page by label and catalog version.- Specified by:
getDefaultPageForLabelin interfaceCMSContentPageService- Parameters:
label- the labelversion- the version- Returns:
- the default page by label
- Throws:
CMSItemNotFoundException- thrown when item was not found
-
getHomepage
public ContentPageModel getHomepage()
Description copied from interface:CMSContentPageServiceGets the homepage- Specified by:
getHomepagein interfaceCMSContentPageService- Returns:
- the homepage model
-
getHomepageInternal
protected ContentPageModel getHomepageInternal()
Gets the homepage by finding all content pages havingContentPageModel#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
-
getHomepage
public ContentPageModel getHomepage(PagePreviewCriteriaData pagePreviewCriteria)
Description copied from interface:CMSContentPageServiceReturns homepage forPagePreviewCriteriaData.- Specified by:
getHomepagein interfaceCMSContentPageService- Parameters:
pagePreviewCriteria- thePagePreviewCriteriaDataobject.- Returns:
- the homepage model
-
getPageForLabelAndPreview
public ContentPageModel getPageForLabelAndPreview(java.lang.String label, PagePreviewCriteriaData pagePreviewCriteria) throws CMSItemNotFoundException
Description copied from interface:CMSContentPageServiceGets the page for label andPagePreviewCriteriaData.- Specified by:
getPageForLabelAndPreviewin interfaceCMSContentPageService- Parameters:
label- the labelpagePreviewCriteria- thePagePreviewCriteriaDataobject.- Returns:
- the page for label
- Throws:
CMSItemNotFoundException- thrown when item is not found
-
getPageForLabelAndStatuses
public ContentPageModel getPageForLabelAndStatuses(java.lang.String label, java.util.List<CmsPageStatus> pageStatuses) throws CMSItemNotFoundException
Description copied from interface:CMSContentPageServiceGets the page for label by page status.- Specified by:
getPageForLabelAndStatusesin interfaceCMSContentPageService- Parameters:
label- the labelpageStatuses- the page statuses. i.e. (deleted, active)- Returns:
- the page for label
- Throws:
CMSItemNotFoundException- thrown when item was not found
-
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. WhenexactLabelMatchisTRUE, the page is found by matching exactly the providedlabelOrId. Otherwise, the page containing a label that closely matches the providedlabelOrIdis returned instead.- Parameters:
label- the labelpageStatuses- 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
-
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
-
findPagesForBestLabelMatch
public java.util.List<AbstractPageModel> findPagesForBestLabelMatch(java.util.Collection<AbstractPageModel> pages, java.util.List<java.lang.String> labels)
Description copied from interface:CMSContentPageServiceFinds 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:
findPagesForBestLabelMatchin interfaceCMSContentPageService- Parameters:
pages- the list of pages to filter to find best matcheslabels- 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:CMSContentPageServiceFind 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:
findLabelVariationsin interfaceCMSContentPageService- Parameters:
label- the label from which the variations are generatedexactLabelMatch- 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 generatedlabels- 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:CMSContentPageServiceGets the page for label or id. WhenexactLabelMatchisTRUE, the page is found by matching exactly the providedlabelOrId. Otherwise, the page containing a label that closely matches the providedlabelOrIdis returned instead.- Specified by:
getPageForLabelOrIdAndMatchTypein interfaceCMSContentPageService- Parameters:
labelOrId- the label or idexactLabelMatch- 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:CMSContentPageServiceGets the page matching the provided for label or id filtered by thePagePreviewCriteriaDatainformation. WhenexactLabelMatchisTRUE, the page is found by matching exactly the providedlabelOrId. Otherwise, the page containing a label that closely matches the providedlabelOrIdis returned instead.- Specified by:
getPageForLabelOrIdAndMatchTypein interfaceCMSContentPageService- Parameters:
labelOrId- the label or idpagePreviewCriteria- thePagePreviewCriteriaDataobject.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
-
getCmsItemCatalogLevelComparator
protected java.util.Comparator<AbstractPageModel> getCmsItemCatalogLevelComparator()
-
setCmsItemCatalogLevelComparator
public void setCmsItemCatalogLevelComparator(java.util.Comparator<AbstractPageModel> cmsItemCatalogLevelComparator)
-
-