Interface TermHierarchySession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session defines methods for traversing a hierarchy of
Terms . Each term in the hierarchy is a unique Term . The
hierarchy may be traversed recursively to establish the tree structure
through getParentTerms() and getChildTerms() . To relate
these Ids to another OSID, getTermNodes() can be used for
retrievals that can be used for bulk lookups in other OSIDs. Any
Term available in the Course OSID is known to this hierarchy but does not
appear in the hierarchy traversal until added as a root node or a child of
another node.
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 getParentTerms() or getChildTerms() in lieu of a
PERMISSION_DENIED error that may disrupt the traversal through authorized
pathways.
This session defines views that offer differing behaviors when retrieving multiple objects.
- comparative view: term elements may be silently omitted or re-ordered
- plenary view: provides a complete set or is an error condition
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can perform hierarchy queries.getChildTermIds(Id termId) Gets the childIdsof the given term.getChildTerms(Id termId) Gets the children of the given term.getParentTermIds(Id termId) Gets the parentIdsof the given term.getParentTerms(Id termId) Gets the parents of the given term.Gets the root termIdsin this hierarchy.Gets the root terms in the term hierarchy.Gets the hierarchy associated with this session.Gets the hierarchyIdassociated with this session.getTermNodeIds(Id termId, long ancestorLevels, long descendantLevels, boolean includeSiblings) Gets a portion of the hierarchy for the given term.getTermNodes(Id termId, long ancestorLevels, long descendantLevels, boolean includeSiblings) Gets a portion of the hierarchy for the given term.booleanhasChildTerms(Id termId) Tests if a term has any children.booleanhasParentTerms(Id termId) Tests if theTermhas any parents.booleanisAncestorOfTerm(Id id, Id termId) Tests if anIdis an ancestor of a term.booleanisChildOfTerm(Id id, Id termId) Tests if a node is a direct child of another.booleanisDescendantOfTerm(Id id, Id termId) Tests if anIdis a descendant of a term.booleanisParentOfTerm(Id id, Id termId) Tests if anIdis a direct parent of term.voidThe returns from the term methods may omit or translate elements based on this session, such as authorization, and not result in an error.voidA complete view of theTermsreturns is desired.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
-
getTermHierarchyId
Id getTermHierarchyId()Gets the hierarchyIdassociated with this session.- Returns:
- the hierarchy
Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getTermHierarchy
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.
-
canAccessTermHierarchy
boolean canAccessTermHierarchy()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 hierarchy traversal methods are not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
useComparativeTermView
void useComparativeTermView()The returns from the term methods may omit or translate elements based on this session, such as authorization, and not result in an error. This view is used when greater interoperability is desired at the expense of precision.- Compliance:
mandatory- This method is must be implemented.
-
usePlenaryTermView
void usePlenaryTermView()A complete view of theTermsreturns is desired. Methods will return what is requested or result in an error. This view is used when greater precision is desired at the expense of interoperability.- Compliance:
mandatory- This method is must be implemented.
-
getRootTermIds
Gets the root termIdsin this hierarchy.- Returns:
- the root term
Ids - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getRootTerms
Gets the root terms in the term hierarchy. A node with no parents is an orphan. While all termIdsare known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root node or child of another node.- Returns:
- the root terms
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method is must be implemented.
-
hasParentTerms
boolean hasParentTerms(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if theTermhas any parents.- Parameters:
termId- a termId- Returns:
trueif the term has parents,falseotherwise- Throws:
NotFoundException-termIdis not foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isParentOfTerm
boolean isParentOfTerm(Id id, Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis a direct parent of term.- Parameters:
id- anIdtermId- theIdof a term- Returns:
trueif thisidis a parent oftermId,falseotherwise- Throws:
NotFoundException-termIdis not foundNullArgumentException-idortermIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
getParentTermIds
IdList getParentTermIds(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the parentIdsof the given term.- Parameters:
termId- a termId- Returns:
- the parent
Idsof the term - Throws:
NotFoundException-termIdis not foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getParentTerms
TermList getParentTerms(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the parents of the given term.- Parameters:
termId- theIdto query- Returns:
- the parents of the term
- Throws:
NotFoundException-termIdnot foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isAncestorOfTerm
boolean isAncestorOfTerm(Id id, Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis an ancestor of a term.- Parameters:
id- anIdtermId- theIdof a term- Returns:
trueif thisidis an ancestor oftermId,falseotherwise- Throws:
NotFoundException-termIdnot foundNullArgumentException-idortermIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
hasChildTerms
boolean hasChildTerms(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if a term has any children.- Parameters:
termId- a termId- Returns:
trueif thetermIdhas children,falseotherwise- Throws:
NotFoundException-termIdnot foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isChildOfTerm
boolean isChildOfTerm(Id id, Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if a node is a direct child of another.- Parameters:
id- anIdtermId- theIdof a term- Returns:
trueif theidis a child oftermId,falseotherwise- Throws:
NotFoundException-termIdnot foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
getChildTermIds
IdList getChildTermIds(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the childIdsof the given term.- Parameters:
termId- a termId- Returns:
- the child
Idsof the term - Throws:
NotFoundException-termIdis not foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getChildTerms
TermList getChildTerms(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the children of the given term.- Parameters:
termId- theIdto query- Returns:
- the children of the term
- Throws:
NotFoundException-termIdnot foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isDescendantOfTerm
boolean isDescendantOfTerm(Id id, Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis a descendant of a term.- Parameters:
id- anIdtermId- theIdof a term- Returns:
trueif theidis a descendant of thetermId,falseotherwise- Throws:
NotFoundException-termIdnot foundNullArgumentException-termIdoridisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} is not found return {@code false} .
-
getTermNodeIds
Node getTermNodeIds(Id termId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a portion of the hierarchy for the given term.- Parameters:
termId- 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 term node
- Throws:
NotFoundException-termIdnot foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getTermNodes
TermNode getTermNodes(Id termId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a portion of the hierarchy for the given term.- Parameters:
termId- 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 term node
- Throws:
NotFoundException-termIdnot foundNullArgumentException-termIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-