public interface AccountHierarchySession extends OsidSession
This session defines methods for traversing a hierarchy of
Account objects. Each node in the hierarchy is a unique
Account. The hierarchy may be traversed recursively to establish
the tree structure through getAccountNodes(). To relate
these Ids to another OSID, getAncestorAccounts()
and getDescendantAccounts() can be used for
retrievals that can be used for bulk lookups in other OSIDs. Any
Account available in the Business 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 getParentAccounts() or getChildAccounts()
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 |
canAccessAccountHierarchy()
Tests if this user can perform hierarchy queries.
|
Hierarchy |
getAccountHierarchy()
Gets the hierarchy associated with this session.
|
Id |
getAccountHierarchyId()
Gets the hierarchy
Id associated with this session. |
Node |
getAccountNodeIds(Id accountId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given account.
|
AccountNode |
getAccountNodes(Id accountId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given account.
|
IdList |
getChildAccountIds(Id accountId)
Gets the child
Ids of the given account. |
AccountList |
getChildAccounts(Id accountId)
Gets the children of the given account.
|
IdList |
getParentAccountIds(Id accountId)
Gets the parent Ids of the given account.
|
AccountList |
getParentAccounts(Id accountId)
Gets the parents of the given account.
|
IdList |
getRootAccountIds()
Gets the root account
Ids in this hierarchy. |
AccountList |
getRootAccounts()
Gets the root accounts in this account hierarchy.
|
boolean |
hasChildAccounts(Id accountId)
Tests if an account has any children.
|
boolean |
hasParentAccounts(Id accountId)
Tests if the
Account has any parents. |
boolean |
isAncestorOfAccount(Id id,
Id accountId)
Tests if an
Id is an ancestor of an account. |
boolean |
isChildOfAccount(Id id,
Id accountId)
Tests if an account is a direct child of another.
|
boolean |
isDescendantOfAccount(Id id,
Id accountId)
Tests if an
Id is a descendant of an account. |
boolean |
isParentOfAccount(Id id,
Id accountId)
Tests if an
Id is a direct parent of an account. |
void |
useComparativeAccountView()
The returns from the account methods may omit or translate elements
based on this session, such as authorization, and not result in an
error.
|
void |
usePlenaryAccountView()
A complete view of the
Hierarchy returns is desired. |
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getAccountHierarchyId()
Id associated with this session. Id associated with this sessionmandatory - This method must be implemented. Hierarchy getAccountHierarchy() throws OperationFailedException, PermissionDeniedException
OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canAccessAccountHierarchy()
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 useComparativeAccountView()
mandatory - This method is must be implemented. void usePlenaryAccountView()
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 getRootAccountIds() throws OperationFailedException, PermissionDeniedException
Ids in this hierarchy. Ids OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. AccountList getRootAccounts() throws OperationFailedException, PermissionDeniedException
OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method is must be implemented. boolean hasParentAccounts(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Account has any parents.accountId - the Id of an account true if the account has parents, false
otherwiseNotFoundException - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isParentOfAccount(Id id, Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id is a direct parent of an account.id - an Id accountId - the Id of an account true if this id is a parent of
accountId, false otherwiseNotFoundException - accountId is not
foundNullArgumentException - id or
accountId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. If - id not found return false. IdList getParentAccountIds(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
accountId - the Id of an account Ids of the accountNotFoundException - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. AccountList getParentAccounts(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
accountId - the Id of an accountNotFoundException - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isAncestorOfAccount(Id id, Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id is an ancestor of an account.id - an Id accountId - the Id of an account true if this id is an ancestor
of accountId, false otherwiseNotFoundException - accountId is not
foundNullArgumentException - id or
accountId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. If - id not found return false. boolean hasChildAccounts(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
accountId - the Id of an account true if the accountId has
children, false otherwiseNotFoundException - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isChildOfAccount(Id id, Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
id - an Id accountId - the Id of an account true if the id is a child of
accountId, false otherwiseNotFoundException - accountId is not
foundNullArgumentException - id or
accountId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. If - id not found return false. IdList getChildAccountIds(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ids of the given account.accountId - the Id to queryNotFoundException - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. AccountList getChildAccounts(Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
accountId - the Id to queryNotFoundException - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isDescendantOfAccount(Id id, Id accountId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id is a descendant of an account.id - an Id accountId - the Id of an account true if the id is a descendant
of the accountId, false
otherwiseNotFoundException - accountId is not
foundNullArgumentException - id or
accountId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. If - id is not found return false. Node getAccountNodeIds(Id accountId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
accountId - 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 - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. AccountNode getAccountNodes(Id accountId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
accountId - 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 - accountId is not
foundNullArgumentException - accountId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.