@Entity public class Order extends AbstractEntity<OrderIdentifier>
Modifier and Type | Class and Description |
---|---|
static class |
Order.OrderCancelled |
static class |
Order.OrderCompleted |
static class |
Order.OrderPaid |
Modifier | Constructor and Description |
---|---|
protected |
Order() |
|
Order(UserAccount userAccount)
Creates a new Order
|
|
Order(UserAccount userAccount,
PaymentMethod paymentMethod)
|
Modifier and Type | Method and Description |
---|---|
ChargeLine |
add(ChargeLine chargeLine)
Deprecated.
since 7.1, use
addChargeLine(MonetaryAmount, String) instead |
OrderLine |
add(OrderLine orderLine)
Deprecated.
since 7.1, use
addOrderLine(Product, Quantity) instead. |
ChargeLine |
addChargeLine(javax.money.MonetaryAmount price,
String description)
Adds a
ChargeLine with the given price and description to the Order . |
ChargeLine.AttachedChargeLine |
addChargeLine(javax.money.MonetaryAmount price,
String description,
int index)
Adds an
ChargeLine.AttachedChargeLine with the given price and description to the OrderLine with the given
index. |
ChargeLine.AttachedChargeLine |
addChargeLine(javax.money.MonetaryAmount price,
String description,
OrderLine orderLine)
Adds an
ChargeLine.AttachedChargeLine with the given price and description to the given OrderLine . |
OrderLine |
addOrderLine(Product product,
Quantity quantity)
|
Totalable<ChargeLine> |
getAllChargeLines()
Returns all
ChargeLine instances, i.e. both standard ones and ChargeLine.AttachedChargeLine s. |
Totalable<ChargeLine> |
getChargeLines()
Returns all
ChargeLine instances registered for the current Order . |
Totalable<ChargeLine.AttachedChargeLine> |
getChargeLines(int index)
Returns all
ChargeLine.AttachedChargeLine s for the OrderLine with the given index. |
Totalable<ChargeLine.AttachedChargeLine> |
getChargeLines(OrderLine orderLine)
Returns all
ChargeLine.AttachedChargeLine s for the given OrderLine . |
javax.money.MonetaryAmount |
getChargeLinesPrice()
Deprecated.
since 7.1, prefer
getChargeLines() , getAllChargeLines() and call
PricedTotalable#getTotal() on the result for fine grained control over which
ChargeLine s to calculate the total for. |
LocalDateTime |
getDateCreated() |
OrderIdentifier |
getId() |
javax.money.MonetaryAmount |
getOrderedLinesPrice()
Deprecated.
since 7.1, use
getOrderLines() and call Totalable.getTotal() on the result. |
Totalable<OrderLine> |
getOrderLines()
|
Totalable<OrderLine> |
getOrderLines(Product product)
|
OrderStatus |
getOrderStatus() |
PaymentMethod |
getPaymentMethod() |
javax.money.MonetaryAmount |
getTotal()
Returns the total price of the
Order . |
javax.money.MonetaryAmount |
getTotalPrice()
Deprecated.
since 7.1, use
getTotal() instead. |
UserAccount |
getUserAccount() |
boolean |
isCanceled()
Convenience method for checking if an order has the status CANCELLED
|
boolean |
isCompleted()
Convenience method for checking if an order has the status COMPLETED
|
boolean |
isOpen()
Convenience method for checking if an order has the status OPEN
|
boolean |
isPaid()
Convenience method for checking if an order has the status PAID
|
void |
remove(ChargeLine.AttachedChargeLine chargeLine)
Removes the given
ChargeLine.AttachedChargeLine from the Order . |
void |
remove(ChargeLine chargeLine) |
void |
remove(OrderLine orderLine)
Removes the given
OrderLine as well as all ChargeLine.AttachedChargeLine associated with it. |
void |
removeChargeLinesFor(OrderLine orderLine)
Removes all
ChargeLine.AttachedChargeLine s attached to the given OrderLine . |
void |
setPaymentMethod(PaymentMethod paymentMethod) |
String |
toString() |
equals, hashCode, isNew
public Order(UserAccount userAccount)
userAccount
- The UserAccount
connected to this order, must not be null.public Order(UserAccount userAccount, PaymentMethod paymentMethod)
userAccount
- The UserAccount
connected to this order, must not be null.paymentMethod
- The PaymentMethod
connected to this order, must not be null.protected Order()
public OrderIdentifier getId()
public Totalable<OrderLine> getOrderLines(Product product)
product
- must not be null.public Totalable<ChargeLine> getChargeLines()
ChargeLine
instances registered for the current Order
.public Totalable<ChargeLine> getAllChargeLines()
ChargeLine
instances, i.e. both standard ones and ChargeLine.AttachedChargeLine
s.public Totalable<ChargeLine.AttachedChargeLine> getChargeLines(int index)
ChargeLine.AttachedChargeLine
s for the OrderLine
with the given index.index
- must be in the range of OrderLine
s.public Totalable<ChargeLine.AttachedChargeLine> getChargeLines(OrderLine orderLine)
ChargeLine.AttachedChargeLine
s for the given OrderLine
.orderLine
- must not be null.public javax.money.MonetaryAmount getTotal()
Order
.@Deprecated public javax.money.MonetaryAmount getTotalPrice()
getTotal()
instead.Order
.@Deprecated public javax.money.MonetaryAmount getOrderedLinesPrice()
getOrderLines()
and call Totalable.getTotal()
on the result.OrderLine
s.@Deprecated public javax.money.MonetaryAmount getChargeLinesPrice()
getChargeLines()
, getAllChargeLines()
and call
PricedTotalable#getTotal()
on the result for fine grained control over which
ChargeLine
s to calculate the total for.@Deprecated public OrderLine add(OrderLine orderLine)
addOrderLine(Product, Quantity)
instead.orderLine
- the OrderLine
to be added.OrderLine
added.IllegalArgumentException
- if orderLine is null.public OrderLine addOrderLine(Product product, Quantity quantity)
product
- must not be null.quantity
- must not be null.OrderLine
added.public void remove(OrderLine orderLine)
OrderLine
as well as all ChargeLine.AttachedChargeLine
associated with it.orderLine
- must not be null.@Deprecated public ChargeLine add(ChargeLine chargeLine)
addChargeLine(MonetaryAmount, String)
insteadOrder
.chargeLine
- public ChargeLine addChargeLine(javax.money.MonetaryAmount price, String description)
ChargeLine
with the given price and description to the Order
.price
- must not be null.description
- must not be null.ChargeLine
created.public ChargeLine.AttachedChargeLine addChargeLine(javax.money.MonetaryAmount price, String description, int index)
ChargeLine.AttachedChargeLine
with the given price and description to the OrderLine
with the given
index.price
- must not be null.description
- must not be null.index
- must be within the range of OrderLine
s already registered.ChargeLine.AttachedChargeLine
created.public ChargeLine.AttachedChargeLine addChargeLine(javax.money.MonetaryAmount price, String description, OrderLine orderLine)
ChargeLine.AttachedChargeLine
with the given price and description to the given OrderLine
.price
- must not be null.description
- must not be null.orderLine
- must not be null.ChargeLine.AttachedChargeLine
created.public void remove(ChargeLine chargeLine)
public void remove(ChargeLine.AttachedChargeLine chargeLine)
ChargeLine.AttachedChargeLine
from the Order
.chargeLine
- must not be null.public void removeChargeLinesFor(OrderLine orderLine)
ChargeLine.AttachedChargeLine
s attached to the given OrderLine
.orderLine
- must not be null.public boolean isPaid()
public boolean isCanceled()
public boolean isCompleted()
public boolean isOpen()
public final PaymentMethod getPaymentMethod()
public void setPaymentMethod(PaymentMethod paymentMethod)
public UserAccount getUserAccount()
public LocalDateTime getDateCreated()
public OrderStatus getOrderStatus()
Copyright © 2019. All rights reserved.