Interface HierarchyTraversalSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session defines methods for traversing a hierarchy. Each node in
the hierarchy is a unique OSID Id . The hierarchy may be traversed
recursively to establish the tree structure through getParents()
and getChildren() . To relate these Ids to another OSID,
getNodes() can be used for retrievals that can be used for bulk
lookups in other OSIDs.
Any Id available in an associated OSID is known to this hierarchy. A
lookup up a particular Id in this hierarchy for the purposes of
establishing a starting point for traversal or determining relationships
should use the Id returned from the corresponding OSID object, not
an Id that has been stored, to avoid problems with Id translation
or aliasing.
A user may not be authorized to traverse the entire hierarchy. Parts
of the hierarchy may be made invisible through omission from the returns
of getParents() or getChildren() in lieu of a
PERMISSION_DENIED error that may disrupt the traversal through authorized
pathways.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can perform hierarchy queries.getChildren(Id id) Gets the children of the givenId.Gets the hierarchy associated with this session.Gets the hierarchyIdassociated with this session.Gets a portion of the hierarchy for the givenId.getParents(Id id) Gets the parents of the givenid.getRoots()Gets the root nodes of this hierarchy.booleanhasChildren(Id id) Tests if thisIdhas any children.booleanhasParents(Id id) Tests if thisIdcontains any parents.booleanisAncestor(Id id, Id ancestorId) Tests if anIdis an ancestor of another.booleanTests if a node is a direct child of another.booleanisDescendant(Id id, Id descendantId) Tests if a node is a descendant of another.booleanTests if anIdis a direct parent of another.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getHierarchyId
Id getHierarchyId()Gets the hierarchyIdassociated with this session.- Returns:
- the hierarchy
Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getHierarchy
Gets the hierarchy associated with this session.- Returns:
- the hierarchy associated with this session
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canAccessHierarchy
boolean canAccessHierarchy()Tests if this user can perform hierarchy queries. A return of true does not guarantee successful authorization. A return of false indicates that it is known all methods in this session will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations.- Returns:
falseif lookup methods are not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getRoots
Gets the root nodes of this hierarchy.- Returns:
- the root nodes
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
hasParents
boolean hasParents(Id id) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if thisIdcontains any parents.- Parameters:
id- theIdto query- Returns:
trueif thisIdcontains parents,falseotherwise- Throws:
NotFoundException-idis not foundNullArgumentException-idisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isParent
boolean isParent(Id id, Id parentId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis a direct parent of another.- Parameters:
id- theIdto queryparentId- theIdof a parent- Returns:
trueif thisparentIdis a parent ofid,falseotherwise- Throws:
NotFoundException-idis not foundNullArgumentException-idorparentIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code parentId} not found return {@code false} .
-
getParents
IdList getParents(Id id) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the parents of the givenid.- Parameters:
id- theIdto query- Returns:
- the parents of the
id - Throws:
NotFoundException-idis not foundNullArgumentException-idisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isAncestor
boolean isAncestor(Id id, Id ancestorId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis an ancestor of another.- Parameters:
id- theIdto queryancestorId- theIdof an ancestor- Returns:
trueif thisancestorIdis a parent ofid,falseotherwise- Throws:
NotFoundException-idis not foundNullArgumentException-idorancestorIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code ancestorId} not found return {@code false} .
-
hasChildren
boolean hasChildren(Id id) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if thisIdhas any children.- Parameters:
id- theIdto query- Returns:
trueif thisIdhas children,falseotherwise- Throws:
NotFoundException-idis not foundNullArgumentException-idisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isChild
boolean isChild(Id id, Id childId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if a node is a direct child of another.- Parameters:
id- theIdto querychildId- theIdof a child- Returns:
trueif thischildIdis a child of theId,falseotherwise- Throws:
NotFoundException-idis not foundNullArgumentException-idorchildIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code childId} not found return {@code false} .
-
getChildren
IdList getChildren(Id id) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the children of the givenId.- Parameters:
id- theIdto query- Returns:
- the children of the
id - Throws:
NotFoundException-idis not foundNullArgumentException-idisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isDescendant
boolean isDescendant(Id id, Id descendantId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if a node is a descendant of another.- Parameters:
id- theIdto querydescendantId- theIdof a descendant- Returns:
trueif thisdescendantIdis a child of theId,falseotherwise- Throws:
NotFoundException-idis not foundNullArgumentException-idordescendantisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- not found return {@code false} .
-
getNodes
Node getNodes(Id id, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a portion of the hierarchy for the givenId.- Parameters:
id- theIdto queryancestorLevels- the maximum number of ancestor levels to include. A value of 0 returns no parents in the node.descendantLevels- the maximum number of descendant levels to include. A value of 0 returns no children in the node.includeSiblings-trueto include the siblings of the given node,falseto omit the siblings- Returns:
- a node
- Throws:
NotFoundException-idis not foundNullArgumentException-idisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-