public interface OrderManager
Modifier and Type | Method and Description |
---|---|
void |
add(Order order)
Adds a new
Order to the OrderManager |
boolean |
cancelOrder(Order order)
Cancels an
Order , it can only be cancelled is OrderStatus is OPEN |
OrderCompletionResult |
completeOrder(Order order)
Tries to complete this order, the
OrderStatus has to be PAYED |
boolean |
contains(OrderIdentifier orderIdentifier)
Checks if this OrderManager contains an order
|
<E extends Order> |
find(java.lang.Class<E> clazz,
org.joda.time.DateTime from,
org.joda.time.DateTime to)
|
<E extends Order> |
find(java.lang.Class<E> clazz,
OrderStatus orderStatus)
|
<E extends Order> |
find(java.lang.Class<E> clazz,
UserAccount userAccount)
Returns all
Order s from the given UserAccountIdentifier . |
<E extends Order> |
find(java.lang.Class<E> clazz,
UserAccount userAccount,
org.joda.time.DateTime from,
org.joda.time.DateTime to)
Returns all
Order s from the given UserAccountIdentifier in between the
dates from and to , including from and to. |
<E extends Order> |
get(java.lang.Class<E> clazz,
OrderIdentifier orderIdentifier)
Returns the order identified by an
OrderIdentifier |
boolean |
payOrder(Order order)
|
void |
update(Order order)
Updates and persists an existing
Order to the PersistentOrderManager and the Database |
void add(Order order)
Order
to the OrderManagerorder
- the Order
to be addedjava.lang.NullPointerException
- if order is null<E extends Order> E get(java.lang.Class<E> clazz, OrderIdentifier orderIdentifier)
OrderIdentifier
orderIdentifier
- identifier of the Order
to be returnedjava.lang.NullPointerException
- if orderIdentifier is nullboolean contains(OrderIdentifier orderIdentifier)
orderIdentifier
- the OrderIdentifier
of the Order
java.lang.NullPointerException
- if orderIdentifier is null<E extends Order> java.lang.Iterable<E> find(java.lang.Class<E> clazz, OrderStatus orderStatus)
Order
s having the OrderStatus
status
. If no orders
with the specified status exist, an empty Iterable is returned.orderStatus
- Denoting the OrderStatus
on which the Order
s will be requested.Order
s with the specified OrderStatus
java.lang.NullPointerException
- if orderStatus is null<E extends Order> java.lang.Iterable<E> find(java.lang.Class<E> clazz, org.joda.time.DateTime from, org.joda.time.DateTime to)
Order
s in between the dates
from
and to
, including from and to. So every
entry with an time stamp <= to and >= from is returned. If no orders
within the specified time span exist, an empty Iterable is returned.from
- time stamp denoting the start of the requested time periodto
- time stamp denoting the end of the requested time periodOrder
s between from and
tojava.lang.NullPointerException
- if from or to are null<E extends Order> java.lang.Iterable<E> find(java.lang.Class<E> clazz, UserAccount userAccount)
Order
s from the given UserAccountIdentifier
. If this user
has no orders, an empty Iterable is returned.userAccount
- Denoting the UserAccount
on which the orders will be
requested.java.lang.NullPointerException
- if clazz oder userAccount are null<E extends Order> java.lang.Iterable<E> find(java.lang.Class<E> clazz, UserAccount userAccount, org.joda.time.DateTime from, org.joda.time.DateTime to)
Order
s from the given UserAccountIdentifier
in between the
dates from
and to
, including from and to. If
this user has no orders in this period, an empty Iterable is
returned.userAccount
- Denoting the UserAccountIdentifier
on which the orders will be
requested.from
- time stamp denoting the start of the requested time periodto
- time stamp denoting the end of the requested time periodjava.lang.NullPointerException
- if any argument is nullOrderCompletionResult completeOrder(Order order)
OrderStatus
has to be PAYEDorder
- the order to completeOrderCompletionResult
void update(Order order)
Order
to the PersistentOrderManager and the Databaseorder
- the Order
to be updatedjava.lang.NullPointerException
- if order is nullboolean payOrder(Order order)
order
- the order to be payedjava.lang.NullPointerException
- if order is nullboolean cancelOrder(Order order)
Order
, it can only be cancelled is OrderStatus
is OPENorder
- the order to be canceledjava.lang.NullPointerException
- if order is null