Package org.salespointframework.order
Interface OrderManagement<T extends Order>
A service to manage
Order
s.- Author:
- Thomas Dedek, Paul Henke, Oliver Gierke
-
Method Summary
Modifier and TypeMethodDescriptionboolean
cancelOrder
(T order, String reason) Cancels anOrder
, no matter what state it is in.void
completeOrder
(T order) Tries to complete this order, theOrderStatus
has to beOrderStatus.PAID
.boolean
contains
(Order.OrderIdentifier orderIdentifier) Checks if thisOrderManagement
contains an order.Deletes the givenOrder
.findBy
(OrderStatus orderStatus) findBy
(UserAccount userAccount) Returns allOrder
s of the givenUserAccount
.findBy
(UserAccount userAccount, Interval interval) Returns allOrder
s from the givenUserAccount
in between the datesfrom
andto
, including from and to.get
(Order.OrderIdentifier orderIdentifier) Returns the order identified by anOrder.OrderIdentifier
boolean
Saves the givenOrder
or persists changes to it.
-
Method Details
-
save
Saves the givenOrder
or persists changes to it.- Parameters:
order
- the order to be saved, must not be null.- Returns:
-
get
Returns the order identified by anOrder.OrderIdentifier
- Parameters:
orderIdentifier
- identifier of theOrder
to be returned, must not be null.- Returns:
- the order if the orderIdentifier matches, otherwise
Optional.empty()
.
-
contains
Checks if thisOrderManagement
contains an order.- Parameters:
orderIdentifier
- theOrder.OrderIdentifier
of theOrder
, must not be null.- Returns:
- true if the OrderManager contains the order, false otherwise.
-
findBy
Returns allOrder
s having theOrderStatus
status
. If no orders with the specified status exist, an empty Iterable is returned.- Parameters:
orderStatus
- Denoting theOrderStatus
on which theOrder
s will be requested.- Returns:
- a
Streamable
containing allOrder
s with the specifiedOrderStatus
-
findBy
Returns allOrder
s in between theInterval
. So every entry with an time stamp ≤ and ≥ from is returned. If noOrder
s within the specified time span exist, an emptyIterable
is returned.- Parameters:
interval
- The time interval to findOrder
s in, must not be null.- Returns:
- a
Streamable
containing allOrder
s in the givenInterval
.
-
findBy
Returns allOrder
s of the givenUserAccount
. If this user has no orders, an emptyIterable
is returned.- Parameters:
userAccount
- Denoting theUserAccount
on which the orders will be requested, must not be null.- Returns:
- a
Streamable
containing all orders of the specified user.
-
findBy
Returns allOrder
s from the givenUserAccount
in between the datesfrom
andto
, including from and to. So every entry with an time stamp ≤ to and ≥ from is returned. If this user has noOrder
s in this period, an emptyIterable
is returned.- Parameters:
userAccount
- TheUserAccount
whoseOrder
s shall be returned, must not be null.interval
- The time interval to findOrder
s in, must not be null.- Returns:
- a
Streamable
containing all orders from the specified user in the specified period.
-
completeOrder
Tries to complete this order, theOrderStatus
has to beOrderStatus.PAID
.- Parameters:
order
- the order to complete, must not be null.- Throws:
OrderCompletionFailure
- in case the order can't be completed.- See Also:
-
payOrder
- Parameters:
order
- the order to be payed, must not be null.- Returns:
- true if the order could be paid
- See Also:
-
cancelOrder
Cancels anOrder
, no matter what state it is in.- Parameters:
order
- the order to be canceled, must not be null.reason
- the reason the order was canceled.- Returns:
- true if the order could be canceled
- See Also:
-
delete
Deletes the givenOrder
.- Parameters:
order
- must not be null.- Returns:
- the deleted
Order
- Since:
- 7.1
-
findAll
-