OSID Logo
OSID Specifications
inventory package
Version 3.1.0
Interfaceosid.inventory.StockAdminSession
Implementsosid.OsidSession
Implemented Byosid.inventory.batch.StockBatchAdminSession
Used Byosid.inventory.InventoryManager
osid.inventory.InventoryProxyManager
Description

This session creates, updates, and deletes Stocks. 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 getStockFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned StockForm 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 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.

For updates, StockForms are requested to the Stock Id that is to be updated using getStockFormForUpdate(). 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.

The delete operations delete Stocks. To unmap a Stock from the current Warehouse, the StockWarehouseAssignmentSession should be used. These delete operations attempt to remove the Stock 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.

MethodgetWarehouseId
Description

Gets the Warehouse Id associated with this session.

Returnosid.id.Id the Warehouse Id associated with this session
Compliancemandatory This method must be implemented.
MethodgetWarehouse
Description

Gets the Warehouse associated with this session.

Returnosid.inventory.Warehouse the warehouse
ErrorsOPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodcanCreateStocks
Description

Tests if this user can create Stocks. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating a Stock 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.

Returnboolean false if Stock creation is not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethodcanCreateStockWithRecordTypes
Description

Tests if this user can create a single Stock using the desired record types. While InventoryManager.getStockRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Stock. Providing an empty array tests if a Stock can be created with no records.

Parametersosid.type.Type[]stockRecordTypes array of stock record types
Returnboolean true if Stock creation using the specified record Types is supported, false otherwise
ErrorsNULL_ARGUMENT stockRecordTypes is null
Compliancemandatory This method must be implemented.
MethodgetStockFormForCreate
Description

Gets the stock form for creating new stocks. A new form should be requested for each create transaction.

Parametersosid.type.Type[]stockRecordTypes array of stock record types
Returnosid.inventory.StockForm the stock form
ErrorsNULL_ARGUMENT stockRecordTypes is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
UNSUPPORTED unable to get form for requested record types
Compliancemandatory This method must be implemented.
MethodcreateStock
Description

Creates a new Stock.

Parametersosid.inventory.StockFormstockForm the form for this Stock
Returnosid.inventory.Stock the new Stock
ErrorsILLEGAL_STATE stockForm already used in a create transaction
INVALID_ARGUMENT one or more of the form elements is invalid
NULL_ARGUMENT courseId, termId, or stockForm is null
NOT_FOUND stockForm is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
UNSUPPORTED stockForm did not originate from getStockFormForCreate()
Compliancemandatory This method must be implemented.
MethodcanUpdateStocks
Description

Tests if this user can update Stocks. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating a Stock 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.

Returnboolean false if Stock modification is not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethodgetStockFormForUpdate
Description

Gets the stock form for updating an existing stock. A new stock form should be requested for each update transaction.

Parametersosid.id.IdstockId the Id of the Stock
Returnosid.inventory.StockForm the stock form
ErrorsNOT_FOUND stockId is not found
NULL_ARGUMENT stockId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodupdateStock
Description

Updates an existing stock.

Parametersosid.inventory.StockFormstockForm the form containing the elements to be updated
ErrorsILLEGAL_STATE stockForm already used in an update transaction
INVALID_ARGUMENT the form contains an invalid value
NULL_ARGUMENT stockForm is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
UNSUPPORTED stockForm did not originate from getStockFormForUpdate()
Compliancemandatory This method must be implemented.
MethodcanDeleteStocks
Description

Tests if this user can delete Stocks. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting a Stock 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.

Returnboolean false if Stock deletion is not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethoddeleteStock
Description

Deletes a Stock.

Parametersosid.id.IdstockId the Id of the Stock to remove
ErrorsNOT_FOUND stockId not found
NULL_ARGUMENT stockId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.
MethodcanManageStockAliases
Description

Tests if this user can manage Id aliases for Stocks. 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.

Returnboolean false if Stock aliasing is not authorized, true otherwise
Compliancemandatory This method must be implemented.
MethodaliasStock
Description

Adds an Id to a Stock for the purpose of creating compatibility. The primary Id of the Stock is determined by the provider. The new Id performs as an alias to the primary Id. If the alias is a pointer to another stock, it is reassigned to the given stock Id.

Parametersosid.id.IdstockId the Id of a Stock
osid.id.IdaliasId the alias Id
ErrorsALREADY_EXISTS aliasId is in use as a primary Id
NOT_FOUND stockId not found
NULL_ARGUMENT stockId or aliasId is null
OPERATION_FAILED unable to complete request
PERMISSION_DENIED authorization failure
Compliancemandatory This method must be implemented.