Interface HierarchyManager

    • Method Detail

      • resolvePath

        ItemId resolvePath​(Path path)
                    throws RepositoryException
        Deprecated.
        As of JSR 283, a Path doesn't anymore uniquely identify an Item, therefore resolveNodePath(Path) and resolvePropertyPath(Path) should be used instead.
        Resolves a path into an item id.

        If there is both a node and a property at the specified path, this method will return the id of the node.

        Note that, for performance reasons, this method returns null rather than throwing a PathNotFoundException if there's no item to be found at path.

        Parameters:
        path - path to resolve
        Returns:
        item id referred to by path or null if there's no item at path.
        Throws:
        RepositoryException - if an error occurs
      • resolveNodePath

        NodeId resolveNodePath​(Path path)
                        throws RepositoryException
        Resolves a path into a node id.

        Note that, for performance reasons, this method returns null rather than throwing a PathNotFoundException if there's no node to be found at path.

        Parameters:
        path - path to resolve
        Returns:
        node id referred to by path or null if there's no node at path.
        Throws:
        RepositoryException - if an error occurs
      • resolvePropertyPath

        PropertyId resolvePropertyPath​(Path path)
                                throws RepositoryException
        Resolves a path into a property id.

        Note that, for performance reasons, this method returns null rather than throwing a PathNotFoundException if there's no property to be found at path.

        Parameters:
        path - path to resolve
        Returns:
        property id referred to by path or null if there's no property at path.
        Throws:
        RepositoryException - if an error occurs
      • getDepth

        int getDepth​(ItemId id)
              throws ItemNotFoundException,
                     RepositoryException
        Returns the depth of the specified item which is equivalent to getPath(id).getAncestorCount(). The depth reflects the absolute hierarchy level.
        Parameters:
        id - item id
        Returns:
        the depth of the specified item
        Throws:
        ItemNotFoundException - if the specified id does not denote an existing item.
        RepositoryException - if another error occurs
      • getRelativeDepth

        int getRelativeDepth​(NodeId ancestorId,
                             ItemId descendantId)
                      throws ItemNotFoundException,
                             RepositoryException
        Returns the depth of the specified descendant relative to the given ancestor. If ancestorId and descendantId denote the same item 0 is returned. If ancestorId does not denote an ancestor -1 is returned.
        Parameters:
        ancestorId - ancestor id
        descendantId - descendant id
        Returns:
        the relative depth; -1 if ancestorId does not denote an ancestor of the item denoted by descendantId (or itself).
        Throws:
        ItemNotFoundException - if either of the specified id's does not denote an existing item.
        RepositoryException - if another error occurs
      • isAncestor

        boolean isAncestor​(NodeId nodeId,
                           ItemId itemId)
                    throws ItemNotFoundException,
                           RepositoryException
        Determines whether the node with the specified nodeId is an ancestor of the item denoted by the given itemId. This is equivalent to getPath(nodeId).isAncestorOf(getPath(itemId)).
        Parameters:
        nodeId - node id
        itemId - item id
        Returns:
        true if the node with the specified nodeId is an ancestor of the item denoted by the given itemId; false otherwise
        Throws:
        ItemNotFoundException - if any of the specified id's does not denote an existing item.
        RepositoryException - if another error occurs
      • isShareAncestor

        boolean isShareAncestor​(NodeId ancestor,
                                NodeId descendant)
                         throws ItemNotFoundException,
                                RepositoryException
        Determines whether the node with the specified ancestor is a share ancestor of the item denoted by the given descendant. This is true for two nodes A, B if either:
        • A is a (proper) ancestor of B
        • there is a non-empty sequence of nodes N1,... ,Nk such that A= N1 and B=Nk and Ni is the parent or a share-parent of Ni+1 (for every i in 1 ...k-1.
        Parameters:
        ancestor - node id
        descendant - item id
        Returns:
        true if the node denoted by ancestor is a share ancestor of the item denoted by descendant, false otherwise
        Throws:
        ItemNotFoundException - if any of the specified id's does not denote an existing item.
        RepositoryException - if another error occurs
      • getShareRelativeDepth

        int getShareRelativeDepth​(NodeId ancestorId,
                                  ItemId descendantId)
                           throws ItemNotFoundException,
                                  RepositoryException
        Returns the depth of the specified share-descendant relative to the given share-ancestor. If ancestor and descendant denote the same item, 0 is returned. If ancestor does not denote an share-ancestor -1 is returned.
        Parameters:
        ancestorId - ancestor id
        descendantId - descendant id
        Returns:
        the relative depth; -1 if ancestor does not denote a share-ancestor of the item denoted by descendant (or itself).
        Throws:
        ItemNotFoundException - if either of the specified id's does not denote an existing item.
        RepositoryException - if another error occurs