Interface LocationHierarchySession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
This session defines methods for traversing a hierarchy of
Locations . Each node in the hierarchy is a unique Location . The
hierarchy may be traversed recursively to establish the tree structure
through getParentLocations() and getChildLocations() . To
relate these Ids to another OSID, getLocationNodes() can
be used for retrievals that can be used for bulk lookups in other OSIDs.
Any Location available in the Mapping OSID is known to this
hierarchy but does not appear in the hierarchy traversal until added as a
root location or a child of another location.
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 getParentMLocations() or getChildLocations() 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 location view: location elements may be silently omitted or re-ordered
- plenary location view: provides a complete set or is an error condition
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTests if this user can perform hierarchy queries.getChildLocationIds(Id locationId) Gets the childIdsof the given location.getChildLocations(Id locationId) Gets the children of the given location.Gets the hierarchy associated with this session.Gets the hierarchyIdassociated with this session.getLocationNodeIds(Id locationId, long ancestorLevels, long descendantLevels, boolean includeSiblings) Gets a portion of the hierarchy for the given location.getLocationNodes(Id locationId, long ancestorLevels, long descendantLevels, boolean includeSiblings) Gets a portion of the hierarchy for the given location.getParentLocationIds(Id locationId) Gets the parentIdsof the given location.getParentLocations(Id locationId) Gets the parents of the given location.Gets the root locationIdsin this hierarchy.Gets the root location in the location hierarchy.booleanhasChildLocations(Id locationId) Tests if a location has any children.booleanhasParentLocations(Id locationId) Tests if theLocationhas any parents.booleanisAncestorOfLocation(Id id, Id locationId) Tests if anIdis an ancestor of a location.booleanisChildOfLocation(Id id, Id locationId) Tests if a location is a direct child of another.booleanisDescendantOfLocation(Id id, Id locationId) Tests if anIdis a descendant of a location.booleanisParentOfLocation(Id id, Id locationId) Tests if anIdis a direct parent of location.voidThe returns from the location methods may omit or translate elements based on this session, such as authorization, and not result in an error.voidA complete view of theLocationsreturns 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
-
getLocationHierarchyId
Id getLocationHierarchyId()Gets the hierarchyIdassociated with this session.- Returns:
- the hierarchy
Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getLocationHierarchy
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.
-
canAccessLocationHierarchy
boolean canAccessLocationHierarchy()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.
-
useComparativeLocationView
void useComparativeLocationView()The returns from the location 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.
-
usePlenaryLocationView
void usePlenaryLocationView()A complete view of theLocationsreturns 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.
-
getRootLocationIds
Gets the root locationIdsin this hierarchy.- Returns:
- the root location
Ids - Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getRootLocations
Gets the root location in the location hierarchy. A location with no parents is an orphan. While all locationIdsare known to the hierarchy, an orphan does not appear in the hierarchy unless explicitly added as a root location or child of another location.- Returns:
- the root locations
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method is must be implemented.
-
hasParentLocations
boolean hasParentLocations(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if theLocationhas any parents.- Parameters:
locationId- a locationId- Returns:
trueif the location has parents, falseotherwise- Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isParentOfLocation
boolean isParentOfLocation(Id id, Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis a direct parent of location.- Parameters:
id- anIdlocationId- theIdof a location- Returns:
trueif thisidis a parent oflocationId, falseotherwise- Throws:
NotFoundException-locationIdis not foundNullArgumentException-idorlocationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
getParentLocationIds
IdList getParentLocationIds(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the parentIdsof the given location.- Parameters:
locationId- a locationId- Returns:
- the parent
Idsof the location - Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getParentLocations
LocationList getParentLocations(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the parents of the given location.- Parameters:
locationId- a locationId- Returns:
- the parents of the location
- Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isAncestorOfLocation
boolean isAncestorOfLocation(Id id, Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis an ancestor of a location.- Parameters:
id- anIdlocationId- theIdof a location- Returns:
trueif thisidis an ancestor oflocationId,falseotherwise- Throws:
NotFoundException-locationIdis not foundNullArgumentException-idorlocationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
hasChildLocations
boolean hasChildLocations(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if a location has any children.- Parameters:
locationId- a locationId- Returns:
trueif thelocationIdhas children,falseotherwise- Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isChildOfLocation
boolean isChildOfLocation(Id id, Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if a location is a direct child of another.- Parameters:
id- anIdlocationId- a locationId- Returns:
trueif theidis a child oflocationId,falseotherwise- Throws:
NotFoundException-locationIdis not foundNullArgumentException-idorlocationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} not found return {@code false} .
-
getChildLocationIds
IdList getChildLocationIds(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the childIdsof the given location.- Parameters:
locationId- a locationId- Returns:
- the children of the location
- Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getChildLocations
LocationList getChildLocations(Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the children of the given location.- Parameters:
locationId- a locationId- Returns:
- the children of the location
- Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
isDescendantOfLocation
boolean isDescendantOfLocation(Id id, Id locationId) throws NotFoundException, OperationFailedException, PermissionDeniedException Tests if anIdis a descendant of a location.- Parameters:
id- anIdlocationId- theIdof a location- Returns:
trueif theidis a descendant of thelocationId,falseotherwise- Throws:
NotFoundException-locationIdnot foundNullArgumentException-idorlocationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.- Notes:
If- {@code id} is not found return {@code false} .
-
getLocationNodeIds
Node getLocationNodeIds(Id locationId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a portion of the hierarchy for the given location.- Parameters:
locationId- theIdto queryancestorLevels- the maximum number of ancestor levels to include. A value of 0 returns no parents in the location.descendantLevels- the maximum number of descendant levels to include. A value of 0 returns no children in the location.includeSiblings-trueto include the siblings of the given location,falseto omit the siblings- Returns:
- a location node
- Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getLocationNodes
LocationNode getLocationNodes(Id locationId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets a portion of the hierarchy for the given location.- Parameters:
locationId- theIdto queryancestorLevels- the maximum number of ancestor levels to include. A value of 0 returns no parents in the location.descendantLevels- the maximum number of descendant levels to include. A value of 0 returns no children in the location.includeSiblings-trueto include the siblings of the given location,falseto omit the siblings- Returns:
- a location node
- Throws:
NotFoundException-locationIdis not foundNullArgumentException-locationIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-