public interface OrderManager<T extends Order>
Order
s.Modifier and Type | Method and Description |
---|---|
boolean |
cancelOrder(T order)
|
void |
completeOrder(T order)
Tries to complete this order, the
OrderStatus has to be OrderStatus.PAID . |
boolean |
contains(OrderIdentifier orderIdentifier)
Checks if this
OrderManager contains an order. |
Streamable<T> |
findBy(Interval interval)
|
Streamable<T> |
findBy(OrderStatus orderStatus)
|
Streamable<T> |
findBy(UserAccount userAccount)
Returns all
Order s of the given UserAccount . |
Streamable<T> |
findBy(UserAccount userAccount,
Interval interval)
Returns all
Order s from the given UserAccount in between the dates from and to ,
including from and to. |
Optional<T> |
get(OrderIdentifier orderIdentifier)
Returns the order identified by an
OrderIdentifier |
boolean |
payOrder(T order)
|
T |
save(T order)
Saves the given
Order or persists changes to it. |
T save(T order)
Order
or persists changes to it.order
- the order to be saved, must not be null.Optional<T> get(OrderIdentifier orderIdentifier)
OrderIdentifier
orderIdentifier
- identifier of the Order
to be returned, must not be null.Optional.empty()
.boolean contains(OrderIdentifier orderIdentifier)
OrderManager
contains an order.orderIdentifier
- the OrderIdentifier
of the Order
, must not be null.Streamable<T> findBy(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.Streamable
containing all Order
s with the specified OrderStatus
Streamable<T> findBy(Interval interval)
Order
s in between the Interval
. So every entry with an time stamp <= to and >= from is
returned. If no Order
s within the specified time span exist, an empty Iterable
is returned.interval
- The time interval to find Order
s in, must not be null.Streamable
containing all Order
s in the given Interval
.Streamable<T> findBy(UserAccount userAccount)
Order
s of the given UserAccount
. If this user has no orders, an empty Iterable
is returned.userAccount
- Denoting the UserAccount
on which the orders will be requested, must not be
null.Streamable
containing all orders of the specified user.Streamable<T> findBy(UserAccount userAccount, Interval interval)
Order
s from the given UserAccount
in between the dates from
and to
,
including from and to. So every entry with an time stamp <= to and >= from is returned. If this user has no
Order
s in this period, an empty Iterable
is returned.userAccount
- The UserAccount
whose Order
s shall be returned, must not be null.interval
- The time interval to find Order
s in, must not be null.Streamable
containing all orders from the specified user in the specified period.void completeOrder(T order) throws OrderCompletionFailure
OrderStatus
has to be OrderStatus.PAID
.order
- the order to complete, must not be null.OrderCompletionFailure
- in case the order can't be completed.boolean payOrder(T order)
order
- the order to be payed, must not be null.boolean cancelOrder(T order)
order
- the order to be canceled, must not be null.Copyright © 2018 Pivotal Software, Inc.. All rights reserved.