Class DefaultCMSAdminContentSlotService
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.DefaultCMSAdminContentSlotService
- All Implemented Interfaces:
CMSAdminContentSlotService,Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultCMSAdminContentSlotService
extends AbstractCMSAdminService
implements CMSAdminContentSlotService
Default implementation of the content slot service.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO -
Field Summary
FieldsFields inherited from class de.hybris.platform.cms2.servicelayer.services.admin.impl.AbstractCMSAdminService
ACTIVECATALOGVERSION, ACTIVESITE, CLONE_CONTEXT, ORIGINAL_ITEM_CONTEXT, RESTORE_CONTEXT, TYPE_CONTEXTFields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManagerFields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCMSComponentToContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, Integer index) Add an existing component item into a specific index position of an existing content slot.protected voidaddComponentToComponentListSaveAsSlot(AbstractCMSComponentModel component, ContentSlotModel slot, Integer index, List<AbstractCMSComponentModel> currentComponentList) protected List<ContentSlotModel>appendTemplateSlots(PageTemplateModel pageTemplate, Set<String> positions, List<ContentSlotData> contentSlots, AbstractPageModel page, List<CatalogVersionModel> catalogVersions) Gets all of the content slots for templates that do not share a position already identified in the content slots for pages.createContentSlot(AbstractPageModel page, String id, String name, String position) Creates theContentSlotModelobject andContentSlotForPageModelrelation.createContentSlot(AbstractPageModel page, String id, String name, String position, boolean active) Creates theContentSlotModelobject andContentSlotForPageModelrelation.createContentSlot(AbstractPageModel page, String id, String name, String position, boolean active, Date activeFrom, Date activeUntil) Creates theContentSlotModelobject andContentSlotForPageModelrelation.voiddeleteContentSlot(String contentSlotId) delete a content slot and ALL PAGE RELATIONS to it.voiddeleteRelation(AbstractPageModel page, ContentSlotModel contentSlot) delete the relation between a content slot and a pagevoiddeleteRelationByPosition(AbstractPageModel page, String position) deletes a relation between a page and a content slot.Find all content slot relations by page.Deprecated, for removal: This API element is subject to removal in a future version.since 2105, no longer needed.protected StringGenerate the content slot id using the page uid prefix and the key generator.protected StringgenerateContentSlotUid(AbstractPageModel page, String position) Generate the Content Slot Uid after the slot position and page Uidprotected CMSAdminSiteServicegetAllDeletedRelationsForPage(CatalogVersionModel targetCatalogVersion, AbstractPageModel sourcePage) Retrieves the list of relations (ContentSlotForPageModelandContentSlotForTemplateModel) that does not exist (was removed) in source catalog version (based on page) and exists in target catalog version.getAllRelationsForSlot(ContentSlotModel contentSlot) Returns all page and template relations with references to this content slotprotected CMSAdminComponentServiceprotected CatalogLevelServiceprotected CMSContentSlotDaoprotected CMSContentSlotServiceprotected CMSDataFactoryprotected CMSPageServiceprotected ConfigurationServicegetContentSlotForId(String contentSlotId) Gets the content slot for specific content slot id.getContentSlotForIdAndCatalogVersions(String contentSlotId, Collection<CatalogVersionModel> catalogVersions) Gets the content slot for slot id and collection of catalog versions.getContentSlotOverride(AbstractPageModel page, ContentSlotModel contentSlot) Find the content slot in the catalog hierarchy (used with multi-country)getContentSlotPosition(AbstractPageModel page, ContentSlotModel contentSlot) Find the position of the content slot on the page or its associated page template.getContentSlotRelationsByPageId(String pageId, CatalogVersionModel catalogVersion) Find content slot relations for a given pageId and catalog version.getContentSlots(List<String> requestedContentSlotIds) Gets the content slots that correspond to the given list of content slot ids.getContentSlotsForCatalogVersion(CatalogVersionModel catalogVersion) Find all content slots that belong to a given catalog version.returns a collection of all content slots for the given page.getContentSlotsForPage(AbstractPageModel page, boolean includeMasterTemplateSlots) Returns a collection of all content slots for the given page.getOnlyContentSlotRelationsForSlot(ContentSlotModel contentSlot) Returns only page relations with references to this content slot.protected ContentSlotModelgetOverrideSlot(List<ContentSlotModel> contentSlots, ContentSlotModel contentSlot) protected PermissionCRUDServicegetSortedMultiCountryContentSlots(List<ContentSlotModel> contentSlots, List<CatalogVersionModel> catalogVersions) Deprecated, for removal: This API element is subject to removal in a future version.since 2105, no longer needed.getSortedMultiCountryContentSlots(List<ContentSlotModel> contentSlots, List<CatalogVersionModel> catalogVersions, AbstractPageModel page) Orders the given content slots according to the catalog level where the slots are defined.booleanhasOtherRelations(AbstractPageModel page, ContentSlotModel contentSlot) Checks if there are other relations between the given content slot and other pages (except the given one)booleanhasRelations(ContentSlotModel contentSlot) Checks if the given content slot has relations to one or more pagesvoidsetAdminSiteService(CMSAdminSiteService adminSiteService) voidsetCmsAdminComponentService(CMSAdminComponentService cmsAdminComponentService) voidsetCmsCatalogLevelService(CatalogLevelService cmsCatalogLevelService) voidsetCmsCatalogVersionService(CMSCatalogVersionService cmsCatalogVersionService) voidsetCmsContentSlotDao(CMSContentSlotDao cmsContentSlotDao) voidsetCmsContentSlotService(CMSContentSlotService cmsContentSlotService) voidsetCmsDataFactory(CMSDataFactory cmsDataFactory) voidsetCmsPageService(CMSPageService cmsPageService) voidsetConfigurationService(ConfigurationService configurationService) voidsetContentSlotForPageUidPrefix(String contentSlotForPageUidPrefix) voidsetContentSlotUidSuffix(String contentSlotUidSuffix) voidsetKeyGenerator(KeyGenerator keyGenerator) voidsetPermissionCRUDService(PermissionCRUDService permissionCRUDService) protected voidthrowTypePermissionException(String permissionName, String typeCode) ThrowsTypePermissionException.voidupdatePositionCMSComponentInContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, Integer index) Update the position of an existing component item into a specific index position of an existing content slot.Methods inherited from class de.hybris.platform.cms2.servicelayer.services.admin.impl.AbstractCMSAdminService
getActiveCatalogVersion, getActiveSite, getBaseSiteService, getUserService, setBaseSiteService, setUserServiceMethods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManagerMethods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
Field Details
-
DEFAULT_CONTENTSLOT_FOR_PAGE_UID_PREFIX
- See Also:
-
DEFAULT_CONTENTSLOT_UID_SUFFIX
- See Also:
-
-
Constructor Details
-
DefaultCMSAdminContentSlotService
public DefaultCMSAdminContentSlotService()
-
-
Method Details
-
createContentSlot
public ContentSlotModel createContentSlot(AbstractPageModel page, String id, String name, String position) Creates theContentSlotModelobject andContentSlotForPageModelrelation. Method explicitly saves both objects.- Specified by:
createContentSlotin interfaceCMSAdminContentSlotService- Parameters:
page- the page which will be set forContentSlotForPageModelrelation.id- the id of content slot.name- the name of content slot.position- the position of page.- Returns:
- the
ContentSlotModelobject.
-
createContentSlot
public ContentSlotModel createContentSlot(AbstractPageModel page, String id, String name, String position, boolean active) Creates theContentSlotModelobject andContentSlotForPageModelrelation. Method explicitly saves both objects.- Specified by:
createContentSlotin interfaceCMSAdminContentSlotService- Parameters:
page- the page which will be set forContentSlotForPageModelrelation.id- the id of content slot.name- the name of content slot.position- the position of page.active- the activity of content slot (true or false)- Returns:
- the
ContentSlotModelobject.
-
createContentSlot
public ContentSlotModel createContentSlot(AbstractPageModel page, String id, String name, String position, boolean active, Date activeFrom, Date activeUntil) Creates theContentSlotModelobject andContentSlotForPageModelrelation. Method explicitly saves both objects.- Specified by:
createContentSlotin interfaceCMSAdminContentSlotService- Parameters:
page- the page which will be set forContentSlotForPageModelrelation.id- the id of content slot.name- the name of content slot.position- the position of page.active- the activity of content slot (true or false)activeFrom- start date of activity.activeUntil- end date of activity.- Returns:
- the
ContentSlotModelobject.
-
generateContentSlotUid
Generate the Content Slot Uid after the slot position and page Uid- Parameters:
page- page model to get the uid fromposition- the position on the slot- Returns:
- the content slot uid
-
generateContentSlotForPageUID
Generate the content slot id using the page uid prefix and the key generator.- Returns:
- a content slot uid
-
deleteContentSlot
delete a content slot and ALL PAGE RELATIONS to it.- Specified by:
deleteContentSlotin interfaceCMSAdminContentSlotService- Parameters:
contentSlotId- the identifier of the content slot to be deleted- Throws:
CMSItemNotFoundException- if the content slot could not be found
-
deleteRelation
delete the relation between a content slot and a page- Specified by:
deleteRelationin interfaceCMSAdminContentSlotService- Parameters:
page- the page modelcontentSlot- the content slot model
-
deleteRelationByPosition
deletes a relation between a page and a content slot. The content slot will be identified via the position- Specified by:
deleteRelationByPositionin interfaceCMSAdminContentSlotService- Parameters:
page- the page modelposition- the position
-
getAllRelationsForSlot
Returns all page and template relations with references to this content slot- Specified by:
getAllRelationsForSlotin interfaceCMSAdminContentSlotService- Parameters:
contentSlot- the content slot- Returns:
- the collection of relations
-
getOnlyContentSlotRelationsForSlot
public Collection<CMSRelationModel> getOnlyContentSlotRelationsForSlot(ContentSlotModel contentSlot) Returns only page relations with references to this content slot. UnlikeCMSAdminContentSlotService.getAllRelationsForSlot(ContentSlotModel)it does not return template relations- Specified by:
getOnlyContentSlotRelationsForSlotin interfaceCMSAdminContentSlotService- Parameters:
contentSlot- the content slot- Returns:
- the collection of relations
- See Also:
-
getContentSlotForId
public ContentSlotModel getContentSlotForId(String contentSlotId) throws UnknownIdentifierException, AmbiguousIdentifierException Gets the content slot for specific content slot id.- Specified by:
getContentSlotForIdin interfaceCMSAdminContentSlotService- Parameters:
contentSlotId- the content slot id- Returns:
- found content slot object.
- Throws:
UnknownIdentifierException- thrown when no object has been foundAmbiguousIdentifierException- thrown when more than one object has been found.
-
getContentSlots
public List<ContentSlotModel> getContentSlots(List<String> requestedContentSlotIds) throws UnknownIdentifierException, AmbiguousIdentifierException Description copied from interface:CMSAdminContentSlotServiceGets the content slots that correspond to the given list of content slot ids.- Specified by:
getContentSlotsin interfaceCMSAdminContentSlotService- Parameters:
requestedContentSlotIds- the list of content slot ids- Returns:
- the list of content slots found
- Throws:
UnknownIdentifierException- thrown when one of the content slots has not been found.AmbiguousIdentifierException- thrown when more than one slot has been found for one of the given content slot ids.
-
getContentSlotForIdAndCatalogVersions
public ContentSlotModel getContentSlotForIdAndCatalogVersions(String contentSlotId, Collection<CatalogVersionModel> catalogVersions) throws UnknownIdentifierException, AmbiguousIdentifierException Gets the content slot for slot id and collection of catalog versions.- Specified by:
getContentSlotForIdAndCatalogVersionsin interfaceCMSAdminContentSlotService- Parameters:
contentSlotId- the content slot idcatalogVersions- the collection of catalog versions- Returns:
- the content slot for slot id and catalog versions
- Throws:
UnknownIdentifierException- thrown when no object has been foundAmbiguousIdentifierException- thrown when more than one object has been found.
-
getContentSlotsForPage
returns a collection of all content slots for the given page. This also includes content slots which are defined in the master template. If on a certain position a content slot is defined in the master and page, it will return the content slot from the page- Specified by:
getContentSlotsForPagein interfaceCMSAdminContentSlotService- Parameters:
page- the page model- Returns:
- all content slots for a given page
-
getContentSlotsForPage
public Collection<ContentSlotData> getContentSlotsForPage(AbstractPageModel page, boolean includeMasterTemplateSlots) Returns a collection of all content slots for the given page. If desired, the collection will include the content slots which are defined in the master template. If on a certain position a content slot is defined in the master and page, it will return the content slot from the page.- Specified by:
getContentSlotsForPagein interfaceCMSAdminContentSlotService- Parameters:
page- the page for which to retrieve the content slotsincludeMasterTemplateSlots- true to include the content slots defined in the master page template, false otherwise- Returns:
- all content slots for a given page
-
findAllContentSlotRelationsByPageTemplate
@Deprecated(since="2105", forRemoval=true) public List<ContentSlotForTemplateModel> findAllContentSlotRelationsByPageTemplate(PageTemplateModel template) Deprecated, for removal: This API element is subject to removal in a future version.since 2105, no longer needed.Find all content slot relations by page template.- Specified by:
findAllContentSlotRelationsByPageTemplatein interfaceCMSAdminContentSlotService- Parameters:
template- the page template- Returns:
- the list of found
ContentSlotForTemplateModelobjects or empty list when not found.
-
findAllContentSlotRelationsByPage
Find all content slot relations by page.- Specified by:
findAllContentSlotRelationsByPagein interfaceCMSAdminContentSlotService- Parameters:
page- the page- Returns:
- the list of found
ContentSlotForPageModelobjects or empty list when not found
-
getOverrideSlot
protected ContentSlotModel getOverrideSlot(List<ContentSlotModel> contentSlots, ContentSlotModel contentSlot) -
appendTemplateSlots
protected List<ContentSlotModel> appendTemplateSlots(PageTemplateModel pageTemplate, Set<String> positions, List<ContentSlotData> contentSlots, AbstractPageModel page, List<CatalogVersionModel> catalogVersions) Gets all of the content slots for templates that do not share a position already identified in the content slots for pages. Also, if a page content slot's position matches with that of a slot for a template then mark the page slot as override.- Parameters:
pageTemplate- - the page templatepositions- - the positionscontentSlots- - the list of content slot which new slots values will be appended topage- - the page containing the content slotcatalogVersions- - the list of catalog versions- Returns:
- list of template slots appended to the
contentSlotslist
-
updatePositionCMSComponentInContentSlot
public void updatePositionCMSComponentInContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, Integer index) Description copied from interface:CMSAdminContentSlotServiceUpdate the position of an existing component item into a specific index position of an existing content slot.If the index provided is larger than the last available position in the slot, then the component will be added to the last position.
- Specified by:
updatePositionCMSComponentInContentSlotin interfaceCMSAdminContentSlotService- Parameters:
component- - the component item; never nullslot- - the content slot; never nullindex- - where to insert the component in the slot; never null, must be a positive number
-
addCMSComponentToContentSlot
public void addCMSComponentToContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, Integer index) Description copied from interface:CMSAdminContentSlotServiceAdd an existing component item into a specific index position of an existing content slot.If the index provided is larger than the last available position in the slot, then the component will be added to the last position.
- Specified by:
addCMSComponentToContentSlotin interfaceCMSAdminContentSlotService- Parameters:
component- - the component item; never nullslot- - the content slot; never nullindex- - where to insert the component in the slot; never null, must be a positive number
-
addComponentToComponentListSaveAsSlot
protected void addComponentToComponentListSaveAsSlot(AbstractCMSComponentModel component, ContentSlotModel slot, Integer index, List<AbstractCMSComponentModel> currentComponentList) -
hasOtherRelations
Checks if there are other relations between the given content slot and other pages (except the given one)- Specified by:
hasOtherRelationsin interfaceCMSAdminContentSlotService- Parameters:
page- the page modelcontentSlot- the content slot model- Returns:
trueif there are other relations between the content slot and other pages;falseotherwise
-
hasRelations
Checks if the given content slot has relations to one or more pages- Specified by:
hasRelationsin interfaceCMSAdminContentSlotService- Parameters:
contentSlot- the content slot model- Returns:
trueif there are relations to at least one other page;falseotherwise
-
getContentSlotsForCatalogVersion
public Collection<ContentSlotModel> getContentSlotsForCatalogVersion(CatalogVersionModel catalogVersion) Description copied from interface:CMSAdminContentSlotServiceFind all content slots that belong to a given catalog version.- Specified by:
getContentSlotsForCatalogVersionin interfaceCMSAdminContentSlotService- Parameters:
catalogVersion- - the catalog version- Returns:
- collection of content slots; never
null
-
getSortedMultiCountryContentSlots
@Deprecated(since="2105", forRemoval=true) public List<ContentSlotModel> getSortedMultiCountryContentSlots(List<ContentSlotModel> contentSlots, List<CatalogVersionModel> catalogVersions) Deprecated, for removal: This API element is subject to removal in a future version.since 2105, no longer needed.Description copied from interface:CMSAdminContentSlotServiceOrders the given content slots according to the catalog level where the slots are defined. This uses theCatalogLevelServiceto determine the ordering.- Specified by:
getSortedMultiCountryContentSlotsin interfaceCMSAdminContentSlotService- Parameters:
contentSlots- - the content slots to be sortedcatalogVersions- - the catalog versions- Returns:
- a sorted list of content slots
-
getSortedMultiCountryContentSlots
public List<ContentSlotModel> getSortedMultiCountryContentSlots(List<ContentSlotModel> contentSlots, List<CatalogVersionModel> catalogVersions, AbstractPageModel page) Description copied from interface:CMSAdminContentSlotServiceOrders the given content slots according to the catalog level where the slots are defined. This uses theCatalogLevelServiceto determine the ordering.- Specified by:
getSortedMultiCountryContentSlotsin interfaceCMSAdminContentSlotService- Parameters:
contentSlots- - the content slots to be sortedcatalogVersions- - the catalog versionspage- - the page used to determine content slots that belong to this page through template or page relation- Returns:
- the list of sorted
ContentSlotModel, empty list if not found.
-
getContentSlotOverride
public ContentSlotModel getContentSlotOverride(AbstractPageModel page, ContentSlotModel contentSlot) Description copied from interface:CMSAdminContentSlotServiceFind the content slot in the catalog hierarchy (used with multi-country)- Specified by:
getContentSlotOverridein interfaceCMSAdminContentSlotService- Parameters:
page- - the page model used to determine the target catalog versioncontentSlot- - the content slot to be overridden- Returns:
- the content slot; can be null
-
getContentSlotRelationsByPageId
public List<ContentSlotForPageModel> getContentSlotRelationsByPageId(String pageId, CatalogVersionModel catalogVersion) Description copied from interface:CMSAdminContentSlotServiceFind content slot relations for a given pageId and catalog version.- Specified by:
getContentSlotRelationsByPageIdin interfaceCMSAdminContentSlotService- Parameters:
pageId- the page identifiercatalogVersion- the catalog versions- Returns:
- the list of found
ContentSlotForPageModelobjects or empty list when not found
-
getContentSlotPosition
Description copied from interface:CMSAdminContentSlotServiceFind the position of the content slot on the page or its associated page template. Method support multicountry.- Specified by:
getContentSlotPositionin interfaceCMSAdminContentSlotService- Parameters:
page- the page model containing the content slotcontentSlot- the content slot to search for- Returns:
- the position of the content slot on the page;
nullif not found
-
getAllDeletedRelationsForPage
public List<CMSRelationModel> getAllDeletedRelationsForPage(CatalogVersionModel targetCatalogVersion, AbstractPageModel sourcePage) Description copied from interface:CMSAdminContentSlotServiceRetrieves the list of relations (ContentSlotForPageModelandContentSlotForTemplateModel) that does not exist (was removed) in source catalog version (based on page) and exists in target catalog version.- Specified by:
getAllDeletedRelationsForPagein interfaceCMSAdminContentSlotService- Parameters:
targetCatalogVersion- the target catalog versionsourcePage- the source page- Returns:
- the list of relations
-
throwTypePermissionException
ThrowsTypePermissionException.- Parameters:
permissionName- permission nametypeCode- type code
-
setCmsAdminComponentService
-
setCmsContentSlotDao
-
setCmsDataFactory
-
getCmsAdminComponentService
-
getCmsContentSlotDao
-
getCmsDataFactory
-
getKeyGenerator
-
setKeyGenerator
-
getAdminSiteService
-
setAdminSiteService
-
getConfigurationService
-
setConfigurationService
-
getCmsCatalogLevelService
-
setCmsCatalogLevelService
-
getContentSlotForPageUidPrefix
-
setContentSlotForPageUidPrefix
-
getContentSlotUidSuffix
-
setContentSlotUidSuffix
-
getPermissionCRUDService
-
setPermissionCRUDService
-
getCmsCatalogVersionService
-
setCmsCatalogVersionService
-
getCmsContentSlotService
-
setCmsContentSlotService
-
getCmsPageService
-
setCmsPageService
-