Interface OrderAdminSession
- All Superinterfaces:
AutoCloseable, Closeable, OsidSession, OsidSession
- All Known Subinterfaces:
OrderBatchAdminSession
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 Summary
Modifier and TypeMethodDescriptionvoidaliasOrder(Id orderId, Id aliasId) Adds anIdto anOrderfor the purpose of creating compatibility.booleanTests if this user can create order entries.booleancanCreateOrderWithRecordTypes(Type[] orderRecordTypes) Tests if this user can create a singleOrderusing the desired record types.booleanTests if this user can delete orders.booleanTests if this user can manageIdaliases forOrders.booleanTests if this user can update orders.createOrder(OrderForm orderForm) Creates a newOrder.voiddeleteOrder(Id orderId) Deletes anOrder.getOrderFormForCreate(Type[] orderRecordTypes) Gets the order form for creating new entries.getOrderFormForUpdate(Id orderId) Gets the order form for updating an existing order.getStore()Gets theStoreassociated with this session.Gets theStoreIdassociated with this session.voidupdateOrder(OrderForm orderForm) Updates an existing order.Methods inherited from interface OsidSession
closeMethods inherited from interface OsidSession
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactionsModifier and TypeMethodDescriptionGets the agent authenticated to this session.Gets theIdof the agent authenticated to this session.Gets the rate of the service clock.getDate()Gets the service date which may be the current date or the effective date in which this session exists.Gets the effective agent in use by this session.Gets theIdof the effective agent in use by this session.Gets theDisplayTextformatTypepreference in effect for this session.Gets the locale indicating the localization preferences in effect for this session.booleanTests if an agent is authenticated to this session.Starts a new transaction for this sesson.booleanTests for the availability of transactions.
-
Method Details
-
getStoreId
Id getStoreId()Gets theStoreIdassociated with this session.- Returns:
- the
Store Idassociated with this session - Compliance:
mandatory- This method must be implemented.
-
getStore
Gets theStoreassociated with this session.- Returns:
- the store
- Throws:
OperationFailedException- unable to complete requestPermissionDeniedException- 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 anOrderwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer create operations to unauthorized users.- Returns:
falseifOrdercreation is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
canCreateOrderWithRecordTypes
Tests if this user can create a singleOrderusing the desired record types. WhileOrderingManager.getOrderRecordTypes()can be used to examine which records are supported, this method tests which record(s) are required for creating a specificOrder. Providing an empty array tests if anOrdercan be created with no records.- Parameters:
orderRecordTypes- array of order record types- Returns:
trueifOrdercreation using the specified recordTypesis supported,falseotherwise- Throws:
NullArgumentException-orderRecordTypesisnull- 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-orderRecordTypesisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException- unable to get form for requested record types- Compliance:
mandatory- This method must be implemented.
-
createOrder
Creates a newOrder.- Parameters:
orderForm- the form for thisOrder- Returns:
- the new
Order - Throws:
IllegalStateException-orderFormalready used in a create transactionInvalidArgumentException- one or more of the form elements is invalidNullArgumentException-orderFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-orderFormdid not originate fromgetOrderFormForCreate()- 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 anOrderwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer update operations to unauthorized users.- Returns:
falseifOrdermodification is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
getOrderFormForUpdate
OrderForm getOrderFormForUpdate(Id orderId) throws NotFoundException, OperationFailedException, PermissionDeniedException Gets the order form for updating an existing order. A new order form should be requested for each update transaction.- Parameters:
orderId- theIdof theOrder- Returns:
- the order form
- Throws:
NotFoundException-orderIdis not foundNullArgumentException-orderIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
updateOrder
Updates an existing order.- Parameters:
orderForm- the form containing the elements to be updated- Throws:
IllegalStateException-orderFormalready used in an update transactionInvalidArgumentException- the form contains an invalid valueNullArgumentException-orderFormisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failureUnsupportedException-orderFormdid not originate fromgetOrderFormForUpdate()- 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 anOrderwill result in aPERMISSION_DENIED. This is intended as a hint to an application that may not wish to offer delete operations to unauthorized users.- Returns:
falseifOrderdeletion is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
deleteOrder
void deleteOrder(Id orderId) throws NotFoundException, OperationFailedException, PermissionDeniedException Deletes anOrder.- Parameters:
orderId- theIdof theOrderto remove- Throws:
NotFoundException-orderIdnot foundNullArgumentException-orderIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-
canManageOrderAliases
boolean canManageOrderAliases()Tests if this user can manageIdaliases forOrders. A return of true does not guarantee successful authorization. A return of false indicates that it is known changing an alias will result in aPERMISSION_DENIED. This is intended as a hint to an application that may opt not to offer alias operations to an unauthorized user.- Returns:
falseifOrderaliasing is not authorized,trueotherwise- Compliance:
mandatory- This method must be implemented.
-
aliasOrder
void aliasOrder(Id orderId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException Adds anIdto anOrderfor the purpose of creating compatibility. The primaryIdof theOrderis determined by the provider. The newIdperforms as an alias to the primaryId. If the alias is a pointer to another order, it is reassigned to the given orderId.- Parameters:
orderId- theIdof anOrderaliasId- the aliasId- Throws:
AlreadyExistsException-aliasIdis already assignedNotFoundException-orderIdnot foundNullArgumentException-orderIdoraliasIdisnullOperationFailedException- unable to complete requestPermissionDeniedException- authorization failure- Compliance:
mandatory- This method must be implemented.
-