public interface HierarchyManager
HierarchyManager
interface ...Modifier and Type | Method and Description |
---|---|
int |
getDepth(ItemId id)
Returns the depth of the specified item which is equivalent to
getPath(id).getAncestorCount() . |
Name |
getName(ItemId id)
Returns the name of the specified item.
|
Name |
getName(NodeId id,
NodeId parentId)
Returns the name of the specified item, with the given parent id.
|
Path |
getPath(ItemId id)
Returns the path to the given item.
|
int |
getRelativeDepth(NodeId ancestorId,
ItemId descendantId)
Returns the depth of the specified descendant relative to the given
ancestor.
|
int |
getShareRelativeDepth(NodeId ancestorId,
ItemId descendantId)
Returns the depth of the specified share-descendant relative to the given
share-ancestor.
|
boolean |
isAncestor(NodeId nodeId,
ItemId itemId)
Determines whether the node with the specified
nodeId
is an ancestor of the item denoted by the given itemId . |
boolean |
isShareAncestor(NodeId ancestor,
NodeId descendant)
Determines whether the node with the specified
ancestor
is a share ancestor of the item denoted by the given descendant . |
NodeId |
resolveNodePath(Path path)
Resolves a path into a node id.
|
ItemId |
resolvePath(Path path)
Deprecated.
As of JSR 283, a
Path doesn't anymore uniquely
identify an Item , therefore resolveNodePath(Path) and
resolvePropertyPath(Path) should be used instead. |
PropertyId |
resolvePropertyPath(Path path)
Resolves a path into a property id.
|
ItemId resolvePath(Path path) throws RepositoryException
Path
doesn't anymore uniquely
identify an Item
, therefore resolveNodePath(Path)
and
resolvePropertyPath(Path)
should be used instead.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
.
path
- path to resolvepath
or null
if there's no item at path
.RepositoryException
- if an error occursNodeId resolveNodePath(Path path) throws RepositoryException
Note that, for performance reasons, this method returns null
rather than throwing a PathNotFoundException
if there's no
node to be found at path
.
path
- path to resolvepath
or null
if there's no node at path
.RepositoryException
- if an error occursPropertyId resolvePropertyPath(Path path) throws RepositoryException
Note that, for performance reasons, this method returns null
rather than throwing a PathNotFoundException
if there's no
property to be found at path
.
path
- path to resolvepath
or null
if there's no property at path
.RepositoryException
- if an error occursPath getPath(ItemId id) throws ItemNotFoundException, RepositoryException
id
- ItemNotFoundException
RepositoryException
Name getName(ItemId id) throws ItemNotFoundException, RepositoryException
id
- id of item whose name should be returnedItemNotFoundException
RepositoryException
Name getName(NodeId id, NodeId parentId) throws ItemNotFoundException, RepositoryException
getName(ItemId)
.id
- node idparentId
- parent node idItemNotFoundException
RepositoryException
int getDepth(ItemId id) throws ItemNotFoundException, RepositoryException
getPath(id).getAncestorCount()
. The depth reflects the
absolute hierarchy level.id
- item idItemNotFoundException
- if the specified id
does not
denote an existing item.RepositoryException
- if another error occursint getRelativeDepth(NodeId ancestorId, ItemId descendantId) throws ItemNotFoundException, RepositoryException
ancestorId
and descendantId
denote the same item 0 is returned. If ancestorId
does not
denote an ancestor -1 is returned.ancestorId
- ancestor iddescendantId
- descendant idancestorId
does not
denote an ancestor of the item denoted by descendantId
(or itself).ItemNotFoundException
- if either of the specified id's does not
denote an existing item.RepositoryException
- if another error occursboolean isAncestor(NodeId nodeId, ItemId itemId) throws ItemNotFoundException, RepositoryException
nodeId
is an ancestor of the item denoted by the given itemId
.
This is equivalent to
getPath(nodeId).isAncestorOf(getPath(itemId))
.nodeId
- node iditemId
- item idtrue
if the node with the specified
nodeId
is an ancestor of the item denoted by the
given itemId
; false
otherwiseItemNotFoundException
- if any of the specified id's does not
denote an existing item.RepositoryException
- if another error occursboolean isShareAncestor(NodeId ancestor, NodeId descendant) throws ItemNotFoundException, RepositoryException
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
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
.ancestor
- node iddescendant
- item idtrue
if the node denoted by ancestor
is a share ancestor of the item denoted by descendant
,
false
otherwiseItemNotFoundException
- if any of the specified id's does not
denote an existing item.RepositoryException
- if another error occursint getShareRelativeDepth(NodeId ancestorId, ItemId descendantId) throws ItemNotFoundException, RepositoryException
ancestor
and descendant
denote the same item, 0
is returned. If ancestor
does not denote an share-ancestor -1
is returned.ancestorId
- ancestor iddescendantId
- descendant id-1
if ancestor
does
not denote a share-ancestor of the item denoted by descendant
(or itself).ItemNotFoundException
- if either of the specified id's does not
denote an existing item.RepositoryException
- if another error occursCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.