Interface CMSAdminContentSlotService
-
- All Known Implementing Classes:
DefaultCMSAdminContentSlotService
public interface CMSAdminContentSlotServiceThe Interface CMSAdminContentSlotService responsible for managing content slots.- Spring Bean ID:
- cmsAdminContentSlotService
-
-
Method Summary
All Methods Instance Methods Abstract 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.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.java.util.Collection<CMSRelationModel>getAllRelationsForSlot(ContentSlotModel contentSlot)Returns all page and template relations with references to this content slotContentSlotModelgetContentSlotForId(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.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.util.Collection<CMSRelationModel>getOnlyContentSlotRelationsForSlot(ContentSlotModel contentSlot)Returns only page relations with references to this content slot.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 pagesvoidupdatePositionCMSComponentInContentSlot(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.
-
-
-
Method Detail
-
createContentSlot
ContentSlotModel createContentSlot(AbstractPageModel page, java.lang.String id, java.lang.String name, java.lang.String position)
Creates theContentSlotModelobject andContentSlotForPageModelrelation. Method explicitly saves both objects.- 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
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.- 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
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.- 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.
-
deleteContentSlot
void deleteContentSlot(java.lang.String contentSlotId) throws CMSItemNotFoundExceptiondelete a content slot and ALL PAGE RELATIONS to it.- Parameters:
contentSlotId- the identifier of the content slot to be deleted- Throws:
CMSItemNotFoundException- if the content slot could not be found
-
deleteRelation
void deleteRelation(AbstractPageModel page, ContentSlotModel contentSlot)
delete the relation between a content slot and a page- Parameters:
page- the page modelcontentSlot- the content slot model
-
deleteRelationByPosition
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- Parameters:
page- the page modelposition- the position
-
getAllRelationsForSlot
java.util.Collection<CMSRelationModel> getAllRelationsForSlot(ContentSlotModel contentSlot)
Returns all page and template relations with references to this content slot- Parameters:
contentSlot- the content slot- Returns:
- the collection of relations
-
getContentSlotForId
ContentSlotModel getContentSlotForId(java.lang.String contentSlotId) throws UnknownIdentifierException, AmbiguousIdentifierException
Gets the content slot for specific content slot id.- Parameters:
contentSlotId- the content slot id- Returns:
- found content slot object.
- Throws:
AmbiguousIdentifierException- thrown when more than one object has been found.UnknownIdentifierException- thrown when no object has been found
-
getContentSlotForIdAndCatalogVersions
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.- Parameters:
contentSlotId- the content slot idcatalogVersions- the collection of catalog versions- Returns:
- the content slot for slot id and catalog versions
- Throws:
AmbiguousIdentifierException- thrown when more than one object has been found.UnknownIdentifierException- thrown when no object has been found
-
getContentSlotsForPage
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- Parameters:
page- the page model- Returns:
- all content slots for a given page
-
findAllContentSlotRelationsByPageTemplate
java.util.List<ContentSlotForTemplateModel> findAllContentSlotRelationsByPageTemplate(PageTemplateModel template)
Find all content slot relations by page template.- Parameters:
template- the page template- Returns:
- the list of found
ContentSlotForTemplateModelobjects or empty list when not found.
-
findAllContentSlotRelationsByPage
java.util.List<ContentSlotForPageModel> findAllContentSlotRelationsByPage(AbstractPageModel page)
Find all content slot relations by page.- Parameters:
page- the page- Returns:
- the list of found
ContentSlotForPageModelobjects or empty list when not found
-
getContentSlotsForPage
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.- 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
-
hasOtherRelations
boolean hasOtherRelations(AbstractPageModel page, ContentSlotModel contentSlot)
Checks if there are other relations between the given content slot and other pages (except the given one)- Parameters:
page- the page modelcontentSlot- the content slot model- Returns:
trueif there are other relations between the content slot and other pages;falseotherwise
-
hasRelations
boolean hasRelations(ContentSlotModel contentSlot)
Checks if the given content slot has relations to one or more pages- Parameters:
contentSlot- the content slot model- Returns:
trueif there are relations to at least one other page;falseotherwise
-
getOnlyContentSlotRelationsForSlot
java.util.Collection<CMSRelationModel> getOnlyContentSlotRelationsForSlot(ContentSlotModel contentSlot)
Returns only page relations with references to this content slot. UnlikegetAllRelationsForSlot(ContentSlotModel)it does not return template relations- Parameters:
contentSlot- the content slot- Returns:
- the collection of relations
- See Also:
getAllRelationsForSlot(ContentSlotModel)
-
addCMSComponentToContentSlot
void addCMSComponentToContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, java.lang.Integer index)
Add 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.
- 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
-
updatePositionCMSComponentInContentSlot
void updatePositionCMSComponentInContentSlot(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.If the index provided is larger than the last available position in the slot, then the component will be added to the last position.
- 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
-
getContentSlotsForCatalogVersion
java.util.Collection<ContentSlotModel> getContentSlotsForCatalogVersion(CatalogVersionModel catalogVersion)
Find all content slots that belong to a given catalog version.- Parameters:
catalogVersion- - the catalog version- Returns:
- collection of content slots; never
null
-
getSortedMultiCountryContentSlots
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. This uses theCatalogLevelServiceto determine the ordering.- Parameters:
contentSlots- - the content slots to be sortedcatalogVersions- - the catalog versions- Returns:
- a sorted list of content slots
-
getContentSlotOverride
ContentSlotModel getContentSlotOverride(AbstractPageModel page, ContentSlotModel contentSlot)
Find the content slot in the catalog hierarchy (used with multi-country)- 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
java.util.List<ContentSlotForPageModel> getContentSlotRelationsByPageId(java.lang.String pageId, CatalogVersionModel catalogVersion)
Find content slot relations for a given pageId and catalog version.- Parameters:
pageId- the page identifiercatalogVersion- the catalog versions- Returns:
- the list of found
ContentSlotForPageModelobjects or empty list when not found
-
getContentSlotPosition
java.lang.String getContentSlotPosition(AbstractPageModel page, ContentSlotModel contentSlot)
Find the position of the content slot on the page or its associated page template- 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
-
-