Interface InventoryAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
InventoryBatchAdminSession
This session creates, updates, and deletes Inventories . 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
getInventoryFormForCreate() specifying the desired stock and record
Types or none if no record Types are needed. The returned
InventoryForm 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 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.
For updates, InventoryForms are requested to the
Inventory Id that is to be updated using
getInventoryFormForUpdate() . 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.
The delete operations delete Inventories . To unmap an
Inventory from the current Warehouse , the
InventoryWarehouseAssignmentSession should be used. These delete
operations attempt to remove the Inventory 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.
-
Method Summary
Modifier 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
-
getWarehouseId
Id getWarehouseId()Gets theWarehouseIdassociated with this session.- Returns:
- the
Warehouse Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getWarehouse
Gets theWarehouseassociated with this session.- Returns:
- the warehouse
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canCreateInventories
boolean canCreateInventories()Tests if this user can createInventories. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating anInventorywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer create operations to an unauthorized user.- Returns:
falseifInventorycreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateInventoryWithRecordTypes
Tests if this user can create a singleInventoryusing the desired record types. WhileInventoryManager.getInventoryRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificInventory. Providing an empty array tests if anInventorycan be created with no records.- Parameters:
inventoryRecordTypes- array of inventory record types- Returns:
trueifInventorycreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-inventoryRecordTypesisnull- Compliance:
mandatory- This method must be implemented.
-
getInventoryFormForCreate
InventoryForm getInventoryFormForCreate(Id stockId, Type[] inventoryRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the inventory form for creating new inventories. A new form should be requested for each create transaction.- Parameters:
stockId- a stockIdinventoryRecordTypes- array of inventory record types- Returns:
- the inventory form
- Throws:
NotFoundException-stockIdis not foundNullArgumentException-stockIdorinventoryRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createInventory
Inventory createInventory(InventoryForm inventoryForm) throws OperationFailedException, PermissionDeniedException Creates a newInventory.- Parameters:
inventoryForm- the form for thisInventory- Returns:
- the new
Inventory - Throws:
IllegalStateException-inventoryFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-inventoryFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-inventoryFormdid not originate fromgetInventoryFormForCreate()- Compliance:
mandatory- This method must be implemented.
-
canUpdateInventories
boolean canUpdateInventories()Tests if this user can updateInventories. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating anInventorywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer update operations to an unauthorized user.- Returns:
falseifInventorymodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getInventoryFormForUpdate
InventoryForm getInventoryFormForUpdate(Id inventoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the inventory form for updating an existing inventory. A new inventory form should be requested for each update transaction.- Parameters:
inventoryId- theIdof theInventory- Returns:
- the inventory form
- Throws:
NotFoundException-inventoryIdis not foundNullArgumentException-inventoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateInventory
void updateInventory(InventoryForm inventoryForm) throws OperationFailedException, PermissionDeniedException Updates an existing inventory.- Parameters:
inventoryForm- the form containing the elements to be updated- Throws:
IllegalStateException-inventoryFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-inventoryFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-inventoryFormdid not originate fromgetInventoryFormForUpdate()- Compliance:
mandatory- This method must be implemented.
-
canDeleteInventories
boolean canDeleteInventories()Tests if this user can deleteInventories. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting anInventorywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer delete operations to an unauthorized user.- Returns:
falseifInventorydeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canDeleteInventory
Tests if this user can delete a specifiedInventory. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting theInventorywill result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer a delete operation to an unauthorized user for this inventory.- Parameters:
inventoryId- theIdof theInventory- Returns:
falseif deletion of thisInventoryis not authorized,trueotherwise- Throws:
NullArgumentException-inventoryIdisnull- Compliance:
mandatory- This method must be implemented.- Notes:
If- the {@code inventoryId} is not found, then it is acceptable to return false to indicate the lack of a delete available.
-
deleteInventory
void deleteInventory(Id inventoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anInventory.- Parameters:
inventoryId- theIdof theInventoryto remove- Throws:
NotFoundException-inventoryIdnot foundNullArgumentException-inventoryIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageInventoryAliases
boolean canManageInventoryAliases()Tests if this user can manageIdaliases forInventories. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifInventoryaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasInventory
void aliasInventory(Id inventoryId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anInventoryfor the purpose of creating compatibility. The primaryIdof theInventoryis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another inventory, it is reassigned to the given inventoryId.- Parameters:
inventoryId- theIdof anInventoryaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis in use as a primaryIdNotFoundException-inventoryIdnot foundNullArgumentException-inventoryIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-