public interface SubjectHierarchySession extends OsidSession
This session defines methods for traversing a hierarchy of
Subject
objects. Each node in the hierarchy is a unique
Subject.
The hierarchy may be traversed recursively to establish
the tree structure through getSubjectNodes().
To relate
these Ids
to another OSID, getAncestorSubjects()
and getDescendantSubjects()
can be used for
retrievals that can be used for bulk lookups in other OSIDs. Any
Subject
available in the Ontology 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 getParentSubjects()
or getChildSubjects()
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 |
canAccessSubjectHierarchy()
Tests if this user can perform hierarchy queries.
|
IdList |
getChildSubjectIds(Id subjectId)
Gets the child
Ids of the given subject. |
SubjectList |
getChildSubjects(Id subjectId)
Gets the children of the given subject.
|
IdList |
getParentSubjectIds(Id subjectId)
Gets the parent Ids of the given subject.
|
SubjectList |
getParentSubjects(Id subjectId)
Gets the parents of the given subject.
|
IdList |
getRootSubjectIds()
Gets the root subject
Ids in this hierarchy. |
SubjectList |
getRootSubjects()
Gets the root subjects in this subject hierarchy.
|
Hierarchy |
getSubjectHierarchy()
Gets the hierarchy associated with this session.
|
Id |
getSubjectHierarchyId()
Gets the hierarchy
Id associated with this session. |
Node |
getSubjectNodeIds(Id subjectId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given subject.
|
SubjectNode |
getSubjectNodes(Id subjectId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given subject.
|
boolean |
hasChildSubjects(Id subjectId)
Tests if a subject has any children.
|
boolean |
hasParentSubjects(Id subjectId)
Tests if the
Subject has any parents. |
boolean |
isAncestorOfSubject(Id id,
Id subjectId)
Tests if an
Id is an ancestor of a subject. |
boolean |
isChildOfSubject(Id id,
Id subjectId)
Tests if a subject is a direct child of another.
|
boolean |
isDescendantOfSubject(Id id,
Id subjectId)
Tests if an
Id is a descendant of a subject. |
boolean |
isParentOfSubject(Id id,
Id subjectId)
Tests if an
Id is a direct parent of a subject. |
void |
useComparativeSubjectView()
The returns from the subject methods may omit or translate elements
based on this session, such as authorization, and not result in an
error.
|
void |
usePlenarySubjectView()
A complete view of the
Hierarchy returns is desired. |
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getSubjectHierarchyId()
Id
associated with this session. Id
associated with this sessionmandatory
- This method must be implemented. Hierarchy getSubjectHierarchy() throws OperationFailedException, PermissionDeniedException
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canAccessSubjectHierarchy()
PERMISSION_DENIED.
This is intended as a hint to an
application that may opt not to offer traversal operations. false
if hierarchy traversal methods are not
authorized, true
otherwisemandatory
- This method must be implemented. void useComparativeSubjectView()
mandatory
- This method is must be implemented. void usePlenarySubjectView()
Hierarchy
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 getRootSubjectIds() throws OperationFailedException, PermissionDeniedException
Ids
in this hierarchy. Ids
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. SubjectList getRootSubjects() throws OperationFailedException, PermissionDeniedException
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method is must be implemented. boolean hasParentSubjects(Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Subject
has any parents.subjectId
- the Id
of a subject true
if the subject has parents, false
otherwiseNotFoundException
- subjectId
is not
foundNullArgumentException
- subjectId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isParentOfSubject(Id id, Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is a direct parent of a subject.id
- an Id
subjectId
- the Id
of a subject true
if this id
is a parent of
subjectId,
false
otherwiseNotFoundException
- subjectId
is not
foundNullArgumentException
- id
or
subjectId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
IdList getParentSubjectIds(Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
subjectId
- the Id
of a subject Ids
of the subjectNotFoundException
- subjectId
is not
foundNullArgumentException
- subjectId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. SubjectList getParentSubjects(Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
subjectId
- the Id
of a subjectNotFoundException
- subjectId
is not
foundNullArgumentException
- subjectId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isAncestorOfSubject(Id id, Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is an ancestor of a subject.id
- an Id
subjectId
- the Id
of a subject true
if this id
is an ancestor
of subjectId,
false
otherwiseNotFoundException
- subjectId
is not
foundNullArgumentException
- id
or
subjectId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
boolean hasChildSubjects(Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
subjectId
- the Id
of a subject true
if the subjectId
has
children, false
otherwiseNotFoundException
- subjectId
is not
foundNullArgumentException
- subjectId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isChildOfSubject(Id id, Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
id
- an Id
subjectId
- the Id
of a subject true
if the id
is a child of
subjectId,
false
otherwiseNotFoundException
- subjectId
is not
foundNullArgumentException
- id
or
subjectId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
IdList getChildSubjectIds(Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ids
of the given subject.subjectId
- the Id
to queryNotFoundException
- subjectId
is not
foundNullArgumentException
- subjectId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. SubjectList getChildSubjects(Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
subjectId
- the Id
to queryNotFoundException
- subjectId
is not
foundNullArgumentException
- subjectId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isDescendantOfSubject(Id id, Id subjectId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is a descendant of a subject.id
- an Id
subjectId
- the Id
of a subject true
if the id
is a descendant
of the subjectId,
false
otherwiseNotFoundException
- subjectId
is not
foundNullArgumentException
- id
or
subjectId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
is not found return false.
Node getSubjectNodeIds(Id subjectId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
subjectId
- 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
- subjectId
is not
foundNullArgumentException
- subjectId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. SubjectNode getSubjectNodes(Id subjectId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
subjectId
- 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
- subjectId
is not
foundNullArgumentException
- subjectId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.