OSID Logo
OSID Specifications
inventory package
Version 3.0.0
Release Candidate Preview
Interfaceosid.inventory.StockAdminSession
Implementsosid.OsidSession
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.Idthe Warehouse Id associated with this session
CompliancemandatoryThis method must be implemented.
MethodgetWarehouse
Description

Gets the Warehouse associated with this session.

Returnosid.inventory.Warehousethe warehouse
ErrorsOPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis 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
CompliancemandatoryThis 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[]stockRecordTypesarray of stock record types
Returnboolean true if Stock creation using the specified record Types is supported, false otherwise
ErrorsNULL_ARGUMENT stockRecordTypes is null
CompliancemandatoryThis 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[]stockRecordTypesarray of stock record types
Returnosid.inventory.StockFormthe stock form
ErrorsNULL_ARGUMENT stockRecordTypes is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTEDunable to get form for requested record types
CompliancemandatoryThis method must be implemented.
MethodcreateStock
Description

Creates a new Stock.

Parametersosid.inventory.StockFormstockFormthe form for this Stock
Returnosid.inventory.Stockthe new Stock
ErrorsILLEGAL_STATE stockForm already used in a create transaction
INVALID_ARGUMENTone or more of the form elements is invalid
NULL_ARGUMENT courseId, termId , or stockForm is null
NOT_FOUND stockForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED stockForm did not originate from getStockFormForCreate()
CompliancemandatoryThis 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
CompliancemandatoryThis 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.IdstockIdthe Id of the Stock
Returnosid.inventory.StockFormthe stock form
ErrorsNOT_FOUND stockId is not found
NULL_ARGUMENT stockId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.
MethodupdateStock
Description

Updates an existing stock.

Parametersosid.inventory.StockFormstockFormthe form containing the elements to be updated
ErrorsILLEGAL_STATE stockForm already used in an update transaction
INVALID_ARGUMENTthe form contains an invalid value
NULL_ARGUMENT stockForm is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
UNSUPPORTED stockForm did not originate from getStockFormForUpdate()
CompliancemandatoryThis 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
CompliancemandatoryThis method must be implemented.
MethoddeleteStock
Description

Deletes a Stock.

Parametersosid.id.IdstockIdthe Id of the Stock to remove
ErrorsNOT_FOUND stockId not found
NULL_ARGUMENT stockId is null
OPERATION_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis 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
CompliancemandatoryThis 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.IdstockIdthe Id of a Stock
osid.id.IdaliasIdthe 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_FAILEDunable to complete request
PERMISSION_DENIEDauthorization failure
CompliancemandatoryThis method must be implemented.