Interface CMSAdminContentSlotService

  • All Known Implementing Classes:
    DefaultCMSAdminContentSlotService

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

      • createContentSlot

        ContentSlotModel createContentSlot​(AbstractPageModel page,
                                           java.lang.String id,
                                           java.lang.String name,
                                           java.lang.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,
                                           java.lang.String id,
                                           java.lang.String name,
                                           java.lang.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,
                                           java.lang.String id,
                                           java.lang.String name,
                                           java.lang.String position,
                                           boolean active,
                                           java.util.Date activeFrom,
                                           java.util.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​(java.lang.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,
                                      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 model
        position - 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
      • 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 ContentSlotForTemplateModel objects 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 ContentSlotForPageModel objects 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 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
      • 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 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,
                                                     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 null
        slot - - the content slot; never null
        index - - 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 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
      • 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 version
        contentSlot - - 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 identifier
        catalogVersion - the catalog versions
        Returns:
        the list of found ContentSlotForPageModel objects 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 slot
        contentSlot - the content slot to search for
        Returns:
        the position of the content slot on the page; null if not found