Package org.salespointframework.order
Interface OrderManagement<T extends Order>
A service to manage
Orders.- Author:
- Thomas Dedek, Paul Henke, Oliver Gierke
-
Method Summary
Modifier and TypeMethodDescriptionbooleancancelOrder(T order, String reason) Cancels anOrder, no matter what state it is in.voidcompleteOrder(T order) Tries to complete this order, theOrderStatushas to beOrderStatus.PAID.booleancontains(Order.OrderIdentifier orderIdentifier) Checks if thisOrderManagementcontains an order.Deletes the givenOrder.findBy(OrderStatus orderStatus) findBy(UserAccount userAccount) Returns allOrders of the givenUserAccount.findBy(UserAccount userAccount, Interval interval) Returns allOrders from the givenUserAccountin between the datesfromandto, including from and to.get(Order.OrderIdentifier orderIdentifier) Returns the order identified by anOrder.OrderIdentifierbooleanSaves the givenOrderor persists changes to it.
-
Method Details
-
save
Saves the givenOrderor 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 theOrderto be returned, must not be null.- Returns:
- the order if the orderIdentifier matches, otherwise
Optional.empty().
-
contains
Checks if thisOrderManagementcontains an order.- Parameters:
orderIdentifier- theOrder.OrderIdentifierof theOrder, must not be null.- Returns:
- true if the OrderManager contains the order, false otherwise.
-
findBy
Returns allOrders having theOrderStatusstatus. If no orders with the specified status exist, an empty Iterable is returned.- Parameters:
orderStatus- Denoting theOrderStatuson which theOrders will be requested.- Returns:
- a
Streamablecontaining allOrders with the specifiedOrderStatus
-
findBy
Returns allOrders in between theInterval. So every entry with an time stamp ≤ and ≥ from is returned. If noOrders within the specified time span exist, an emptyIterableis returned.- Parameters:
interval- The time interval to findOrders in, must not be null.- Returns:
- a
Streamablecontaining allOrders in the givenInterval.
-
findBy
Returns allOrders of the givenUserAccount. If this user has no orders, an emptyIterableis returned.- Parameters:
userAccount- Denoting theUserAccounton which the orders will be requested, must not be null.- Returns:
- a
Streamablecontaining all orders of the specified user.
-
findBy
Returns allOrders from the givenUserAccountin between the datesfromandto, including from and to. So every entry with an time stamp ≤ to and ≥ from is returned. If this user has noOrders in this period, an emptyIterableis returned.- Parameters:
userAccount- TheUserAccountwhoseOrders shall be returned, must not be null.interval- The time interval to findOrders in, must not be null.- Returns:
- a
Streamablecontaining all orders from the specified user in the specified period.
-
completeOrder
Tries to complete this order, theOrderStatushas 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
-