Interface InventoryBatchAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, InventoryAdminSession, OsidSession, OsidSession
This session creates, updates, and deletes Inventories 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 an
Inventory , an InventoryForm is requested using
getInventoryFormsForCreate() specifying the desired record Types
or none if no record Types are needed. Each of the returned
InventoryForms 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 an InventoryForm is submiited to a create
operation, it cannot be reused with another create operation unless the
first operation was unsuccessful. Each InventoryForm corresponds
to an attempted transaction.
The InventoryForms returned from
getInventoryFormsForCreate() may be linked to the originating request
through the peer Ids of the InventoryForm . In the case
where there may be duplicates, any InventoryForm of the same peer
Ids may be used for a create operation.
Once a batch of InventoryForms are submitted for create, a
CreateResponse is returned for each InventoryForm ,
although the ordering is not defined. Only errors that pertain to the
entire create operation are returned from createInventories() ,
errors specific to an individual InventoryForm are indicated in
the corresponding CreateResponse . CreateResponses may be
linked to the originating InventoryForm through the
InventoryForm Id .
For updates, InventoryForms are requested to the
Inventory Id that is to be updated using
getInventoryFormsForUpdate() where the reference Id in the
InventoryForm may be used to link the request. Similarly, the
InventoryForm has metadata about the data that can be updated and it can
perform validation before submitting the update. The InventoryForm
can only be used once for a successful update and cannot be reused.
Once a batch of InventoryForms are submitted for update, an
UpdateResponse is returned for each InventoryForm ,
although the ordering is not defined. Only errors that pertain to the
entire update operation are returned from updateInventories() ,
errors specific to an individual InventoryForm are indicated in
the corresponding UpdateResponse . UpdateResponses may be
linked to the originating InventoryForm through the
InventoryForm Id .
The delete operations delete Inventories in bulk. Bulk delete
operations return the results in DeleteResponses .
-
Method Summary
Modifier and TypeMethodDescriptionaliasInventories(AliasRequestList aliasRequests) Adds anIdto anInventoryfor the purpose of creating compatibility.createInventories(InventoryBatchFormList inventoryForms) Creates a new set ofInventories.Deletes allInventories.deleteInventories(IdList inventoryIds) Deletes inventories for the givenIds.getInventoryFormsForCreate(long number, Type[] inventoryRecordTypes) Gets the inventory forms for creating a bunch of new inventories.getInventoryFormsForUpdate(IdList inventoryIds) Gets the inventory forms for updating an existing set of inventories.updateInventories(InventoryBatchFormList inventoryForms) Updates existing inventories.Methods inherited from interface InventoryAdminSession
aliasInventory, canCreateInventories, canCreateInventoryWithRecordTypes, canDeleteInventories, canDeleteInventory, canManageInventoryAliases, canUpdateInventories, createInventory, deleteInventory, getInventoryFormForCreate, getInventoryFormForUpdate, getWarehouse, getWarehouseId, updateInventoryModifier and TypeMethodDescriptionvoidaliasInventory(Id inventoryId, Id aliasId) Adds anIdto anInventoryfor the purpose of creating compatibility.booleanTests if this user can createInventories.booleancanCreateInventoryWithRecordTypes(Type[] inventoryRecordTypes) Tests if this user can create a singleInventoryusing the desired record types.booleanTests if this user can deleteInventories.booleancanDeleteInventory(Id inventoryId) Tests if this user can delete a specifiedInventory.booleanTests if this user can manageIdaliases forInventories.booleanTests if this user can updateInventories.createInventory(InventoryForm inventoryForm) Creates a newInventory.voiddeleteInventory(Id inventoryId) Deletes anInventory.getInventoryFormForCreate(Id stockId, Type[] inventoryRecordTypes) Gets the inventory form for creating new inventories.getInventoryFormForUpdate(Id inventoryId) Gets the inventory form for updating an existing inventory.Gets theWarehouseassociated with this session.Gets theWarehouseIdassociated with this session.voidupdateInventory(InventoryForm inventoryForm) Updates an existing inventory.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
-
getInventoryFormsForCreate
InventoryBatchFormList getInventoryFormsForCreate(long number, Type[] inventoryRecordTypes) throws OperationFailedException, PermissionDeniedException Gets the inventory forms for creating a bunch of new inventories.- Parameters:
number- the number of forms to retrieveinventoryRecordTypes- array of inventory record types to be included in each create operation or an empty list if none- Returns:
- the inventory forms
- Throws:
NullArgumentException-inventoryRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to request forms with given record types- Compliance:
mandatory- This method must be implemented.
-
createInventories
CreateResponseList createInventories(InventoryBatchFormList inventoryForms) throws OperationFailedException, PermissionDeniedException Creates a new set ofInventories. This method returns an error if the entire operation fails. Otherwise, the status of an individual create operation is indicated in theBatchCreateResponse.- Parameters:
inventoryForms- the inventory forms- Returns:
- the create responses
- Throws:
NullArgumentException-inventoryFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
getInventoryFormsForUpdate
InventoryBatchFormList getInventoryFormsForUpdate(IdList inventoryIds) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the inventory forms for updating an existing set of inventories. A new inventory form should be requested for each update transaction.- Parameters:
inventoryIds- theIdsof theInventory- Returns:
- the inventory form
- Throws:
NotFoundException- aninventoryIdis not foundNullArgumentException-inventoryIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateInventories
UpdateResponseList updateInventories(InventoryBatchFormList inventoryForms) throws OperationFailedException, PermissionDeniedException Updates existing inventories. This method returns an error if the entire operation fails. Otherwise, the status of an individual update operation is indicated in theBatchCreateResponse.- Parameters:
inventoryForms- the form containing the elements to be updated- Returns:
- the update responses
- Throws:
NullArgumentException-inventoryFormsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteAllInventories
DeleteResponseList deleteAllInventories() throws OperationFailedException, PermissionDeniedExceptionDeletes allInventories.- Returns:
- the delete responses
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
deleteInventories
DeleteResponseList deleteInventories(IdList inventoryIds) throws OperationFailedException, PermissionDeniedException Deletes inventories for the givenIds.- Parameters:
inventoryIds- theIdsof the inventories to delete- Returns:
- the delete responses
- Throws:
NullArgumentException-inventoryIdsisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
aliasInventories
AliasResponseList aliasInventories(AliasRequestList aliasRequests) throws OperationFailedException, PermissionDeniedException Adds anIdto anInventoryfor the purpose of creating compatibility. The primaryIdof theInventoryis determined by the provider. The newIdis an alias to the primaryId. If the alias is a pointer to another inventory, it is reassigned to the given inventoryId.- 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.
-