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.
Modifier and Type | Method and Description |
---|---|
void |
aliasOrder(Id orderId,
Id aliasId)
Adds an
Id to an Order for the purpose
of creating compatibility. |
boolean |
canCreateOrders()
Tests if this user can create order entries.
|
boolean |
canCreateOrderWithRecordTypes(Type[] orderRecordTypes)
Tests if this user can create a single
Order using the
desired record types. |
boolean |
canDeleteOrders()
Tests if this user can delete orders.
|
boolean |
canManageOrderAliases()
Tests if this user can manage
Id aliases for
Orders. |
boolean |
canUpdateOrders()
Tests if this user can update orders.
|
Order |
createOrder(OrderForm orderForm)
Creates a new
Order. |
void |
deleteOrder(Id orderId)
Deletes an
Order. |
OrderForm |
getOrderFormForCreate(Type[] orderRecordTypes)
Gets the order form for creating new entries.
|
OrderForm |
getOrderFormForUpdate(Id orderId)
Gets the order form for updating an existing order.
|
Store |
getStore()
Gets the
Store associated with this session. |
Id |
getStoreId()
Gets the
Store Id associated with this
session. |
void |
updateOrder(OrderForm orderForm)
Updates an existing order.
|
getAuthenticatedAgent, getAuthenticatedAgentId, getClockRate, getDate, getEffectiveAgent, getEffectiveAgentId, getFormatType, getLocale, isAuthenticated, startTransaction, supportsTransactions
close
Id getStoreId()
Store
Id
associated with this
session. Store Id
associated with this sessionmandatory
- This method must be implemented. Store getStore() throws OperationFailedException, PermissionDeniedException
Store
associated with this session.OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canCreateOrders()
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. false
if Order
creation is not
authorized, true
otherwisemandatory
- This method must be implemented. boolean canCreateOrderWithRecordTypes(Type[] orderRecordTypes)
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.orderRecordTypes
- array of order record types true
if Order
creation using the
specified record Types
is supported,
false
otherwiseNullArgumentException
- orderRecordTypes
is null
mandatory
- This method must be implemented. OrderForm getOrderFormForCreate(Type[] orderRecordTypes) throws OperationFailedException, PermissionDeniedException
orderRecordTypes
- array of order record typesNullArgumentException
- orderRecordTypes
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- unable to get form for requested
record typesmandatory
- This method must be implemented. Order createOrder(OrderForm orderForm) throws OperationFailedException, PermissionDeniedException
Order.
orderForm
- the form for this Order
Order
IllegalStateException
- orderForm
already used in a create transactionInvalidArgumentException
- one or more of the form
elements is invalidNullArgumentException
- orderForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- orderForm
did not
originate from getOrderFormForCreate()
mandatory
- This method must be implemented. boolean canUpdateOrders()
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. false
if Order
modification is
not authorized, true
otherwisemandatory
- This method must be implemented. OrderForm getOrderFormForUpdate(Id orderId) throws NotFoundException, OperationFailedException, PermissionDeniedException
orderId
- the Id
of the Order
NotFoundException
- orderId
is not foundNullArgumentException
- orderId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. void updateOrder(OrderForm orderForm) throws OperationFailedException, PermissionDeniedException
orderForm
- the form containing the elements to be updatedIllegalStateException
- orderForm
already used in an update transactionInvalidArgumentException
- the form contains an invalid
valueNullArgumentException
- orderForm
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failureUnsupportedException
- orderForm
did not
originate from getOrderFormForUpdate()
mandatory
- This method must be implemented. boolean canDeleteOrders()
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. false
if Order
deletion is not
authorized, true
otherwisemandatory
- This method must be implemented. void deleteOrder(Id orderId) throws NotFoundException, OperationFailedException, PermissionDeniedException
Order.
orderId
- the Id
of the Order
to
removeNotFoundException
- orderId
not foundNullArgumentException
- orderId
is
null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented. boolean canManageOrderAliases()
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. false
if Order
aliasing is not
authorized, true
otherwisemandatory
- This method must be implemented. void aliasOrder(Id orderId, Id aliasId) throws AlreadyExistsException, NotFoundException, OperationFailedException, PermissionDeniedException
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.
orderId
- the Id
of an Order
aliasId
- the alias Id
AlreadyExistsException
- aliasId
is
already assignedNotFoundException
- orderId
not foundNullArgumentException
- orderId
or
aliasId
is null
OperationFailedException
- unable to complete requestPermissionDeniedException
- authorization failuremandatory
- This method must be implemented.