public interface TermHierarchySession extends OsidSession
This session defines methods for traversing a hierarchy of Term
objects. 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.
Modifier and Type | Method and Description |
---|---|
boolean |
canAccessTermHierarchy()
Tests if this user can perform hierarchy queries.
|
IdList |
getChildTermIds(Id termId)
Gets the child
Ids of the given term. |
TermList |
getChildTerms(Id termId)
Gets the children of the given term.
|
IdList |
getParentTermIds(Id termId)
Gets the parent
Ids of the given term. |
TermList |
getParentTerms(Id termId)
Gets the parents of the given term.
|
IdList |
getRootTermIds()
Gets the root term
Ids in this hierarchy. |
TermList |
getRootTerms()
Gets the root terms in the term hierarchy.
|
Hierarchy |
getTermHierarchy()
Gets the hierarchy associated with this session.
|
Id |
getTermHierarchyId()
Gets the hierarchy
Id associated with this session. |
Node |
getTermNodeIds(Id termId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given term.
|
TermNode |
getTermNodes(Id termId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given term.
|
boolean |
hasChildTerms(Id termId)
Tests if a term has any children.
|
boolean |
hasParentTerms(Id termId)
Tests if the
Term has any parents. |
boolean |
isAncestorOfTerm(Id id,
Id termId)
Tests if an
Id is an ancestor of a term. |
boolean |
isChildOfTerm(Id id,
Id termId)
Tests if a node is a direct child of another.
|
boolean |
isDescendantOfTerm(Id id,
Id termId)
Tests if an
Id is a descendant of a term. |
boolean |
isParentOfTerm(Id id,
Id termId)
Tests if an
Id is a direct parent of term. |
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.
|
void |
usePlenaryTermView()
A complete view of the
Terms returns is desired. |
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getTermHierarchyId()
Id
associated with this session. Id
associated with this sessionmandatory
- This method must be implemented. Hierarchy getTermHierarchy() throws OperationFailedException, PermissionDeniedException
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canAccessTermHierarchy()
PERMISSION_DENIED.
This is intended as a hint to an
application that may opt not to offer lookup operations. false
if hierarchy traversal methods are not
authorized, true
otherwisemandatory
- This method must be implemented. void useComparativeTermView()
mandatory
- This method is must be implemented. void usePlenaryTermView()
Terms
returns 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.mandatory
- This method is must be implemented. IdList getRootTermIds() throws OperationFailedException, PermissionDeniedException
Ids
in this hierarchy. Ids
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. TermList getRootTerms() throws OperationFailedException, PermissionDeniedException
Ids
are known to the
hierarchy, an orphan does not appear in the hierarchy unless
explicitly added as a root node or child of another node.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method is must be implemented. boolean hasParentTerms(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Term
has any parents.termId
- a term Id
true
if the term has parents, false
otherwiseNotFoundException
- termId
is not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isParentOfTerm(Id id, Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is a direct parent of term.id
- an Id
termId
- the Id
of a term true
if this id
is a parent of
termId,
false
otherwiseNotFoundException
- termId
is not foundNullArgumentException
- id
or
termId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
IdList getParentTermIds(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ids
of the given term.termId
- a term Id
Ids
of the termNotFoundException
- termId
is not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. TermList getParentTerms(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
termId
- the Id
to queryNotFoundException
- termId
not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isAncestorOfTerm(Id id, Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is an ancestor of a term.id
- an Id
termId
- the Id
of a term true
if this id
is an ancestor
of termId,
false
otherwiseNotFoundException
- termId
not foundNullArgumentException
- id
or
termId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
boolean hasChildTerms(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
termId
- a term Id
true
if the termId
has children,
false
otherwiseNotFoundException
- termId
not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isChildOfTerm(Id id, Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
id
- an Id
termId
- the Id
of a term true
if the id
is a child of
termId,
false
otherwiseNotFoundException
- termId
not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
IdList getChildTermIds(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ids
of the given term.termId
- a term Id
Ids
of the termNotFoundException
- termId
is not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. TermList getChildTerms(Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
termId
- the Id
to queryNotFoundException
- termId
not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isDescendantOfTerm(Id id, Id termId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is a descendant of a term.id
- an Id
termId
- the Id
of a term true
if the id
is a descendant
of the termId,
false
otherwiseNotFoundException
- termId
not foundNullArgumentException
- termId
or
id
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
is not found return false.
Node getTermNodeIds(Id termId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
termId
- the Id
to 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
- true
to include the siblings of
the given node, false
to omit the siblingsNotFoundException
- termId
not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. TermNode getTermNodes(Id termId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
termId
- the Id
to 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
- true
to include the siblings of
the given node, false
to omit the siblingsNotFoundException
- termId
not foundNullArgumentException
- termId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.