Interface UtilityHierarchySession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, 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.
- comparative view: utility 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.getChildUtilities(Id utilityId) Gets the child utilities of the givenid.getChildUtilityIds(Id utilityId) Gets the childIdsof the given utility.getParentUtilities(Id utilityId) Gets the parent utilities of the givenid.getParentUtilityIds(Id utilityId) Gets the parentIdsof the given utility.Gets the root utilities in the utility hierarchy.Gets the root utilityIdsin this hierarchy.Gets the hierarchy associated with this session.Gets the hierarchyIdassociated with this session.getUtilityNodeIds(Id utilityId, long ancestorLevels, long descendantLevels, boolean includeSiblings) Gets a portion of the hierarchy for the given utility.getUtilityNodes(Id utilityId, long ancestorLevels, long descendantLevels, boolean includeSiblings) Gets a portion of the hierarchy for the given utility.booleanhasChildUtilities(Id utilityId) Tests if a utility has any children.booleanhasParentUtilities(Id utilityId) Tests if theUtilityhas any parents.booleanisAncestorOfUtility(Id id, Id utilityId) Tests if anIdis an ancestor of a utility.booleanisChildOfUtility(Id id, Id utilityId) Tests if a utility is a direct child of another.booleanisDescendantOfUtility(Id id, Id utilityId) Tests if anIdis a descendant of a utility.booleanisParentOfUtility(Id id, Id utilityId) Tests if anIdis a direct parent of a utility.voidThe returns from the utility methods may omit or translate elements based on this session, such as authorization, and not result in an error.voidA complete view of theUtilityreturns 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
-
getUtilityHierarchyId
Id getUtilityHierarchyId()Gets the hierarchyIdassociated with this session.- Returns:
- the hierarchy
Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getUtilityHierarchy
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.
-
canAccessUtilityHierarchy
boolean canAccessUtilityHierarchy()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 an application that may not offer hierrachy traversal operations to unauthorized users.- Returns:
falseif hierarchy traversal methods are not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
useComparativeUtilityView
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. This view is used when greater interoperability is desired at the expense of precision.- Compliance:
mandatory- This method is must be implemented.
-
usePlenaryUtilityView
void usePlenaryUtilityView()A complete view of theUtilityreturns 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.
-
getRootUtilityIds
Gets the root utilityIdsin this hierarchy.- Returns:
- the root utility
Ids - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getRootUtilities
Gets the root utilities in the utility hierarchy. A node with no parents is an orphan. While all utilityIdsare 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 utilities
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method is must be implemented.
-
hasParentUtilities
boolean hasParentUtilities(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if theUtilityhas any parents.- Parameters:
utilityId- theIdof a utility- Returns:
trueif the utility has parents,falseotherwise- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-utilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isParentOfUtility
boolean isParentOfUtility(Id id, Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis a direct parent of a utility.- Parameters:
id- anIdutilityId- theIdof a utility- Returns:
trueif thisidis a parent ofutilityId,falseotherwise- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-idorutilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
getParentUtilityIds
IdList getParentUtilityIds(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the parentIdsof the given utility.- Parameters:
utilityId- theIdof a utility- Returns:
- the parent
Idsof the utility - Throws:
NotFoundException-utilityIdis not foundNullArgumentException-utilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getParentUtilities
UtilityList getParentUtilities(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the parent utilities of the givenid.- Parameters:
utilityId- theIdof theUtilityto query- Returns:
- the parent utilities of the
id - Throws:
NotFoundException- aUtilityidentified byId isnot foundNullArgumentException-utilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isAncestorOfUtility
boolean isAncestorOfUtility(Id id, Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis an ancestor of a utility.- Parameters:
id- anIdutilityId- theIdof a utility- Returns:
trueif thisidis an ancestor ofutility,falseotherwise- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-idorutilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
hasChildUtilities
boolean hasChildUtilities(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if a utility has any children.- Parameters:
utilityId- theIdof a utility- Returns:
trueif theutilityIdhas children,falseotherwise- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-utilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isChildOfUtility
boolean isChildOfUtility(Id id, Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if a utility is a direct child of another.- Parameters:
id- anIdutilityId- theIdof a utility- Returns:
trueif theidis a child ofutilityId,falseotherwise- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-idorutilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
getChildUtilityIds
IdList getChildUtilityIds(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the childIdsof the given utility.- Parameters:
utilityId- theIdto query- Returns:
- the children of the utility
- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-utilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getChildUtilities
UtilityList getChildUtilities(Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the child utilities of the givenid.- Parameters:
utilityId- theIdof theUtilityto query- Returns:
- the child utilities of the
id - Throws:
NotFoundException- aUtilityidentified byId isnot foundNullArgumentException-utilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isDescendantOfUtility
boolean isDescendantOfUtility(Id id, Id utilityId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis a descendant of a utility.- Parameters:
id- anIdutilityId- theIdof a utility- Returns:
trueif theidis a descendant of theutilityId,falseotherwise- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-idorutilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} is not found return {@code false} .
-
getUtilityNodeIds
Node getUtilityNodeIds(Id utilityId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a portion of the hierarchy for the given utility.- Parameters:
utilityId- 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 utility node
- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-utilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getUtilityNodes
UtilityNode getUtilityNodes(Id utilityId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a portion of the hierarchy for the given utility.- Parameters:
utilityId- 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 utility node
- Throws:
NotFoundException-utilityIdis not foundNullArgumentException-utilityIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-