OSID Logo
OSID Specifications
hierarchy package
Version 3.0.0
Release Candidate Preview
Interfaceosid.hierarchy.HierarchyTraversalSession
Implementsosid.OsidSession
Description

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.

MethodgetHierarchyId
Description

Gets the hierarchy Id associated with this session.

Returnosid.id.Idthe hierarchy Id associated with this session
CompliancemandatoryThis method must be implemented.
MethodgetHierarchy
Description

Gets the hierarchy associated with this session.

Returnosid.hierarchy.Hierarchythe hierarchy associated with this session
ErrorsOPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodcanAccessHierarchy
Description

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 a PERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer lookup operations.

Returnboolean false if lookup methods are not authorized, true otherwise
CompliancemandatoryThis method must be implemented.
MethodgetRoots
Description

Gets the root nodes of this hierarchy.

Returnosid.id.IdListthe root nodes
ErrorsOPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodhasParents
Description

Tests if this Id contains any parents.

Parametersosid.id.Ididthe Id to query
Returnboolean true if this Id contains parents, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodisParent
Description

Tests if an Id is a direct parent of another.

Parametersosid.id.Ididthe Id to query
osid.id.IdparentIdthe Id of a parent
Returnboolean true if this parentId is a parent of id, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id or parentId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
Provider Notes

If parentId not found return false.

MethodgetParents
Description

Gets the parents of the given id.

Parametersosid.id.Ididthe Id to query
Returnosid.id.IdListthe parents of the id
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodisAncestor
Description

Tests if an Id is an ancestor of another.

Parametersosid.id.Ididthe Id to query
osid.id.IdancestorIdthe Id of an ancestor
Returnboolean true if this ancestorId is a parent of id, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id or ancestorId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
Provider Notes

If ancestorId not found return false.

MethodhasChildren
Description

Tests if this Id has any children.

Parametersosid.id.Ididthe Id to query
Returnboolean true if this Id has children, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodisChild
Description

Tests if a node is a direct child of another.

Parametersosid.id.Ididthe Id to query
osid.id.IdchildIdthe Id of a child
Returnboolean true if this childId is a child of the Id, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id or childId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
Provider Notes

If childId not found return false.

MethodgetChildren
Description

Gets the children of the given Id.

Parametersosid.id.Ididthe Id to query
Returnosid.id.IdListthe children of the id
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodisDescendant
Description

Tests if a node is a descendant of another.

Parametersosid.id.Ididthe Id to query
osid.id.IddescendantIdthe Id of a descendant
Returnboolean true if this descendantId is a child of the Id, false otherwise
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id or descendant is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
Provider Notes

If not found return false.

MethodgetNodes
Description

Gets a portion of the hierarchy for the given Id.

Parametersosid.id.Ididthe Id to query
cardinalancestorLevelsthe maximum number of ancestor levels to include. A value of 0 returns no parents in the node.
cardinaldescendantLevelsthe maximum number of descendant levels to include. A value of 0 returns no children in the node.
booleanincludeSiblings true to include the siblings of the given node, false to omit the siblings
Returnosid.hierarchy.Nodea node
ErrorsNOT_FOUND id is not found
NULL_ARGUMENT id is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.