Interface InventoryAdminSession

All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
All Known Subinterfaces:
InventoryBatchAdminSession

public interface InventoryAdminSession extends OsidSession

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 Details

    • getWarehouseId

      Id getWarehouseId()
      Gets the Warehouse Id associated with this session.
      Returns:
      the Warehouse Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getWarehouse

      Gets the Warehouse associated with this session.
      Returns:
      the warehouse
      Throws:
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canCreateInventories

      boolean canCreateInventories()
      Tests if this user can create Inventories . A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an Inventory 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.
      Returns:
      false if Inventory creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateInventoryWithRecordTypes

      boolean canCreateInventoryWithRecordTypes(Type[] inventoryRecordTypes)
      Tests if this user can create a single Inventory using the desired record types. While InventoryManager.getInventoryRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Inventory . Providing an empty array tests if an Inventory can be created with no records.
      Parameters:
      inventoryRecordTypes - array of inventory record types
      Returns:
      true if Inventory creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - inventoryRecordTypes is null
      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 stock Id
      inventoryRecordTypes - array of inventory record types
      Returns:
      the inventory form
      Throws:
      NotFoundException - stockId is not found
      NullArgumentException - stockId or inventoryRecordTypes is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - unable to get form for requested record types
      Compliance:
      mandatory - This method must be implemented.
    • createInventory

      Creates a new Inventory .
      Parameters:
      inventoryForm - the form for this Inventory
      Returns:
      the new Inventory
      Throws:
      IllegalStateException - inventoryForm already used in a create transaction
      InvalidArgumentException - one or more of the form elements is invalid
      NullArgumentException - inventoryForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - inventoryForm did not originate from getInventoryFormForCreate()
      Compliance:
      mandatory - This method must be implemented.
    • canUpdateInventories

      boolean canUpdateInventories()
      Tests if this user can update Inventories . A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an Inventory 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.
      Returns:
      false if Inventory modification is not authorized, true otherwise
      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 - the Id of the Inventory
      Returns:
      the inventory form
      Throws:
      NotFoundException - inventoryId is not found
      NullArgumentException - inventoryId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - 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 - inventoryForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - inventoryForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - inventoryForm did not originate from getInventoryFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteInventories

      boolean canDeleteInventories()
      Tests if this user can delete Inventories . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Inventory 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.
      Returns:
      false if Inventory deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteInventory

      boolean canDeleteInventory(Id inventoryId)
      Tests if this user can delete a specified Inventory . A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting the Inventory will result in a PERMISSION_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 - the Id of the Inventory
      Returns:
      false if deletion of this Inventory is not authorized, true otherwise
      Throws:
      NullArgumentException - inventoryId is null
      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 an Inventory .
      Parameters:
      inventoryId - the Id of the Inventory to remove
      Throws:
      NotFoundException - inventoryId not found
      NullArgumentException - inventoryId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageInventoryAliases

      boolean canManageInventoryAliases()
      Tests if this user can manage Id aliases for Inventories . 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.
      Returns:
      false if Inventory aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasInventory

      Adds an Id to an Inventory for the purpose of creating compatibility. The primary Id of the Inventory is determined by the provider. The new Id performs as an alias to the primary Id . If the alias is a pointer to another inventory, it is reassigned to the given inventory Id .
      Parameters:
      inventoryId - the Id of an Inventory
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is in use as a primary Id
      NotFoundException - inventoryId not found
      NullArgumentException - inventoryId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.