public interface StockAdminSession extends OsidSession
This session creates, updates, and deletes Stocks. The
data for create and update is provided by the consumer via the form
object. OsidForms are requested for each create or update
and may not be reused.
Create and update operations differ in their usage. To create a
Stock, a StockForm is requested using
getStockFormForCreate() specifying the desired record Types
or none if no record Types are needed. The returned
StockForm will indicate that it is to be used with a create
operation and can be used to examine metdata or validate data prior to
creation. Once the StockForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each StockForm
corresponds to an attempted transaction.
For updates, StockForms are requested to the
Stock Id that is to be updated using
getStockFormForUpdate(). Similarly, the StockForm
has metadata about the data that can be updated and it can perform
validation before submitting the update. The StockForm can
only be used once for a successful update and cannot be reused.
The delete operations delete Stocks. To unmap a
Stock from the current Warehouse, the
StockWarehouseAssignmentSession should be used. These delete
operations attempt to remove the Stock itself thus removing
it from all known Warehouse catalogs.
This session includes an Id aliasing mechanism to
assign an external Id to an internally assigned Id.
| Modifier and Type | Method and Description |
|---|---|
void |
aliasStock(Id stockId,
Id aliasId)
Adds an
Id to a Stock for the purpose of
creating compatibility. |
boolean |
canCreateStocks()
Tests if this user can create
Stocks. |
boolean |
canCreateStockWithRecordTypes(Type[] stockRecordTypes)
Tests if this user can create a single
Stock using the
desired record types. |
boolean |
canDeleteStocks()
Tests if this user can delete
Stocks. |
boolean |
canManageStockAliases()
Tests if this user can manage
Id aliases for
Stocks. |
boolean |
canUpdateStocks()
Tests if this user can update
Stocks. |
Stock |
createStock(StockForm stockForm)
Creates a new
Stock. |
void |
deleteStock(Id stockId)
Deletes a
Stock. |
StockForm |
getStockFormForCreate(Type[] stockRecordTypes)
Gets the stock form for creating new stocks.
|
StockForm |
getStockFormForUpdate(Id stockId)
Gets the stock form for updating an existing stock.
|
Warehouse |
getWarehouse()
Gets the
Warehouse associated with this session. |
Id |
getWarehouseId()
Gets the
Warehouse Id associated with
this session. |
void |
updateStock(StockForm stockForm)
Updates an existing stock.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionscloseId getWarehouseId()
Warehouse Id associated with
this session. Warehouse Id associated with this sessionmandatory - This method must be implemented. Warehouse getWarehouse() throws OperationFailedException, PermissionDeniedException
Warehouse associated with this session.OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canCreateStocks()
Stocks. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known creating a Stock will result
in a PERMISSION_DENIED. This is intended as a hint to
an application that may opt not to offer create operations to an
unauthorized user. false if Stock creation is not
authorized, true otherwisemandatory - This method must be implemented. boolean canCreateStockWithRecordTypes(Type[] stockRecordTypes)
Stock using the
desired record types. While
InventoryManager.getStockRecordTypes() can be used to examine
which records are supported, this method tests which record(s) are
required for creating a specific Stock. Providing an
empty array tests if a Stock can be created with no
records.stockRecordTypes - array of stock record types true if Stock creation using the
specified record Types is supported,
false otherwiseNullArgumentException - stockRecordTypes
is null mandatory - This method must be implemented. StockForm getStockFormForCreate(Type[] stockRecordTypes) throws OperationFailedException, PermissionDeniedException
stockRecordTypes - array of stock record typesNullArgumentException - stockRecordTypes
is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - unable to get form for requested
record typesmandatory - This method must be implemented. Stock createStock(StockForm stockForm) throws NotFoundException, OperationFailedException, PermissionDeniedException
Stock. stockForm - the form for this Stock Stock IllegalStateException - stockForm
already used in a create transactionInvalidArgumentException - one or more of the form
elements is invalidNullArgumentException - courseId, termId
, or stockForm is null NotFoundException - stockForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - stockForm did not
originate from getStockFormForCreate() mandatory - This method must be implemented. boolean canUpdateStocks()
Stocks. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known updating a Stock will result
in a PERMISSION_DENIED. This is intended as a hint to
an application that may opt not to offer update operations to an
unauthorized user. false if Stock modification is
not authorized, true otherwisemandatory - This method must be implemented. StockForm getStockFormForUpdate(Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
stockId - the Id of the Stock NotFoundException - stockId is not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. void updateStock(StockForm stockForm) throws OperationFailedException, PermissionDeniedException
stockForm - the form containing the elements to be updatedIllegalStateException - stockForm
already used in an update transactionInvalidArgumentException - the form contains an invalid
valueNullArgumentException - stockForm is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failureUnsupportedException - stockForm did not
originate from getStockFormForUpdate() mandatory - This method must be implemented. boolean canDeleteStocks()
Stocks. A return of true
does not guarantee successful authorization. A return of false
indicates that it is known deleting a Stock will result
in a PERMISSION_DENIED. This is intended as a hint to
an application that may opt not to offer delete operations to an
unauthorized user. false if Stock deletion is not
authorized, true otherwisemandatory - This method must be implemented. void deleteStock(Id stockId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Stock. stockId - the Id of the Stock to
removeNotFoundException - stockId not foundNullArgumentException - stockId is
null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented. boolean canManageStockAliases()
Id aliases for
Stocks. A return of true does not guarantee successful
authorization. A return of false indicates that it is known changing
an alias will result in a PERMISSION_DENIED. This is
intended as a hint to an application that may opt not to offer alias
operations to an unauthorized user. false if Stock aliasing is not
authorized, true otherwisemandatory - This method must be implemented. void aliasStock(Id stockId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id to a Stock for the purpose of
creating compatibility. The primary Id of the
Stock is determined by the provider. The new Id
performs as an alias to the primary Id. If the alias is
a pointer to another stock, it is reassigned to the given stock
Id. stockId - the Id of a Stock aliasId - the alias Id AlreadyExistsException - aliasId is in
use as a primary Id NotFoundException - stockId not foundNullArgumentException - stockId or
aliasId is null OperationFailedException - unable to complete requestPermissionDeniedException - authorization failuremandatory - This method must be implemented.