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,java.io.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:
- 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 static java.lang.StringDEFAULT_CONTENTSLOT_FOR_PAGE_UID_PREFIXstatic java.lang.StringDEFAULT_CONTENTSLOT_UID_SUFFIX-
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 DefaultCMSAdminContentSlotService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCMSComponentToContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, java.lang.Integer index)Add an existing component item into a specific index position of an existing content slot.protected voidaddComponentToComponentListSaveAsSlot(AbstractCMSComponentModel component, ContentSlotModel slot, java.lang.Integer index, java.util.List<AbstractCMSComponentModel> currentComponentList)protected java.util.List<ContentSlotModel>appendTemplateSlots(PageTemplateModel pageTemplate, java.util.Set<java.lang.String> positions, java.util.List<ContentSlotData> contentSlots, AbstractPageModel page)Gets all of the content slots for templates that do not share a position already identified in the content slots for pages.ContentSlotModelcreateContentSlot(AbstractPageModel page, java.lang.String id, java.lang.String name, java.lang.String position)Creates theContentSlotModelobject andContentSlotForPageModelrelation.ContentSlotModelcreateContentSlot(AbstractPageModel page, java.lang.String id, java.lang.String name, java.lang.String position, boolean active)Creates theContentSlotModelobject andContentSlotForPageModelrelation.ContentSlotModelcreateContentSlot(AbstractPageModel page, java.lang.String id, java.lang.String name, java.lang.String position, boolean active, java.util.Date activeFrom, java.util.Date activeUntil)Creates theContentSlotModelobject andContentSlotForPageModelrelation.voiddeleteContentSlot(java.lang.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, java.lang.String position)deletes a relation between a page and a content slot.java.util.List<ContentSlotForPageModel>findAllContentSlotRelationsByPage(AbstractPageModel page)Find all content slot relations by page.java.util.List<ContentSlotForTemplateModel>findAllContentSlotRelationsByPageTemplate(PageTemplateModel template)Find all content slot relations by page template.protected java.lang.StringgenerateContentSlotForPageUID()Generate the content slot id using the page uid prefix and the key generator.protected java.lang.StringgenerateContentSlotUid(AbstractPageModel page, java.lang.String position)Generate the Content Slot Uid after the slot position and page Uidprotected CMSAdminSiteServicegetAdminSiteService()java.util.Collection<CMSRelationModel>getAllRelationsForSlot(ContentSlotModel contentSlot)Returns all page and template relations with references to this content slotprotected CMSAdminComponentServicegetCmsAdminComponentService()protected CatalogLevelServicegetCmsCatalogLevelService()protected CMSContentSlotDaogetCmsContentSlotDao()protected CMSDataFactorygetCmsDataFactory()protected ConfigurationServicegetConfigurationService()ContentSlotModelgetContentSlotForId(java.lang.String contentSlotId)Gets the content slot for specific content slot id.ContentSlotModelgetContentSlotForIdAndCatalogVersions(java.lang.String contentSlotId, java.util.Collection<CatalogVersionModel> catalogVersions)Gets the content slot for slot id and collection of catalog versions.java.lang.StringgetContentSlotForPageUidPrefix()ContentSlotModelgetContentSlotOverride(AbstractPageModel page, ContentSlotModel contentSlot)Find the content slot in the catalog hierarchy (used with multi-country)java.lang.StringgetContentSlotPosition(AbstractPageModel page, ContentSlotModel contentSlot)Find the position of the content slot on the page or its associated page templatejava.util.List<ContentSlotForPageModel>getContentSlotRelationsByPageId(java.lang.String pageId, CatalogVersionModel catalogVersion)Find content slot relations for a given pageId and catalog version.java.util.Collection<ContentSlotModel>getContentSlotsForCatalogVersion(CatalogVersionModel catalogVersion)Find all content slots that belong to a given catalog version.java.util.Collection<ContentSlotData>getContentSlotsForPage(AbstractPageModel page)returns a collection of all content slots for the given page.java.util.Collection<ContentSlotData>getContentSlotsForPage(AbstractPageModel page, boolean includeMasterTemplateSlots)Returns a collection of all content slots for the given page.java.lang.StringgetContentSlotUidSuffix()KeyGeneratorgetKeyGenerator()java.util.Collection<CMSRelationModel>getOnlyContentSlotRelationsForSlot(ContentSlotModel contentSlot)Returns only page relations with references to this content slot.protected ContentSlotModelgetOverrideSlot(java.util.List<ContentSlotModel> contentSlots, ContentSlotModel contentSlot)protected PermissionCRUDServicegetPermissionCRUDService()java.util.List<ContentSlotModel>getSortedMultiCountryContentSlots(java.util.List<ContentSlotModel> contentSlots, java.util.List<CatalogVersionModel> catalogVersions)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)voidsetCmsContentSlotDao(CMSContentSlotDao cmsContentSlotDao)voidsetCmsDataFactory(CMSDataFactory cmsDataFactory)voidsetConfigurationService(ConfigurationService configurationService)voidsetContentSlotForPageUidPrefix(java.lang.String contentSlotForPageUidPrefix)voidsetContentSlotUidSuffix(java.lang.String contentSlotUidSuffix)voidsetKeyGenerator(KeyGenerator keyGenerator)voidsetPermissionCRUDService(PermissionCRUDService permissionCRUDService)protected voidthrowTypePermissionException(java.lang.String permissionName, java.lang.String typeCode)ThrowsTypePermissionException.voidupdatePositionCMSComponentInContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, java.lang.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, 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
-
DEFAULT_CONTENTSLOT_FOR_PAGE_UID_PREFIX
public static final java.lang.String DEFAULT_CONTENTSLOT_FOR_PAGE_UID_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_CONTENTSLOT_UID_SUFFIX
public static final java.lang.String DEFAULT_CONTENTSLOT_UID_SUFFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
createContentSlot
public ContentSlotModel createContentSlot(AbstractPageModel page, java.lang.String id, java.lang.String name, java.lang.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, java.lang.String id, java.lang.String name, java.lang.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, java.lang.String id, java.lang.String name, java.lang.String position, boolean active, java.util.Date activeFrom, java.util.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
protected java.lang.String generateContentSlotUid(AbstractPageModel page, java.lang.String position)
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
protected java.lang.String generateContentSlotForPageUID()
Generate the content slot id using the page uid prefix and the key generator.- Returns:
- a content slot uid
-
deleteContentSlot
public void deleteContentSlot(java.lang.String contentSlotId) throws CMSItemNotFoundExceptiondelete 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
public void deleteRelation(AbstractPageModel page, ContentSlotModel contentSlot)
delete the relation between a content slot and a page- Specified by:
deleteRelationin interfaceCMSAdminContentSlotService- Parameters:
page- the page modelcontentSlot- the content slot model
-
deleteRelationByPosition
public void deleteRelationByPosition(AbstractPageModel page, java.lang.String position)
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
public java.util.Collection<CMSRelationModel> getAllRelationsForSlot(ContentSlotModel contentSlot)
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 java.util.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:
CMSAdminContentSlotService.getAllRelationsForSlot(ContentSlotModel)
-
getContentSlotForId
public ContentSlotModel getContentSlotForId(java.lang.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.
-
getContentSlotForIdAndCatalogVersions
public ContentSlotModel getContentSlotForIdAndCatalogVersions(java.lang.String contentSlotId, java.util.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
public java.util.Collection<ContentSlotData> getContentSlotsForPage(AbstractPageModel page)
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 java.util.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
public java.util.List<ContentSlotForTemplateModel> findAllContentSlotRelationsByPageTemplate(PageTemplateModel template)
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
public java.util.List<ContentSlotForPageModel> findAllContentSlotRelationsByPage(AbstractPageModel page)
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(java.util.List<ContentSlotModel> contentSlots, ContentSlotModel contentSlot)
-
appendTemplateSlots
protected java.util.List<ContentSlotModel> appendTemplateSlots(PageTemplateModel pageTemplate, java.util.Set<java.lang.String> positions, java.util.List<ContentSlotData> contentSlots, AbstractPageModel page)
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 slot- Returns:
- list of template slots appended to the
contentSlotslist
-
updatePositionCMSComponentInContentSlot
public void updatePositionCMSComponentInContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, java.lang.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, java.lang.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, java.lang.Integer index, java.util.List<AbstractCMSComponentModel> currentComponentList)
-
hasOtherRelations
public boolean hasOtherRelations(AbstractPageModel page, ContentSlotModel contentSlot)
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
public boolean hasRelations(ContentSlotModel contentSlot)
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 java.util.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
public java.util.List<ContentSlotModel> getSortedMultiCountryContentSlots(java.util.List<ContentSlotModel> contentSlots, java.util.List<CatalogVersionModel> catalogVersions)
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
-
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 java.util.List<ContentSlotForPageModel> getContentSlotRelationsByPageId(java.lang.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
public java.lang.String getContentSlotPosition(AbstractPageModel page, ContentSlotModel contentSlot)
Description copied from interface:CMSAdminContentSlotServiceFind the position of the content slot on the page or its associated page template- 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
-
throwTypePermissionException
protected void throwTypePermissionException(java.lang.String permissionName, java.lang.String typeCode)ThrowsTypePermissionException.- Parameters:
permissionName- permission nametypeCode- type code
-
setCmsAdminComponentService
public void setCmsAdminComponentService(CMSAdminComponentService cmsAdminComponentService)
-
setCmsContentSlotDao
public void setCmsContentSlotDao(CMSContentSlotDao cmsContentSlotDao)
-
setCmsDataFactory
public void setCmsDataFactory(CMSDataFactory cmsDataFactory)
-
getCmsAdminComponentService
protected CMSAdminComponentService getCmsAdminComponentService()
-
getCmsContentSlotDao
protected CMSContentSlotDao getCmsContentSlotDao()
-
getCmsDataFactory
protected CMSDataFactory getCmsDataFactory()
-
getKeyGenerator
public KeyGenerator getKeyGenerator()
-
setKeyGenerator
public void setKeyGenerator(KeyGenerator keyGenerator)
-
getAdminSiteService
protected CMSAdminSiteService getAdminSiteService()
-
setAdminSiteService
public void setAdminSiteService(CMSAdminSiteService adminSiteService)
-
getConfigurationService
protected ConfigurationService getConfigurationService()
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getCmsCatalogLevelService
protected CatalogLevelService getCmsCatalogLevelService()
-
setCmsCatalogLevelService
public void setCmsCatalogLevelService(CatalogLevelService cmsCatalogLevelService)
-
getContentSlotForPageUidPrefix
public java.lang.String getContentSlotForPageUidPrefix()
-
setContentSlotForPageUidPrefix
public void setContentSlotForPageUidPrefix(java.lang.String contentSlotForPageUidPrefix)
-
getContentSlotUidSuffix
public java.lang.String getContentSlotUidSuffix()
-
setContentSlotUidSuffix
public void setContentSlotUidSuffix(java.lang.String contentSlotUidSuffix)
-
getPermissionCRUDService
protected PermissionCRUDService getPermissionCRUDService()
-
setPermissionCRUDService
public void setPermissionCRUDService(PermissionCRUDService permissionCRUDService)
-
-