Class DefaultCMSAdminPageService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.cms2.servicelayer.services.admin.impl.AbstractCMSAdminService
-
- de.hybris.platform.cms2.servicelayer.services.admin.impl.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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.cms2.servicelayer.services.admin.impl.AbstractCMSAdminService
ACTIVECATALOGVERSION, ACTIVESITE, CLONE_CONTEXT, ORIGINAL_ITEM_CONTEXT, RESTORE_CONTEXT, TYPE_CONTEXT
-
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 DefaultCMSAdminPageService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CategoryPageModelcreateCategoryPage(java.lang.String id, java.lang.String name, java.lang.String masterTemplateId, boolean isDefault)Creates the category page.ContentPageModelcreateContentPage(java.lang.String id, java.lang.String name, java.lang.String masterTemplateId, java.lang.String label)Creates the content page.AbstractPageModelcreatePage(java.lang.String composedType, java.lang.String id, java.lang.String name, java.lang.String masterTemplateId)Creates the page.protected AbstractPageModelcreatePageFromType(java.lang.String composedTypeCode)ProductPageModelcreateProductPage(java.lang.String id, java.lang.String name, java.lang.String masterTemplateId, boolean isDefault)Creates the product page.voiddeletePage(java.lang.String id)Delete a page from the active catalog versionjava.util.Collection<AbstractPageModel>findPagesByType(ComposedTypeModel composedType, boolean isDefault)Gets the all default or non-default active pages by page type from the active catalog version.java.util.Collection<AbstractPageModel>findPagesByTypeAndPageStatuses(ComposedTypeModel composedType, boolean isDefault, java.util.List<CmsPageStatus> pageStatuses)Gets the all default or non-default pages by page type from the active catalog version.java.util.Collection<PageTemplateModel>getAllActivePageTemplates()returns all page templates which are set to active (only of the active catalogVersion)java.util.Collection<ContentPageModel>getAllContentPages(java.util.Collection<CatalogVersionModel> catalogVersions)Gets the all active content pages.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.java.util.Collection<AbstractPageModel>getAllPages()Returns all pages which are assigned to the active catalog versionjava.util.Collection<AbstractPageModel>getAllPages(CatalogVersionModel catalogVersion)Gets the all active pages.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 typejava.util.Collection<AbstractPageModel>getAllPagesByType(java.lang.String type, CatalogVersionModel catalogVersion)Gets the all pages by type.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 statusesjava.util.Map<java.lang.String,java.util.Collection<AbstractPageModel>>getAllPagesMap()returns all pages of the active catalogVersion.java.util.Collection<PageTemplateModel>getAllPageTemplates(boolean active)returns all page templates (only of the active catalogVersion)java.util.Collection<PageTemplateModel>getAllPageTemplates(java.util.Collection<CatalogVersionModel> catalogVersions)Gets the all page templates.java.util.Collection<CMSPageTypeModel>getAllPageTypes()Returns a collection of all available page types.java.util.Collection<PageTemplateModel>getAllRestrictedPageTemplates(boolean active, CMSPageTypeModel type)returns all restricted page templates (only of the active catalogVersion)protected CatalogVersionServicegetCatalogVersionService()protected CMSCatalogVersionServicegetCmsCatalogVersionService()protected java.util.Comparator<CMSItemModel>getCmsItemCatalogLevelComparator()protected CMSPageDaogetCmsPageDao()protected CMSPageTemplateDaogetCmsPageTemplateDao()java.util.Collection<ContentPageModel>getContentPages(java.util.Collection<CatalogVersionModel> catalogVersions, java.lang.String label)Gets the content pages.ContentPageModelgetHomepage(CatalogVersionModel catalogVersion)Gets the homepage for a given catalog versionContentPageModelgetHomepage(CMSSiteModel siteModel)Gets the homepage for a given CMS Site.ContentPageModelgetHomepage(java.util.List<CatalogVersionModel> catalogVersions)Gets the homepage for the given catalog versions.AbstractPageModelgetIdenticalPrimaryPageModel(AbstractPageModel pageModel)Returns identical primary page for provided pageModel.AbstractPageModelgetPageForId(java.lang.String id, java.util.Collection<CatalogVersionModel> catalogVersions)Returns the active page with the given id and the catalog versions.protected AbstractPageModelgetPageForId(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.AbstractPageModelgetPageForIdFromActiveCatalogVersion(java.lang.String id)Returns the active page with the given id from the active catalogVersion.AbstractPageModelgetPageForIdFromActiveCatalogVersionByPageStatuses(java.lang.String id, java.util.List<CmsPageStatus> pageStatuses)Returns the page with the given id and page status list from the active catalogVersion.PageTemplateModelgetPageTemplateForIdFromActiveCatalogVersion(java.lang.String id)Gets the page template with the give id.java.util.Optional<CMSPageTypeModel>getPageTypeByCode(java.lang.String typeCode)Returns the page type with the given type code.protected PermissionCRUDServicegetPermissionCRUDService()protected SessionSearchRestrictionsDisablergetSessionSearchRestrictionsDisabler()protected TypeServicegetTypeService()booleanpageExists(java.lang.String id)Checks if a page exists in the active catalog versionvoidsetCatalogVersionService(CatalogVersionService catalogVersionService)voidsetCmsCatalogVersionService(CMSCatalogVersionService cmsCatalogVersionService)voidsetCmsItemCatalogLevelComparator(java.util.Comparator<CMSItemModel> cmsItemCatalogLevelComparator)voidsetCmsPageDao(CMSPageDao cmsPageDao)voidsetCmsPageTemplateDao(CMSPageTemplateDao cmsPageTemplateDao)voidsetPermissionCRUDService(PermissionCRUDService permissionCRUDService)voidsetSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler sessionSearchRestrictionsDisabler)voidsetTypeService(TypeService typeService)voidtrashPage(java.lang.String pageUid, CatalogVersionModel catalogVersion)Soft deletes a page by updating the pageStatus to DELETED.voidupdatePage(AbstractPageModel page, java.lang.String name, java.lang.String masterTemplateId)Updates the given page.-
Methods inherited from class de.hybris.platform.cms2.servicelayer.services.admin.impl.AbstractCMSAdminService
getActiveCatalogVersion, getActiveSite, getBaseSiteService, getUserService, setBaseSiteService, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.hybris.platform.cms2.servicelayer.services.admin.CMSAdminPageService
getActiveCatalogVersion
-
-
-
-
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:
createCategoryPagein interfaceCMSAdminPageService- Parameters:
id- the idname- the namemasterTemplateId- the master template idisDefault- 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:
createContentPagein interfaceCMSAdminPageService- Parameters:
id- the idname- the namemasterTemplateId- the master template idlabel- 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:
createPagein interfaceCMSAdminPageService- Parameters:
composedType- the composed typeid- the idname- the namemasterTemplateId- 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:
createProductPagein interfaceCMSAdminPageService- Parameters:
id- the idname- the namemasterTemplateId- the master template idisDefault- the is default- Returns:
- the product page model
- Throws:
CMSItemCreateException- the cMS item create exception
-
deletePage
public void deletePage(java.lang.String id) throws CMSItemNotFoundExceptionDelete a page from the active catalog version- Specified by:
deletePagein interfaceCMSAdminPageService- Parameters:
id- page id- Throws:
CMSItemNotFoundException- if no page with the give id is found
-
getAllActivePageTemplates
public java.util.Collection<PageTemplateModel> getAllActivePageTemplates()
returns all page templates which are set to active (only of the active catalogVersion)- Specified by:
getAllActivePageTemplatesin interfaceCMSAdminPageService- Returns:
- all page templates
-
getAllContentPages
public java.util.Collection<ContentPageModel> getAllContentPages(java.util.Collection<CatalogVersionModel> catalogVersions)
Gets the all active content pages.- Specified by:
getAllContentPagesin interfaceCMSAdminPageService- Parameters:
catalogVersions- the catalog versions- Returns:
- the all content pages
-
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:
getAllContentPagesForPageStatusesin interfaceCMSAdminPageService- Parameters:
catalogVersions- the catalog versionspageStatuses- a list of page status- Returns:
- the all content pages
-
getAllPageTypes
public java.util.Collection<CMSPageTypeModel> getAllPageTypes()
Description copied from interface:CMSAdminPageServiceReturns a collection of all available page types.- Specified by:
getAllPageTypesin interfaceCMSAdminPageService- Returns:
- all page types
-
getPageTypeByCode
public java.util.Optional<CMSPageTypeModel> getPageTypeByCode(java.lang.String typeCode)
Description copied from interface:CMSAdminPageServiceReturns the page type with the given type code.- Specified by:
getPageTypeByCodein interfaceCMSAdminPageService- 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:
getAllPagesin interfaceCMSAdminPageService- Returns:
- all pages which are assigned to the active catalog version
-
getAllPages
public java.util.Collection<AbstractPageModel> getAllPages(CatalogVersionModel catalogVersion)
Gets the all active pages.- Specified by:
getAllPagesin interfaceCMSAdminPageService- Parameters:
catalogVersion- the catalog version- Returns:
- the all pages
-
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:
getAllPagesForCatalogVersionAndPageStatusesin interfaceCMSAdminPageService- Parameters:
catalogVersion- the catalog version modelpageStatuses- 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:
getAllPagesByTypein interfaceCMSAdminPageService- 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
-
getAllPagesByType
public java.util.Collection<AbstractPageModel> getAllPagesByType(java.lang.String type, CatalogVersionModel catalogVersion)
Gets the all pages by type.- Specified by:
getAllPagesByTypein interfaceCMSAdminPageService- Parameters:
type- the typecatalogVersion- the catalog version- Returns:
- the all pages by 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:
getAllPagesMapin interfaceCMSAdminPageService- 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:
getAllPageTemplatesin interfaceCMSAdminPageService- Parameters:
active- if set to true only page templates are returned which are set as active- Returns:
- all page templates
-
getAllPageTemplates
public java.util.Collection<PageTemplateModel> getAllPageTemplates(java.util.Collection<CatalogVersionModel> catalogVersions)
Gets the all page templates.- Specified by:
getAllPageTemplatesin interfaceCMSAdminPageService- Parameters:
catalogVersions- the catalog versions- Returns:
- the 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:
getAllRestrictedPageTemplatesin interfaceCMSAdminPageService- Parameters:
active- if set to true only page templates are returned which are set as activetype- 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:
getContentPagesin interfaceCMSAdminPageService- Parameters:
catalogVersions- the catalog versionslabel- the label- Returns:
- the content pages
-
getPageForIdFromActiveCatalogVersion
public AbstractPageModel getPageForIdFromActiveCatalogVersion(java.lang.String id)
Returns the active page with the given id from the active catalogVersion.- Specified by:
getPageForIdFromActiveCatalogVersionin interfaceCMSAdminPageService- Parameters:
id- the id of the page- Returns:
- the page for id
-
getPageForIdFromActiveCatalogVersionByPageStatuses
public AbstractPageModel getPageForIdFromActiveCatalogVersionByPageStatuses(java.lang.String id, java.util.List<CmsPageStatus> pageStatuses)
Returns the page with the given id and page status list from the active catalogVersion.- Specified by:
getPageForIdFromActiveCatalogVersionByPageStatusesin interfaceCMSAdminPageService- Parameters:
id- the id of the pagepageStatuses- a list of page statuses- Returns:
- the page for id
-
getPageForId
public AbstractPageModel getPageForId(java.lang.String id, java.util.Collection<CatalogVersionModel> catalogVersions)
Description copied from interface:CMSAdminPageServiceReturns the active page with the given id and the catalog versions.- Specified by:
getPageForIdin interfaceCMSAdminPageService- Parameters:
id- the id of the pagecatalogVersions- the catalog versions- Returns:
- the page for id
-
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 pagecatalogVersions- the catalog versionspageStatuses- the page statuses- Returns:
- the page
-
getPageTemplateForIdFromActiveCatalogVersion
public PageTemplateModel getPageTemplateForIdFromActiveCatalogVersion(java.lang.String id)
Gets the page template with the give id. Searches only of the active catalogVersion.- Specified by:
getPageTemplateForIdFromActiveCatalogVersionin interfaceCMSAdminPageService- Parameters:
id- the id- Returns:
- found page template
-
pageExists
public boolean pageExists(java.lang.String id)
Checks if a page exists in the active catalog version- Specified by:
pageExistsin interfaceCMSAdminPageService- Parameters:
id- page id- Returns:
trueif the page exists in the active catalog version;falseotherwise
-
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:
updatePagein interfaceCMSAdminPageService- Parameters:
page- the page modelname- the new page name to be applied to the given page modelmasterTemplateId- the new page template to be applied to the given page model- Throws:
CMSItemNotFoundException- when an item model is not found
-
createPageFromType
protected AbstractPageModel createPageFromType(java.lang.String composedTypeCode) throws CMSItemCreateException
- Throws:
CMSItemCreateException
-
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:
getHomepagein interfaceCMSAdminPageService- Parameters:
siteModel- the site model- Returns:
- the homepage model
-
getHomepage
public ContentPageModel getHomepage(CatalogVersionModel catalogVersion)
Description copied from interface:CMSAdminPageServiceGets the homepage for a given catalog version- Specified by:
getHomepagein interfaceCMSAdminPageService- Parameters:
catalogVersion- the catalog version containing the homepage- 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:
getHomepagein interfaceCMSAdminPageService- 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:CMSAdminPageServiceGets the all default or non-default active pages by page type from the active catalog version.- Specified by:
findPagesByTypein interfaceCMSAdminPageService- Parameters:
composedType- the page type modelisDefault- 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:CMSAdminPageServiceGets the all default or non-default pages by page type from the active catalog version.- Specified by:
findPagesByTypeAndPageStatusesin interfaceCMSAdminPageService- Parameters:
composedType- the page type modelisDefault- true to find default pages; false otherwisepageStatuses- a list of page statuses- Returns:
- the all default or non-default pages for a given page type
-
getIdenticalPrimaryPageModel
public AbstractPageModel getIdenticalPrimaryPageModel(AbstractPageModel pageModel)
Description copied from interface:CMSAdminPageServiceReturns identical primary page for provided pageModel.- Specified by:
getIdenticalPrimaryPageModelin interfaceCMSAdminPageService- Parameters:
pageModel- page mode- Returns:
- identical primary page
-
trashPage
public void trashPage(java.lang.String pageUid, CatalogVersionModel catalogVersion) throws CMSItemNotFoundExceptionDescription copied from interface:CMSAdminPageServiceSoft deletes a page by updating the pageStatus to DELETED. Does nothing if the page is already deleted.- Specified by:
trashPagein interfaceCMSAdminPageService- Parameters:
pageUid- The page to be trashed.catalogVersion- The catalog version of the page.- Throws:
CMSItemNotFoundException- when the page is not found.
-
getCmsPageDao
protected CMSPageDao getCmsPageDao()
-
setCmsPageDao
public void setCmsPageDao(CMSPageDao cmsPageDao)
-
getCmsPageTemplateDao
protected CMSPageTemplateDao getCmsPageTemplateDao()
-
setCmsPageTemplateDao
public void setCmsPageTemplateDao(CMSPageTemplateDao cmsPageTemplateDao)
-
getTypeService
protected TypeService getTypeService()
-
setTypeService
public void setTypeService(TypeService typeService)
-
getCatalogVersionService
protected CatalogVersionService getCatalogVersionService()
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
getCmsItemCatalogLevelComparator
protected java.util.Comparator<CMSItemModel> getCmsItemCatalogLevelComparator()
-
setCmsItemCatalogLevelComparator
public void setCmsItemCatalogLevelComparator(java.util.Comparator<CMSItemModel> cmsItemCatalogLevelComparator)
-
getCmsCatalogVersionService
protected CMSCatalogVersionService getCmsCatalogVersionService()
-
setCmsCatalogVersionService
public void setCmsCatalogVersionService(CMSCatalogVersionService cmsCatalogVersionService)
-
getPermissionCRUDService
protected PermissionCRUDService getPermissionCRUDService()
-
setPermissionCRUDService
public void setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
-
getSessionSearchRestrictionsDisabler
protected SessionSearchRestrictionsDisabler getSessionSearchRestrictionsDisabler()
-
setSessionSearchRestrictionsDisabler
public void setSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler sessionSearchRestrictionsDisabler)
-
-