Interface StockAdminSession

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

public interface StockAdminSession extends OsidSession

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.

  • 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.
    • canCreateStocks

      boolean canCreateStocks()
      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.
      Returns:
      false if Stock creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateStockWithRecordTypes

      boolean canCreateStockWithRecordTypes(Type[] stockRecordTypes)
      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.
      Parameters:
      stockRecordTypes - array of stock record types
      Returns:
      true if Stock creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - stockRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getStockFormForCreate

      StockForm getStockFormForCreate(Type[] stockRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the stock form for creating new stocks. A new form should be requested for each create transaction.
      Parameters:
      stockRecordTypes - array of stock record types
      Returns:
      the stock form
      Throws:
      NullArgumentException - stockRecordTypes 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.
    • createStock

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

      boolean canUpdateStocks()
      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.
      Returns:
      false if Stock modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getStockFormForUpdate

      Gets the stock form for updating an existing stock. A new stock form should be requested for each update transaction.
      Parameters:
      stockId - the Id of the Stock
      Returns:
      the stock form
      Throws:
      NotFoundException - stockId is not found
      NullArgumentException - stockId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • updateStock

      void updateStock(StockForm stockForm) throws OperationFailedException, PermissionDeniedException
      Updates an existing stock.
      Parameters:
      stockForm - the form containing the elements to be updated
      Throws:
      IllegalStateException - stockForm already used in an update transaction
      InvalidArgumentException - the form contains an invalid value
      NullArgumentException - stockForm is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      UnsupportedException - stockForm did not originate from getStockFormForUpdate()
      Compliance:
      mandatory - This method must be implemented.
    • canDeleteStocks

      boolean canDeleteStocks()
      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.
      Returns:
      false if Stock deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteStock

      Deletes a Stock .
      Parameters:
      stockId - the Id of the Stock to remove
      Throws:
      NotFoundException - stockId not found
      NullArgumentException - stockId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.
    • canManageStockAliases

      boolean canManageStockAliases()
      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.
      Returns:
      false if Stock aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasStock

      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 .
      Parameters:
      stockId - the Id of a Stock
      aliasId - the alias Id
      Throws:
      AlreadyExistsException - aliasId is in use as a primary Id
      NotFoundException - stockId not found
      NullArgumentException - stockId or aliasId is null
      OperationFailedException - unable to complete request
      PermissionDeniedException - authorization failure
      Compliance:
      mandatory - This method must be implemented.