Package org.apache.jackrabbit.core
Interface HierarchyManager
-
- All Known Implementing Classes:
CachingHierarchyManager
,HierarchyManagerImpl
,ZombieHierarchyManager
public interface HierarchyManager
TheHierarchyManager
interface ...
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description int
getDepth(ItemId id)
Returns the depth of the specified item which is equivalent togetPath(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 specifiednodeId
is an ancestor of the item denoted by the givenitemId
.boolean
isShareAncestor(NodeId ancestor, NodeId descendant)
Determines whether the node with the specifiedancestor
is a share ancestor of the item denoted by the givendescendant
.NodeId
resolveNodePath(Path path)
Resolves a path into a node id.ItemId
resolvePath(Path path)
Deprecated.As of JSR 283, aPath
doesn't anymore uniquely identify anItem
, thereforeresolveNodePath(Path)
andresolvePropertyPath(Path)
should be used instead.PropertyId
resolvePropertyPath(Path path)
Resolves a path into a property id.
-
-
-
Method Detail
-
resolvePath
ItemId resolvePath(Path path) throws RepositoryException
Deprecated.As of JSR 283, aPath
doesn't anymore uniquely identify anItem
, thereforeresolveNodePath(Path)
andresolvePropertyPath(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 aPathNotFoundException
if there's no item to be found atpath
.- Parameters:
path
- path to resolve- Returns:
- item id referred to by
path
ornull
if there's no item atpath
. - 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 aPathNotFoundException
if there's no node to be found atpath
.- Parameters:
path
- path to resolve- Returns:
- node id referred to by
path
ornull
if there's no node atpath
. - 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 aPathNotFoundException
if there's no property to be found atpath
.- Parameters:
path
- path to resolve- Returns:
- property id referred to by
path
ornull
if there's no property atpath
. - Throws:
RepositoryException
- if an error occurs
-
getPath
Path getPath(ItemId id) throws ItemNotFoundException, RepositoryException
Returns the path to the given item.- Parameters:
id
-- Returns:
- Throws:
ItemNotFoundException
RepositoryException
-
getName
Name getName(ItemId id) throws ItemNotFoundException, RepositoryException
Returns the name of the specified item.- Parameters:
id
- id of item whose name should be returned- Returns:
- Throws:
ItemNotFoundException
RepositoryException
-
getName
Name getName(NodeId id, NodeId parentId) throws ItemNotFoundException, RepositoryException
Returns the name of the specified item, with the given parent id. If the given item is not shareable, this is identical togetName(ItemId)
.- Parameters:
id
- node idparentId
- parent node id- Returns:
- name
- Throws:
ItemNotFoundException
RepositoryException
-
getDepth
int getDepth(ItemId id) throws ItemNotFoundException, RepositoryException
Returns the depth of the specified item which is equivalent togetPath(id).getAncestorCount()
. The depth reflects the absolute hierarchy level.- Parameters:
id
- item id- Returns:
- the depth of the specified item
- Throws:
ItemNotFoundException
- if the specifiedid
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. IfancestorId
anddescendantId
denote the same item 0 is returned. IfancestorId
does not denote an ancestor -1 is returned.- Parameters:
ancestorId
- ancestor iddescendantId
- descendant id- Returns:
- the relative depth; -1 if
ancestorId
does not denote an ancestor of the item denoted bydescendantId
(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 specifiednodeId
is an ancestor of the item denoted by the givenitemId
. This is equivalent togetPath(nodeId).isAncestorOf(getPath(itemId))
.- Parameters:
nodeId
- node iditemId
- item id- Returns:
true
if the node with the specifiednodeId
is an ancestor of the item denoted by the givenitemId
;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 specifiedancestor
is a share ancestor of the item denoted by the givendescendant
. This istrue
for two nodesA
,B
if either:A
is a (proper) ancestor ofB
- there is a non-empty sequence of nodes
N1
,... ,Nk
such thatA
=N1
andB
=Nk
andNi
is the parent or a share-parent ofNi+1
(for everyi
in1
...k-1
.
- Parameters:
ancestor
- node iddescendant
- item id- Returns:
true
if the node denoted byancestor
is a share ancestor of the item denoted bydescendant
,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. Ifancestor
anddescendant
denote the same item,0
is returned. Ifancestor
does not denote an share-ancestor-1
is returned.- Parameters:
ancestorId
- ancestor iddescendantId
- descendant id- Returns:
- the relative depth;
-1
ifancestor
does not denote a share-ancestor of the item denoted bydescendant
(or itself). - Throws:
ItemNotFoundException
- if either of the specified id's does not denote an existing item.RepositoryException
- if another error occurs
-
-