Interface StockBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession, StockAdminSession
This session creates, updates, and deletes Stocks in bulk. 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
getStockFormsForCreate() specifying the desired work, resource, and
record Types or none if no record Types are needed. Each
of the returned StockForms 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 a 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.
The StockForms returned from getStockFormsForCreate()
may be linked to the originating request through the peer Ids of
the StockForm . In the case where there may be duplicates, any
StockForm of the same peer Ids may be used for a create
operation.
Once a batch of StockForms are submitted for create, a
CreateResponse is returned for each StockForm , although the
ordering is not defined. Only errors that pertain to the entire create
operation are returned from createStocks() , errors specific to an
individual StockForm are indicated in the corresponding
CreateResponse . CreateResponses may be linked to the originating
StockForm through the StockForm Id .
For updates, StockForms are requested to the Stock
Id that is to be updated using getStockFormsForUpdate()
where the reference Id in the StockForm may be used to
link the request. 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.
Once a batch of StockForms are submitted for update, an
UpdateResponse is returned for each StockForm , although the
ordering is not defined. Only errors that pertain to the entire update
operation are returned from updateStocks() , errors specific to an
individual StockForm are indicated in the corresponding
UpdateResponse . UpdateResponses may be linked to the originating
StockForm through the StockForm Id .
The delete operations delete Stocks in bulk. To unmap a
Stock from the current Inventory , the
StockInventoryAssignmentSession should be used. These delete operations
attempt to remove the Stock itself thus removing it from all known
Inventory catalogs. Bulk delete operations return the results in
DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasStocks(AliasRequestList aliasRequests) Adds anIdto aStockfor the purpose of creating compatibility.createStocks(StockBatchFormList stockForms) Creates a new set ofStocks.Deletes allStocksin thisInventory.deleteStocks(IdList stockIds) Deletes stocks for the givenIds.getStockFormsForCreate(long number, Type[] stockRecordTypes) Gets the stock forms for creating a bunch of new stocks.getStockFormsForUpdate(IdList stockIds) Gets the stock forms for updating an existing set of stocks.updateStocks(StockBatchFormList stockForms) Updates existing stocks.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.Methods inherited from interface StockAdminSession
aliasStock, canCreateStocks, canCreateStockWithRecordTypes, canDeleteStocks, canManageStockAliases, canUpdateStocks, createStock, deleteStock, getStockFormForCreate, getStockFormForUpdate, getWarehouse, getWarehouseId, updateStockModifier and TypeMethodDescriptionvoidaliasStock(Id stockId, Id aliasId) Adds anIdto aStockfor the purpose of creating compatibility.booleanTests if this user can createStocks.booleancanCreateStockWithRecordTypes(Type[] stockRecordTypes) Tests if this user can create a singleStockusing the desired record types.booleanTests if this user can deleteStocks.booleanTests if this user can manageIdaliases forStocks.booleanTests if this user can updateStocks.createStock(StockForm stockForm) Creates a newStock.voiddeleteStock(Id stockId) Deletes aStock.getStockFormForCreate(Type[] stockRecordTypes) Gets the stock form for creating new stocks.getStockFormForUpdate(Id stockId) Gets the stock form for updating an existing stock.Gets theWarehouseassociated with this session.Gets theWarehouseIdassociated with this session.voidupdateStock(StockForm stockForm) Updates an existing stock.
-
Method Details
-
getStockFormsForCreate
StockBatchFormList getStockFormsForCreate(long number, Type[] stockRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the stock forms for creating a bunch of new stocks.- Parameters:
number- the number of forms to retrievestockRecordTypes- array of stock record types to be included in each create operation or an empty list if none- Returns:
- the stock forms
- Throws:
NullArgumentException-stockRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createStocks
CreateResponseList createStocks(StockBatchFormList stockForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofStocks. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
stockForms- the stock forms- Returns:
- the create responses
- Throws:
NullArgumentException-stockFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getStockFormsForUpdate
StockBatchFormList getStockFormsForUpdate(IdList stockIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the stock forms for updating an existing set of stocks. A new stock form should be requested for each update transaction.- Parameters:
stockIds- theIdsof theStock- Returns:
- the stock form
- Throws:
NotFoundException- astockIdis not foundNullArgumentException-stockIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateStocks
UpdateResponseList updateStocks(StockBatchFormList stockForms) throws OperationFailedException, PermissionDeniedException Updates existing stocks. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
stockForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-stockFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllStocks
Deletes allStocksin thisInventory.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteStocks
DeleteResponseList deleteStocks(IdList stockIds) throws OperationFailedException, PermissionDeniedException Deletes stocks for the givenIds.- Parameters:
stockIds- theIdsof the stocks to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-stockIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasStocks
AliasResponseList aliasStocks(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto aStockfor the purpose of creating compatibility. The primaryIdof theStockis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another stock, it is reassigned to the given stockId.- Parameters:
aliasRequests- the alias requests- Returns:
- the alias responses
- Throws:
NullArgumentException-aliasRequestsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-