public interface UtilityHierarchySession extends OsidSession
This session defines methods for traversing a hierarchy of
Utility
objects. Each node in the hierarchy is a unique
Utility.
The hierarchy may be traversed recursively to establish
the tree structure through getParentUtilities()
and
getChildUtilities().
To relate these Ids
to another
OSID, getUtilityNodes()
can be used for retrievals that can
be used for bulk lookups in other OSIDs. Any Utility
available in the Utility 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 getParentUtilities()
or getChildUtilities()
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 |
canAccessUtilityHierarchy()
Tests if this user can perform hierarchy queries.
|
UtilityList |
getChildUtilities(Id utilityId)
Gets the child utilities of the given
id. |
IdList |
getChildUtilityIds(Id utilityId)
Gets the child
Ids of the given utility. |
UtilityList |
getParentUtilities(Id utilityId)
Gets the parent utilities of the given
id. |
IdList |
getParentUtilityIds(Id utilityId)
Gets the parent
Ids of the given utility. |
UtilityList |
getRootUtilities()
Gets the root utilities in the utility hierarchy.
|
IdList |
getRootUtilityIds()
Gets the root utility
Ids in this hierarchy. |
Hierarchy |
getUtilityHierarchy()
Gets the hierarchy associated with this session.
|
Id |
getUtilityHierarchyId()
Gets the hierarchy
Id associated with this session. |
Node |
getUtilityNodeIds(Id utilityId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given utility.
|
UtilityNode |
getUtilityNodes(Id utilityId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given utility.
|
boolean |
hasChildUtilities(Id utilityId)
Tests if a utility has any children.
|
boolean |
hasParentUtilities(Id utilityId)
Tests if the
Utility has any parents. |
boolean |
isAncestorOfUtility(Id id,
Id utilityId)
Tests if an
Id is an ancestor of a utility. |
boolean |
isChildOfUtility(Id id,
Id utilityId)
Tests if a utility is a direct child of another.
|
boolean |
isDescendantOfUtility(Id id,
Id utilityId)
Tests if an
Id is a descendant of a utility. |
boolean |
isParentOfUtility(Id id,
Id utilityId)
Tests if an
Id is a direct parent of a utility. |
void |
useComparativeUtilityView()
The returns from the utility methods may omit or translate elements
based on this session, such as authorization, and not result in an
error.
|
void |
usePlenaryUtilityView()
A complete view of the
Utility returns is desired. |
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getUtilityHierarchyId()
Id
associated with this session. Id
associated with this sessionmandatory
- This method must be implemented. Hierarchy getUtilityHierarchy() throws OperationFailedException, PermissionDeniedException
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canAccessUtilityHierarchy()
PERMISSION_DENIED.
This is intended as a hint to an
an application that may not offer hierrachy traversal operations to
unauthorized users. false
if hierarchy traversal methods are not
authorized, true
otherwisemandatory
- This method must be implemented. void useComparativeUtilityView()
mandatory
- This method is must be implemented. void usePlenaryUtilityView()
Utility
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 getRootUtilityIds() throws OperationFailedException, PermissionDeniedException
Ids
in this hierarchy. Ids
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. UtilityList getRootUtilities() 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 hasParentUtilities(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Utility
has any parents.utilityId
- the Id
of a utility true
if the utility has parents, false
otherwiseNotFoundException
- utilityId
is not
foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isParentOfUtility(Id id, Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is a direct parent of a utility.id
- an Id
utilityId
- the Id
of a utility true
if this id
is a parent of
utilityId,
false
otherwiseNotFoundException
- utilityId
is not
foundNullArgumentException
- id
or
utilityId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
IdList getParentUtilityIds(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ids
of the given utility.utilityId
- the Id
of a utility Ids
of the utilityNotFoundException
- utilityId
is not
foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. UtilityList getParentUtilities(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
id.
utilityId
- the Id
of the Utility
to query id
NotFoundException
- a Utility
identified
by Id is
not foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isAncestorOfUtility(Id id, Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is an ancestor of a utility.id
- an Id
utilityId
- the Id
of a utility true
if this id
is an ancestor
of utility,
false
otherwiseNotFoundException
- utilityId
is not
foundNullArgumentException
- id
or
utilityId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
boolean hasChildUtilities(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
utilityId
- the Id
of a utility true
if the utilityId
has
children, false
otherwiseNotFoundException
- utilityId
is not
foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isChildOfUtility(Id id, Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
id
- an Id
utilityId
- the Id
of a utility true
if the id
is a child of
utilityId,
false
otherwiseNotFoundException
- utilityId
is not
foundNullArgumentException
- id
or
utilityId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
not found return false.
IdList getChildUtilityIds(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ids
of the given utility.utilityId
- the Id
to queryNotFoundException
- utilityId
is not
foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. UtilityList getChildUtilities(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
id.
utilityId
- the Id
of the Utility
to query id
NotFoundException
- a Utility
identified
by Id is
not foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean isDescendantOfUtility(Id id, Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id
is a descendant of a utility.id
- an Id
utilityId
- the Id
of a utility true
if the id
is a descendant
of the utilityId,
false
otherwiseNotFoundException
- utilityId
is not
foundNullArgumentException
- id
or
utilityId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. If
- id
is not found return false.
Node getUtilityNodeIds(Id utilityId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
utilityId
- 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
- utilityId
is not
foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. UtilityNode getUtilityNodes(Id utilityId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
utilityId
- 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
- utilityId
is not
foundNullArgumentException
- utilityId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.