public interface StockHierarchySession extends OsidSession
This session defines methods for traversing a hierarchy of Stock
objects. Each node in the hierarchy is a unique Stock.
The hierarchy may be traversed recursively to establish the tree
structure through getParentStocks() and
getChildStocks(). To relate these Ids to another
OSID, getStockNodes() can be used for retrievals that can
be used for bulk lookups in other OSIDs. Any Stock
available in the Inventory 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 getParentStocks() or getChildStocks() 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 |
canAccessStockHierarchy()
Tests if this user can perform hierarchy queries.
|
IdList |
getChildStockIds(Id stockId)
Gets the child
Ids of the given stock. |
StockList |
getChildStocks(Id stockId)
Gets the children of the given stock.
|
IdList |
getParentStockIds(Id stockId)
Gets the parent
Ids of the given stock. |
StockList |
getParentStocks(Id stockId)
Gets the parents of the given stock.
|
IdList |
getRootStockIds()
Gets the root stock
Ids in this hierarchy. |
StockList |
getRootStocks()
Gets the root stocks in the stock hierarchy.
|
Hierarchy |
getStockHierarchy()
Gets the hierarchy associated with this session.
|
Id |
getStockHierarchyId()
Gets the hierarchy
Id associated with this session. |
Node |
getStockNodeIds(Id stockId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given stock.
|
StockNode |
getStockNodes(Id stockId,
long ancestorLevels,
long descendantLevels,
boolean includeSiblings)
Gets a portion of the hierarchy for the given stock.
|
boolean |
hasChildStocks(Id stockId)
Tests if a stock has any children.
|
boolean |
hasParentStocks(Id stockId)
Tests if the
Stock has any parents. |
boolean |
isAncestorOfStock(Id id,
Id stockId)
Tests if an
Id is an ancestor of a stock. |
boolean |
isChildOfStock(Id id,
Id stockId)
Tests if a stock is a direct child of another.
|
boolean |
isDescendantOfStock(Id id,
Id stockId)
Tests if an
Id is a descendant of a stock. |
boolean |
isParentOfStock(Id id,
Id stockId)
Tests if an
Id is a direct parent of stock. |
void |
useComparativeStockView()
The returns from the stock methods may omit or translate elements
based on this session, such as authorization, and not result in an
error.
|
void |
usePlenaryStockView()
A complete view of the
Stocks returns is desired. |
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getStockHierarchyId()
Id associated with this session. Id associated with this sessionmandatory - This method must be implemented. Hierarchy getStockHierarchy() throws OperationFailedException, PermissionDeniedException
OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canAccessStockHierarchy()
PERMISSION_DENIED. This is intended as a hint to an
application that may opt not to offer lookup operations. false if hierarchy traversal methods are not
authorized, true otherwisemandatory - This method must be implemented. void useComparativeStockView()
mandatory - This method is must be implemented. void usePlenaryStockView()
Stocks 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 getRootStockIds() throws OperationFailedException, PermissionDeniedException
Ids in this hierarchy. Ids OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. StockList getRootStocks() throws OperationFailedException, PermissionDeniedException
OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method is must be implemented. boolean hasParentStocks(Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Stock has any parents.stockId - a stock Id true if the stock has parents, f alse
otherwiseNotFoundException - stockId is not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isParentOfStock(Id id, Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id is a direct parent of stock.id - an Id stockId - the Id of a stock true if this id is a parent of
stockId, f alse otherwiseNotFoundException - stockId is not foundNullArgumentException - id or
stockId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. If - id not found return false. IdList getParentStockIds(Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ids of the given stock.stockId - a stock Id NotFoundException - stockId is not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. StockList getParentStocks(Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
stockId - the Id to queryNotFoundException - stockId not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isAncestorOfStock(Id id, Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id is an ancestor of a stock.id - an Id stockId - the Id of a stock tru e if this id is an ancestor
of stockId, false otherwiseNotFoundException - stockId not foundNullArgumentException - stockId or
id is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. If - id not found return false. boolean hasChildStocks(Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
stockId - a stock Id true if the stockId has
children, false otherwiseNotFoundException - stockId not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isChildOfStock(Id id, Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
id - an Id stockId - the Id of a stock true if the id is a child of
stockId, false otherwiseNotFoundException - stockId not foundNullArgumentException - id or
stockId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. If - id not found return false. IdList getChildStockIds(Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Ids of the given stock.stockId - the Id to queryNotFoundException - stockId not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. StockList getChildStocks(Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
stockId - the Id to queryNotFoundException - stockId not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean isDescendantOfStock(Id id, Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Id is a descendant of a stock.id - an Id stockId - the Id of a stock true if the id is a descendant
of the stockId, false otherwiseNotFoundException - stockId not foundNullArgumentException - id or
stockId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. If - id is not found return false. Node getStockNodeIds(Id stockId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
stockId - 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 - stockId not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. StockNode getStockNodes(Id stockId, long ancestorLevels, long descendantLevels, boolean includeSiblings) throws NotFoundException, OperationFailedException, PermissionDeniedException
stockId - 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 - stockId not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.