Interface CMSNavigationService

  • All Known Implementing Classes:
    DefaultCMSNavigationService

    public interface CMSNavigationService
    The Interface CMSNavigationService for managing cms navigation nodes. In addition, this service contains methods to fetch and create super root nodes with the provided catalog version. A super root node is the first hidden node of every catalog that contains the visible root children nodes.
    • Catalog
      • Hidden Super Root Node
        • Visible Root Node
        • Visible Root Node
    Spring Bean ID:
    cmsNavigationService
    • Method Detail

      • getNavigationNodeForId

        CMSNavigationNodeModel getNavigationNodeForId​(java.lang.String id)
                                               throws CMSItemNotFoundException
        Returns a Navigation Node identified via its id
        Parameters:
        id - id of the Navigation Node
        Returns:
        The Navigation Node model with the given id
        Throws:
        CMSItemNotFoundException - if no Navigation Node with the given id could be found
      • getNavigationNodesForContentPage

        java.util.List<CMSNavigationNodeModel> getNavigationNodesForContentPage​(ContentPageModel page)
        Returns a list of all Navigation Nodes which contain the given page
        Parameters:
        page - Page to lookup
        Returns:
        list of all Navigation Nodes which have the page assigned
      • getNavigationNodesForContentPageId

        java.util.List<CMSNavigationNodeModel> getNavigationNodesForContentPageId​(java.lang.String pageId)
                                                                           throws CMSItemNotFoundException
        Returns a list of all Navigation Nodes which contain the given page
        Parameters:
        pageId - id of the page
        Returns:
        list of all Navigation Nodes which have the page assigned
        Throws:
        CMSItemNotFoundException - if the page with the given id could not be found
      • getRootNavigationNodes

        java.util.List<CMSNavigationNodeModel> getRootNavigationNodes()
        Returns:
        A list of all root navigation nodes in the active catalog version. A root navigation node is defined by not having a parent.
      • getRootNavigationNodesForContentPage

        java.util.List<CMSNavigationNodeModel> getRootNavigationNodesForContentPage​(ContentPageModel page)
        Returns a list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assigned
        Parameters:
        page - page to lookup
        Returns:
        list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assigned
      • getRootNavigationNodesForContentPageId

        java.util.List<CMSNavigationNodeModel> getRootNavigationNodesForContentPageId​(java.lang.String pageId)
                                                                               throws CMSItemNotFoundException
        Returns a list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assigned
        Parameters:
        pageId - id of the page
        Returns:
        list of all root Navigation Nodes which have this page assigned, or which have a children in their navigation tree which has this page assigned
        Throws:
        CMSItemNotFoundException - if the page with the given id could not be found
      • getNavigationEntriesByPage

        java.util.List<CMSNavigationEntryModel> getNavigationEntriesByPage​(AbstractPageModel page)
        Finds all CMSNavigationEntryModel associated with a AbstractPageModel.
        Parameters:
        page - the AbstractPageModel
        Returns:
        a List of CMSNavigationEntryModel, or an empty List if not found
      • getNavigationEntryForId

        java.util.Optional<CMSNavigationEntryModel> getNavigationEntryForId​(java.lang.String id,
                                                                            CatalogVersionModel catalogVersion)
        Returns a Navigation Entry identified via its id and the given catalog version
        Parameters:
        id - id of the Navigation Entry
        catalogVersion - catalog version
        Returns:
        The Navigation Entry model
      • createCmsNavigationEntry

        CMSNavigationEntryModel createCmsNavigationEntry​(CMSNavigationNodeModel cmsNavigationNode,
                                                         java.lang.String entryName,
                                                         ItemModel item)
        Adds a item to given cmsNavigationNode navigation node.

        Note:
        This method save all modified models i.e. cmsNavigationNode is saved!

        Parameters:
        item - item that will be added
        entryName - the navigation entry name
        cmsNavigationNode - given navigation node
        Returns:
        the navigation entry model created for the item and navigationNodeModel
      • createCmsNavigationEntry

        CMSNavigationEntryModel createCmsNavigationEntry​(CatalogVersionModel catalogVersion,
                                                         ItemModel item)
        Creates an orphan entry for a given item.

        Note:
        This method does not save the entry created.

        Parameters:
        catalogVersion - catalog version
        item - item that will be added
        Returns:
        the navigation entry model created
      • getRootNavigationNodes

        java.util.List<CMSNavigationNodeModel> getRootNavigationNodes​(CatalogVersionModel catalogVersion)
        Returns all root navigation nodes for given catalog version.

        Parameters:
        catalogVersion - catalog version
        Returns:
        founded root navigation nodes
      • move

        void move​(CMSNavigationNodeModel sourceNode,
                  CMSNavigationNodeModel targetModel)
        Moves given nodeModel at last position of the child nodes list of targetModel. It is removed from current parent node list of children.

        Note:
        This method save all modified models i.e. nodeModel and targetModel are saved!

        Parameters:
        sourceNode - node that will be moved
        targetModel - a new target node
      • move

        void move​(CMSNavigationNodeModel cmsNavigationNode,
                  ItemModel sourceItem,
                  ItemModel targetnItem)
        Moves given items within given navigation node. Precisely: Moves given source item to place of target item (target item is moved one position further).

        Note:
        This method save all modified models i.e. naviNode is saved with new items order!

        Parameters:
        cmsNavigationNode - current navigation node
        sourceItem - a source node
        targetnItem - a new target node
      • move

        void move​(ItemModel item,
                  CMSNavigationNodeModel sourceNode,
                  CMSNavigationNodeModel targetNode)
        Moves given item from sourceNode to targetNode. Which means soureNode will have one child less, targetNode on the other hand one more.

        Note:
        This method save all modified models i.e. sourceNode and targetNode is saved with new item order!

        Parameters:
        item - item that will be moved
        sourceNode - a source node
        targetNode - a new target node
      • delete

        @Deprecated
        void delete​(CMSNavigationNodeModel cmsNavigationNode)
        Deprecated.
        since 1811, no longer needed.
        Deletes given node and all it' child nodes.

        Note:
        This method save all modified models!. This method removes only the given navigation node with its child - without other references i.e. pages won't be removed.

        Parameters:
        cmsNavigationNode - navigation node to remove
      • remove

        void remove​(CMSNavigationNodeModel cmsNavigationNode,
                    ItemModel item)
        Removes given item from given navigation node. The item itself is not deleted.

        Note:
        This method save all modified models! i.e. cmsNavigationNode is saved!

        Parameters:
        cmsNavigationNode - given navigation node
        item - given item to remove from cmsNavigationNode
      • removeNavigationEntryByUid

        @Deprecated
        boolean removeNavigationEntryByUid​(CMSNavigationNodeModel cmsNavigationNode,
                                           java.lang.String navigationEntryUid)
        Deprecated.
        since 1811, no longer needed.
        Removes a given entry from a given navigation node. The Navigation Entry is deleted, but not the ItemModel in the entry.

        Note:
        This method save all modified models, i.e. cmsNavigationNode is saved.

        Parameters:
        cmsNavigationNode - given navigation node
        navigationEntryUid - given navigation entry uid.
        Returns:
        true if the entry was removed or false otherwise.
      • createNavigationNode

        @Deprecated
        CMSNavigationNodeModel createNavigationNode​(ItemModel parentNode,
                                                    java.lang.String navigationNodeName,
                                                    boolean visible,
                                                    java.util.Collection<ItemModel> relatedItems)
        Deprecated.
        since 1811, please use CMSItemFacade.createItem(Map) instead.
        Creates a navigation node accordingly to specified attributes.

        Note:
        Returned CMSNavigationNodeModel is not saved!

        Parameters:
        parentNode - parent for created navigation node
        navigationNodeName - given navigation node name
        visible - flag determines navigation node visibility
        relatedItems - given related items
        Returns:
        a new navigation node
      • isSuperRootNavigationNode

        boolean isSuperRootNavigationNode​(CMSNavigationNodeModel navigationNodeModel)
        Tests if a navigation node is a super root node.
        Parameters:
        navigationNodeModel - node model to test if it's a super root node
        Returns:
        returns true if it is a super root node
      • setSuperRootNodeOnNavigationNode

        CMSNavigationNodeModel setSuperRootNodeOnNavigationNode​(CMSNavigationNodeModel navigationNodeModel,
                                                                CatalogVersionModel catalogVersionModel)
        Sets the super root node onto the passed CMS navigation node model.
        Parameters:
        navigationNodeModel - node model to set the super root node on
        catalogVersionModel - the belonging catalog version model of the super root node
        Returns:
        navigation node with a parent super root node
      • getSuperRootNavigationNode

        CMSNavigationNodeModel getSuperRootNavigationNode​(CatalogVersionModel catalogVersionModel)
        Returns super root navigation node for given catalog version.

        Parameters:
        catalogVersionModel - current catalog version
        Returns:
        a super root navigation node
      • appendRelatedItems

        void appendRelatedItems​(CMSNavigationNodeModel cmsNavigationNode,
                                java.util.Collection<ItemModel> items)
        Adds selected items to specific CMSNavigationNodeModel navigation node.

        Parameters:
        cmsNavigationNode - given navigation node
        items - that will be added
      • createSuperRootNavigationNode

        CMSNavigationNodeModel createSuperRootNavigationNode​(CatalogVersionModel catalogVersion)
        Creates super root navigation node for given catalog version.
        Parameters:
        catalogVersion - catalog version for which the super root node will be created
        Returns:
        a new super root navigation node
      • move

        void move​(CMSNavigationNodeModel source,
                  CMSNavigationNodeModel target,
                  boolean asChild,
                  boolean append)
        Moves source nod to targert node.
        Parameters:
        source - node to be moved
        target - node to be dropped at
        asChild - if true source node will be come target node's child otherwise source will become target's sibling
        append - if true source will be added as last (child node)/next(sibling) else as first/previous