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 CategoryPageModel
createCategoryPage(java.lang.String id, java.lang.String name, java.lang.String masterTemplateId, boolean isDefault)
Creates the category page.ContentPageModel
createContentPage(java.lang.String id, java.lang.String name, java.lang.String masterTemplateId, java.lang.String label)
Creates the content page.AbstractPageModel
createPage(java.lang.String composedType, java.lang.String id, java.lang.String name, java.lang.String masterTemplateId)
Creates the page.protected AbstractPageModel
createPageFromType(java.lang.String composedTypeCode)
ProductPageModel
createProductPage(java.lang.String id, java.lang.String name, java.lang.String masterTemplateId, boolean isDefault)
Creates the product page.void
deletePage(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 CatalogVersionService
getCatalogVersionService()
protected CMSCatalogVersionService
getCmsCatalogVersionService()
protected java.util.Comparator<CMSItemModel>
getCmsItemCatalogLevelComparator()
protected CMSPageDao
getCmsPageDao()
protected CMSPageTemplateDao
getCmsPageTemplateDao()
java.util.Collection<ContentPageModel>
getContentPages(java.util.Collection<CatalogVersionModel> catalogVersions, java.lang.String label)
Gets the content pages.ContentPageModel
getHomepage(CatalogVersionModel catalogVersion)
Gets the homepage for a given catalog versionContentPageModel
getHomepage(CMSSiteModel siteModel)
Gets the homepage for a given CMS Site.ContentPageModel
getHomepage(java.util.List<CatalogVersionModel> catalogVersions)
Gets the homepage for the given catalog versions.AbstractPageModel
getIdenticalPrimaryPageModel(AbstractPageModel pageModel)
Returns identical primary page for provided pageModel.AbstractPageModel
getPageForId(java.lang.String id, java.util.Collection<CatalogVersionModel> catalogVersions)
Returns the active page with the given id and the catalog versions.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.AbstractPageModel
getPageForIdFromActiveCatalogVersion(java.lang.String id)
Returns the active page with the given id from the active catalogVersion.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.PageTemplateModel
getPageTemplateForIdFromActiveCatalogVersion(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 PermissionCRUDService
getPermissionCRUDService()
protected SessionSearchRestrictionsDisabler
getSessionSearchRestrictionsDisabler()
protected TypeService
getTypeService()
boolean
pageExists(java.lang.String id)
Checks if a page exists in the active catalog versionvoid
setCatalogVersionService(CatalogVersionService catalogVersionService)
void
setCmsCatalogVersionService(CMSCatalogVersionService cmsCatalogVersionService)
void
setCmsItemCatalogLevelComparator(java.util.Comparator<CMSItemModel> cmsItemCatalogLevelComparator)
void
setCmsPageDao(CMSPageDao cmsPageDao)
void
setCmsPageTemplateDao(CMSPageTemplateDao cmsPageTemplateDao)
void
setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
void
setSessionSearchRestrictionsDisabler(SessionSearchRestrictionsDisabler sessionSearchRestrictionsDisabler)
void
setTypeService(TypeService typeService)
void
trashPage(java.lang.String pageUid, CatalogVersionModel catalogVersion)
Soft deletes a page by updating the pageStatus to DELETED.void
updatePage(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:
createCategoryPage
in 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:
createContentPage
in 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:
createPage
in 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:
createProductPage
in 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 CMSItemNotFoundException
Delete a page from the active catalog version- Specified by:
deletePage
in 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:
getAllActivePageTemplates
in 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:
getAllContentPages
in 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:
getAllContentPagesForPageStatuses
in 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:CMSAdminPageService
Returns a collection of all available page types.- Specified by:
getAllPageTypes
in interfaceCMSAdminPageService
- Returns:
- all page types
-
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 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:
getAllPages
in 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:
getAllPages
in 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:
getAllPagesForCatalogVersionAndPageStatuses
in 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:
getAllPagesByType
in 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:
getAllPagesByType
in 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:
getAllPagesMap
in 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:
getAllPageTemplates
in 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:
getAllPageTemplates
in 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:
getAllRestrictedPageTemplates
in 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:
getContentPages
in 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:
getPageForIdFromActiveCatalogVersion
in 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:
getPageForIdFromActiveCatalogVersionByPageStatuses
in 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:CMSAdminPageService
Returns the active page with the given id and the catalog versions.- Specified by:
getPageForId
in 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:
getPageTemplateForIdFromActiveCatalogVersion
in 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:
pageExists
in interfaceCMSAdminPageService
- 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 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:
getHomepage
in interfaceCMSAdminPageService
- Parameters:
siteModel
- the site model- Returns:
- the homepage model
-
getHomepage
public ContentPageModel getHomepage(CatalogVersionModel catalogVersion)
Description copied from interface:CMSAdminPageService
Gets the homepage for a given catalog version- Specified by:
getHomepage
in 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:
getHomepage
in 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:CMSAdminPageService
Gets the all default or non-default active pages by page type from the active catalog version.- Specified by:
findPagesByType
in 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:CMSAdminPageService
Gets the all default or non-default pages by page type from the active catalog version.- Specified by:
findPagesByTypeAndPageStatuses
in 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:CMSAdminPageService
Returns identical primary page for provided pageModel.- Specified by:
getIdenticalPrimaryPageModel
in interfaceCMSAdminPageService
- Parameters:
pageModel
- page mode- Returns:
- identical primary page
-
trashPage
public void trashPage(java.lang.String pageUid, CatalogVersionModel catalogVersion) throws CMSItemNotFoundException
Description copied from interface:CMSAdminPageService
Soft deletes a page by updating the pageStatus to DELETED. Does nothing if the page is already deleted.- Specified by:
trashPage
in 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)
-
-