Interface CMSAdminContentSlotService

All Known Implementing Classes:
DefaultCMSAdminContentSlotService

public interface CMSAdminContentSlotService
The Interface CMSAdminContentSlotService responsible for managing content slots.
Spring Bean ID:
cmsAdminContentSlotService
  • Method Details

    • createContentSlot

      ContentSlotModel createContentSlot(AbstractPageModel page, String id, String name, String position)
      Creates the ContentSlotModel object and ContentSlotForPageModel relation. Method explicitly saves both objects.
      Parameters:
      page - the page which will be set for ContentSlotForPageModel relation.
      id - the id of content slot.
      name - the name of content slot.
      position - the position of page.
      Returns:
      the ContentSlotModel object.
    • createContentSlot

      ContentSlotModel createContentSlot(AbstractPageModel page, String id, String name, String position, boolean active)
      Creates the ContentSlotModel object and ContentSlotForPageModel relation. Method explicitly saves both objects.
      Parameters:
      page - the page which will be set for ContentSlotForPageModel relation.
      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 ContentSlotModel object.
    • createContentSlot

      ContentSlotModel createContentSlot(AbstractPageModel page, String id, String name, String position, boolean active, Date activeFrom, Date activeUntil)
      Creates the ContentSlotModel object and ContentSlotForPageModel relation. Method explicitly saves both objects.
      Parameters:
      page - the page which will be set for ContentSlotForPageModel relation.
      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 ContentSlotModel object.
    • deleteContentSlot

      void deleteContentSlot(String contentSlotId) throws CMSItemNotFoundException
      delete 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 model
      contentSlot - the content slot model
    • deleteRelationByPosition

      void deleteRelationByPosition(AbstractPageModel page, 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 model
      position - the position
    • getAllRelationsForSlot

      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

      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
    • getContentSlots

      default List<ContentSlotModel> getContentSlots(List<String> contentSlotIds) throws UnknownIdentifierException, AmbiguousIdentifierException
      Gets the content slots that correspond to the given list of content slot ids.
      Parameters:
      contentSlotIds - 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

      ContentSlotModel getContentSlotForIdAndCatalogVersions(String contentSlotId, Collection<CatalogVersionModel> catalogVersions) throws UnknownIdentifierException, AmbiguousIdentifierException
      Gets the content slot for slot id and collection of catalog versions.
      Parameters:
      contentSlotId - the content slot id
      catalogVersions - 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

      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

      @Deprecated(since="2105", forRemoval=true) List<ContentSlotForTemplateModel> findAllContentSlotRelationsByPageTemplate(PageTemplateModel template)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 2105, please use {@link CMSAdminContentSlotService#}.
      Find all content slot relations by page template.
      Parameters:
      template - the page template
      Returns:
      the list of found ContentSlotForTemplateModel objects or empty list when not found.
    • findAllContentSlotRelationsByPage

      List<ContentSlotForPageModel> findAllContentSlotRelationsByPage(AbstractPageModel page)
      Find all content slot relations by page.
      Parameters:
      page - the page
      Returns:
      the list of found ContentSlotForPageModel objects or empty list when not found
    • getContentSlotsForPage

      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 slots
      includeMasterTemplateSlots - 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 model
      contentSlot - the content slot model
      Returns:
      true if there are other relations between the content slot and other pages; false otherwise
    • 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:
      true if there are relations to at least one other page; false otherwise
    • getOnlyContentSlotRelationsForSlot

      Collection<CMSRelationModel> getOnlyContentSlotRelationsForSlot(ContentSlotModel contentSlot)
      Returns only page relations with references to this content slot. Unlike getAllRelationsForSlot(ContentSlotModel) it does not return template relations
      Parameters:
      contentSlot - the content slot
      Returns:
      the collection of relations
      See Also:
    • addCMSComponentToContentSlot

      void addCMSComponentToContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, 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 null
      slot - - the content slot; never null
      index - - where to insert the component in the slot; never null, must be a positive number
    • updatePositionCMSComponentInContentSlot

      void updatePositionCMSComponentInContentSlot(AbstractCMSComponentModel component, ContentSlotModel slot, 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 null
      slot - - the content slot; never null
      index - - where to insert the component in the slot; never null, must be a positive number
    • getContentSlotsForCatalogVersion

      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

      @Deprecated(since="2105", forRemoval=true) List<ContentSlotModel> getSortedMultiCountryContentSlots(List<ContentSlotModel> contentSlots, List<CatalogVersionModel> catalogVersions)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Orders the given content slots according to the catalog level where the slots are defined. This uses the CatalogLevelService to determine the ordering.
      Parameters:
      contentSlots - - the content slots to be sorted
      catalogVersions - - the catalog versions
      Returns:
      a sorted list of content slots
    • getSortedMultiCountryContentSlots

      default List<ContentSlotModel> getSortedMultiCountryContentSlots(List<ContentSlotModel> contentSlots, List<CatalogVersionModel> catalogVersions, AbstractPageModel page)
      Orders the given content slots according to the catalog level where the slots are defined. This uses the CatalogLevelService to determine the ordering.
      Parameters:
      contentSlots - - the content slots to be sorted
      catalogVersions - - the catalog versions
      page - - 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

      @Deprecated(since="2105", forRemoval=true) ContentSlotModel getContentSlotOverride(AbstractPageModel page, ContentSlotModel contentSlot)
      Deprecated, for removal: This API element is subject to removal in a future version.
      since 2105, no longer needed.
      Find the content slot in the catalog hierarchy (used with multi-country)
      Parameters:
      page - - the page model used to determine the target catalog version
      contentSlot - - the content slot to be overridden
      Returns:
      the content slot; can be null
    • getContentSlotRelationsByPageId

      List<ContentSlotForPageModel> getContentSlotRelationsByPageId(String pageId, CatalogVersionModel catalogVersion)
      Find content slot relations for a given pageId and catalog version.
      Parameters:
      pageId - the page identifier
      catalogVersion - the catalog versions
      Returns:
      the list of found ContentSlotForPageModel objects or empty list when not found
    • getContentSlotPosition

      String getContentSlotPosition(AbstractPageModel page, ContentSlotModel contentSlot)
      Find the position of the content slot on the page or its associated page template. Method support multicountry.
      Parameters:
      page - the page model containing the content slot
      contentSlot - the content slot to search for
      Returns:
      the position of the content slot on the page; null if not found
    • getAllDeletedRelationsForPage

      default List<CMSRelationModel> getAllDeletedRelationsForPage(CatalogVersionModel targetCatalogVersion, AbstractPageModel sourcePage)
      Retrieves the list of relations (ContentSlotForPageModel and ContentSlotForTemplateModel) that does not exist (was removed) in source catalog version (based on page) and exists in target catalog version.
      Parameters:
      targetCatalogVersion - the target catalog version
      sourcePage - the source page
      Returns:
      the list of relations