Interface OrderAdminSession

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

public interface OrderAdminSession extends OsidSession

This session creates, updates, and deletes Orders . 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 Order , an OrderForm is requested using getOrderFormForCreate() specifying the desired record Types or none if no record Types are needed. The returned OrderForm 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 OrderForm is submiited to a create operation, it cannot be reused with another create operation unless the first operation was unsuccessful. Each OrderForm corresponds to an attempted transaction.

For updates, OrderForms are requested to the Order Id that is to be updated using getOrderFormForUpdate() . Similarly, the OrderForm has metadata about the data that can be updated and it can perform validation before submitting the update. The OrderForm can only be used once for a successful update and cannot be reused.

The delete operations delete Orders . To unmap an Order from the current Store , the OrderStoreAssignmentSession should be used. These delete operations attempt to remove the Order itself thus removing it from all known Store catalogs.

This session includes an Id aliasing mechanism to assign an external Id to an internally assigned Id.

  • Method Details

    • getStoreId

      Id getStoreId()
      Gets the Store Id associated with this session.
      Returns:
      the Store Id associated with this session
      Compliance:
      mandatory - This method must be implemented.
    • getStore

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

      boolean canCreateOrders()
      Tests if this user can create order entries. A return of true does not guarantee successful authorization. A return of false indicates that it is known creating an Order will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.
      Returns:
      false if Order creation is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • canCreateOrderWithRecordTypes

      boolean canCreateOrderWithRecordTypes(Type[] orderRecordTypes)
      Tests if this user can create a single Order using the desired record types. While OrderingManager.getOrderRecordTypes() can be used to examine which records are supported, this method tests which record(s) are required for creating a specific Order . Providing an empty array tests if an Order can be created with no records.
      Parameters:
      orderRecordTypes - array of order record types
      Returns:
      true if Order creation using the specified record Types is supported, false otherwise
      Throws:
      NullArgumentException - orderRecordTypes is null
      Compliance:
      mandatory - This method must be implemented.
    • getOrderFormForCreate

      OrderForm getOrderFormForCreate(Type[] orderRecordTypes) throws OperationFailedException, PermissionDeniedException
      Gets the order form for creating new entries. A new form should be requested for each create transaction.
      Parameters:
      orderRecordTypes - array of order record types
      Returns:
      the order form
      Throws:
      NullArgumentException - orderRecordTypes 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.
    • createOrder

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

      boolean canUpdateOrders()
      Tests if this user can update orders. A return of true does not guarantee successful authorization. A return of false indicates that it is known updating an Order will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.
      Returns:
      false if Order modification is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • getOrderFormForUpdate

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

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

      boolean canDeleteOrders()
      Tests if this user can delete orders. A return of true does not guarantee successful authorization. A return of false indicates that it is known deleting an Order will result in a PERMISSION_DENIED . This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.
      Returns:
      false if Order deletion is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • deleteOrder

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

      boolean canManageOrderAliases()
      Tests if this user can manage Id aliases for Orders . 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 Order aliasing is not authorized, true otherwise
      Compliance:
      mandatory - This method must be implemented.
    • aliasOrder

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