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.
Modifier and Type | Method and Description |
---|---|
void |
aliasInventory(Id inventoryId,
Id aliasId)
Adds an
Id to an Inventory for the
purpose of creating compatibility. |
boolean |
canCreateInventories()
Tests if this user can create
Inventories. |
boolean |
canCreateInventoryWithRecordTypes(Type[] inventoryRecordTypes)
Tests if this user can create a single
Inventory using
the desired record types. |
boolean |
canDeleteInventories()
Tests if this user can delete
Inventories. |
boolean |
canDeleteInventory(Id inventoryId)
Tests if this user can delete a specified
Inventory. |
boolean |
canManageInventoryAliases()
Tests if this user can manage
Id aliases for
Inventories. |
boolean |
canUpdateInventories()
Tests if this user can update
Inventories. |
Inventory |
createInventory(InventoryForm inventoryForm)
Creates a new
Inventory. |
void |
deleteInventory(Id inventoryId)
Deletes an
Inventory. |
InventoryForm |
getInventoryFormForCreate(Id stockId,
Type[] inventoryRecordTypes)
Gets the inventory form for creating new inventories.
|
InventoryForm |
getInventoryFormForUpdate(Id inventoryId)
Gets the inventory form for updating an existing inventory.
|
Warehouse |
getWarehouse()
Gets the
Warehouse associated with this session. |
Id |
getWarehouseId()
Gets the
Warehouse Id associated with
this session. |
void |
updateInventory(InventoryForm inventoryForm)
Updates an existing inventory.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id 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 canCreateInventories()
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. false
if Inventory
creation is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateInventoryWithRecordTypes(Type[] inventoryRecordTypes)
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.inventoryRecordTypes
- array of inventory record types true
if Inventory
creation using
the specified record Types
is supported,
false
otherwiseNullArgumentException
- inventoryRecordTypes
is null
mandatory
- This method must be implemented. InventoryForm getInventoryFormForCreate(Id stockId, Type[] inventoryRecordTypes) throws NotFoundException, OperationFailedException, PermissionDeniedException
stockId
- a stock Id
inventoryRecordTypes
- array of inventory record typesNotFoundException
- stockId
is not foundNullArgumentException
- stockId
or
inventoryRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Inventory createInventory(InventoryForm inventoryForm) throws OperationFailedException, PermissionDeniedException
Inventory.
inventoryForm
- the form for this Inventory
Inventory
IllegalStateException
- inventoryForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- inventoryForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- inventoryForm
did
not originate from getInventoryFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateInventories()
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. false
if Inventory
modification
is not authorized, true
otherwisemandatory
- This method must be implemented. InventoryForm getInventoryFormForUpdate(Id inventoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
inventoryId
- the Id
of the Inventory
NotFoundException
- inventoryId
is not
foundNullArgumentException
- inventoryId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateInventory(InventoryForm inventoryForm) throws OperationFailedException, PermissionDeniedException
inventoryForm
- the form containing the elements to be updatedIllegalStateException
- inventoryForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- inventoryForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- inventoryForm
did
not originate from getInventoryFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteInventories()
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. false
if Inventory
deletion is
not authorized, true
otherwisemandatory
- This method must be implemented. boolean canDeleteInventory(Id inventoryId)
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.inventoryId
- the Id
of the Inventory
false
if deletion of this Inventory
is not authorized, true
otherwiseNullArgumentException
- inventoryId
is
null
mandatory
- This method must be implemented. If
- the inventoryId
is not found, then it is
acceptable to return false to indicate the lack of a delete
available. void deleteInventory(Id inventoryId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Inventory.
inventoryId
- the Id
of the Inventory
to removeNotFoundException
- inventoryId
not
foundNullArgumentException
- inventoryId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageInventoryAliases()
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. false
if Inventory
aliasing is
not authorized, true
otherwisemandatory
- This method must be implemented. void aliasInventory(Id inventoryId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
Id
to an Inventory
for the
purpose of creating compatibility. The primary Id
of
the Inventory
is deinventoryined 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.
inventoryId
- the Id
of an Inventory
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is in
use as a primary Id
NotFoundException
- inventoryId
not
foundNullArgumentException
- inventoryId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.