Package org.salespointframework.order
Class Order
java.lang.Object
org.salespointframework.core.AbstractEntity<ID>
org.salespointframework.core.AbstractAggregateRoot<Order.OrderIdentifier>
org.salespointframework.order.Order
- All Implemented Interfaces:
Persistable<Order.OrderIdentifier>
- Author:
- Thomas Dedek, Paul Henke, Oliver Gierke
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Order.OrderIdentifier
serves as an identifier type forOrder
objects. -
Constructor Summary
ModifierConstructorDescriptionprotected
Order()
Deprecated.Order
(UserAccount userAccount) Creates a new OrderOrder
(UserAccount userAccount, PaymentMethod paymentMethod) -
Method Summary
Modifier and TypeMethodDescriptionaddChargeLine
(javax.money.MonetaryAmount price, String description) Adds aChargeLine
with the given price and description to theOrder
.addChargeLine
(javax.money.MonetaryAmount price, String description, int index) Adds anChargeLine.AttachedChargeLine
with the given price and description to theOrderLine
with the given index.addChargeLine
(javax.money.MonetaryAmount price, String description, OrderLine orderLine) Adds anChargeLine.AttachedChargeLine
with the given price and description to the givenOrderLine
.addOrderLine
(Product product, Quantity quantity) Returns allChargeLine
instances, i.e.Returns allChargeLine
instances registered for the currentOrder
.getChargeLines
(int index) Returns allChargeLine.AttachedChargeLine
s for theOrderLine
with the given index.getChargeLines
(OrderLine orderLine) Returns allChargeLine.AttachedChargeLine
s for the givenOrderLine
.getId()
getOrderLines
(Product product) javax.money.MonetaryAmount
getTotal()
Returns the total price of theOrder
.boolean
Convenience method for checking if an order has the status CANCELLEDboolean
Convenience method for checking if an order has the status COMPLETEDboolean
isOpen()
Convenience method for checking if an order has the status OPENboolean
isPaid()
Convenience method for checking if an order has the status PAIDvoid
remove
(ChargeLine chargeLine) void
remove
(ChargeLine.AttachedChargeLine chargeLine) Removes the givenChargeLine.AttachedChargeLine
from theOrder
.void
Removes the givenOrderLine
as well as allChargeLine.AttachedChargeLine
associated with it.void
removeChargeLinesFor
(OrderLine orderLine) Removes allChargeLine.AttachedChargeLine
s attached to the givenOrderLine
.void
setPaymentMethod
(PaymentMethod paymentMethod) toString()
Methods inherited from class org.salespointframework.core.AbstractAggregateRoot
registerEvent
Methods inherited from class org.salespointframework.core.AbstractEntity
equals, hashCode, hasId, isNew
-
Constructor Details
-
Order
Creates a new Order- Parameters:
userAccount
- TheUserAccount
connected to this order, must not be null.
-
Order
- Parameters:
userAccount
- TheUserAccount
connected to this order, must not be null.paymentMethod
- ThePaymentMethod
connected to this order, must not be null.
-
Order
Deprecated.
-
-
Method Details
-
getId
-
getOrderLines
- Returns:
-
getOrderLines
- Parameters:
product
- must not be null.- Returns:
- Since:
- 7.1
-
getChargeLines
Returns allChargeLine
instances registered for the currentOrder
.- Returns:
-
getAllChargeLines
Returns allChargeLine
instances, i.e. both standard ones andChargeLine.AttachedChargeLine
s.- Returns:
-
getChargeLines
Returns allChargeLine.AttachedChargeLine
s for theOrderLine
with the given index.- Parameters:
index
- must be in the range ofOrderLine
s.- Returns:
- Since:
- 7.1
-
getChargeLines
Returns allChargeLine.AttachedChargeLine
s for the givenOrderLine
.- Parameters:
orderLine
- must not be null.- Returns:
- Since:
- 7.1
-
getTotal
public javax.money.MonetaryAmount getTotal()Returns the total price of theOrder
.- Returns:
- Since:
- 7.1
-
addOrderLine
- Parameters:
product
- must not be null.quantity
- must not be null.- Returns:
- the
OrderLine
added. - Since:
- 7.1
-
remove
Removes the givenOrderLine
as well as allChargeLine.AttachedChargeLine
associated with it.- Parameters:
orderLine
- must not be null.
-
addChargeLine
Adds aChargeLine
with the given price and description to theOrder
.- Parameters:
price
- must not be null.description
- must not be null.- Returns:
- the
ChargeLine
created. - Since:
- 7.1
-
addChargeLine
public ChargeLine.AttachedChargeLine addChargeLine(javax.money.MonetaryAmount price, String description, int index) Adds anChargeLine.AttachedChargeLine
with the given price and description to theOrderLine
with the given index.- Parameters:
price
- must not be null.description
- must not be null.index
- must be within the range ofOrderLine
s already registered.- Returns:
- the
ChargeLine.AttachedChargeLine
created. - Since:
- 7.1
-
addChargeLine
public ChargeLine.AttachedChargeLine addChargeLine(javax.money.MonetaryAmount price, String description, OrderLine orderLine) Adds anChargeLine.AttachedChargeLine
with the given price and description to the givenOrderLine
.- Parameters:
price
- must not be null.description
- must not be null.orderLine
- must not be null.- Returns:
- the
ChargeLine.AttachedChargeLine
created. - Since:
- 7.1
-
remove
-
remove
Removes the givenChargeLine.AttachedChargeLine
from theOrder
.- Parameters:
chargeLine
- must not be null.- Since:
- 7.1
-
removeChargeLinesFor
Removes allChargeLine.AttachedChargeLine
s attached to the givenOrderLine
.- Parameters:
orderLine
- must not be null.- Since:
- 7.1
-
isPaid
public boolean isPaid()Convenience method for checking if an order has the status PAID- Returns:
- true if OrderStatus is PAID, otherwise false
-
isCanceled
public boolean isCanceled()Convenience method for checking if an order has the status CANCELLED- Returns:
- true if OrderStatus is CANCELLED, otherwise false
-
isCompleted
public boolean isCompleted()Convenience method for checking if an order has the status COMPLETED- Returns:
- true if OrderStatus is COMPLETED, otherwise false
-
isOpen
public boolean isOpen()Convenience method for checking if an order has the status OPEN- Returns:
- true if OrderStatus is OPEN, otherwise false
-
setPaymentMethod
-
toString
-
getPaymentMethod
-
getUserAccount
-
getDateCreated
-
getOrderStatus
-