Package org.salespointframework.order
Class Order
java.lang.Object
org.salespointframework.core.AbstractEntity<Order.OrderIdentifier>
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
Nested ClassesModifier and TypeClassDescriptionstatic classOrder.OrderIdentifierserves as an identifier type forOrderobjects. - 
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedOrder()Deprecated.Order(UserAccount userAccount) Deprecated, for removal: This API element is subject to removal in a future version.since 9.0.Order(UserAccount.UserAccountIdentifier userAccountIdentifier) Creates a new Order for the givenUserAccount.UserAccountIdentifier.Order(UserAccount.UserAccountIdentifier userAccountIdentifier, PaymentMethod paymentMethod) Order(UserAccount userAccount, PaymentMethod paymentMethod) Deprecated, for removal: This API element is subject to removal in a future version.since 9.0. - 
Method Summary
Modifier and TypeMethodDescriptionaddChargeLine(javax.money.MonetaryAmount price, String description) Adds aChargeLinewith the given price and description to theOrder.addChargeLine(javax.money.MonetaryAmount price, String description, int index) Adds anChargeLine.AttachedChargeLinewith the given price and description to theOrderLinewith the given index.addChargeLine(javax.money.MonetaryAmount price, String description, OrderLine orderLine) Adds anChargeLine.AttachedChargeLinewith the given price and description to the givenOrderLine.addOrderLine(Product product, Quantity quantity) Returns allChargeLineinstances, i.e.Returns allChargeLineinstances registered for the currentOrder.getChargeLines(int index) Returns allChargeLine.AttachedChargeLines for theOrderLinewith the given index.getChargeLines(OrderLine orderLine) Returns allChargeLine.AttachedChargeLines for the givenOrderLine.getId()Returns the unique id of thisOrder.getOrderLines(Product product) javax.money.MonetaryAmountgetTotal()Returns the total price of theOrder.booleanConvenience method for checking if an order has the status CANCELEDbooleanConvenience method for checking if an order has the status COMPLETEDbooleanisOpen()Convenience method for checking if an order has the status OPENbooleanisPaid()Convenience method for checking if an order has the status PAIDvoidremove(ChargeLine chargeLine) Remove the givenChargeLinefrom theOrdervoidremove(ChargeLine.AttachedChargeLine chargeLine) Removes the givenChargeLine.AttachedChargeLinefrom theOrder.voidRemoves the givenOrderLineas well as allChargeLine.AttachedChargeLineassociated with it.voidremoveChargeLinesFor(OrderLine orderLine) Removes allChargeLine.AttachedChargeLines attached to the givenOrderLine.voidsetPaymentMethod(PaymentMethod paymentMethod) Sets the givenPaymentMethodfor theOrdertoString()Methods inherited from class org.salespointframework.core.AbstractAggregateRoot
registerEventMethods inherited from class org.salespointframework.core.AbstractEntity
equals, hashCode, hasId, isNew 
- 
Constructor Details
- 
Order
Creates a new Order for the givenUserAccount.UserAccountIdentifier.- Parameters:
 userAccountIdentifier- The identifier of theUserAccountconnected to this order, must not be null.- Since:
 - 9.0
 
 - 
Order
Deprecated, for removal: This API element is subject to removal in a future version.since 9.0. UseOrder(UserAccountIdentifier)instead.Creates a new Order for the givenUserAccount.- Parameters:
 userAccount- TheUserAccountconnected to this order, must not be null.
 - 
Order
- Parameters:
 userAccountIdentifier- The identifier of theUserAccountconnected to this order, must not be null.paymentMethod- ThePaymentMethodconnected to this order, must not be null.- Since:
 - 9.0
 
 - 
Order
@Deprecated(forRemoval=true, since="9.0") public Order(UserAccount userAccount, PaymentMethod paymentMethod) Deprecated, for removal: This API element is subject to removal in a future version.since 9.0. UseOrder(UserAccountIdentifier, PaymentMethod)instead.- Parameters:
 userAccount- TheUserAccountconnected to this order, must not be null.paymentMethod- ThePaymentMethodconnected to this order, must not be null.
 - 
Order
Deprecated. 
 - 
 - 
Method Details
- 
getId
Returns the unique id of thisOrder.- Returns:
 - will never be null
 
 - 
getOrderLines
- Returns:
 - will never be null.
 
 - 
getOrderLines
- Parameters:
 product- must not be null.- Returns:
 - will never be null.
 - Since:
 - 7.1
 
 - 
getChargeLines
Returns allChargeLineinstances registered for the currentOrder.- Returns:
 - will never be null.
 
 - 
getAllChargeLines
Returns allChargeLineinstances, i.e. both standard ones andChargeLine.AttachedChargeLines.- Returns:
 - will never be null.
 
 - 
getChargeLines
Returns allChargeLine.AttachedChargeLines for theOrderLinewith the given index.- Parameters:
 index- must be in the range ofOrderLines.- Returns:
 - will never be null.
 - Since:
 - 7.1
 
 - 
getChargeLines
Returns allChargeLine.AttachedChargeLines for the givenOrderLine.- Parameters:
 orderLine- must not be null.- Returns:
 - will never be null.
 - Since:
 - 7.1
 
 - 
getTotal
public javax.money.MonetaryAmount getTotal()Returns the total price of theOrder.- Returns:
 - will never be null.
 - Since:
 - 7.1
 
 - 
addOrderLine
- Parameters:
 product- must not be null.quantity- must not be null.- Returns:
 - the 
OrderLineadded, will never be null. - Since:
 - 7.1
 
 - 
remove
Removes the givenOrderLineas well as allChargeLine.AttachedChargeLineassociated with it.- Parameters:
 orderLine- must not be null.
 - 
addChargeLine
Adds aChargeLinewith the given price and description to theOrder.- Parameters:
 price- must not be null.description- must not be null.- Returns:
 - the 
ChargeLinecreated. - Since:
 - 7.1
 
 - 
addChargeLine
public ChargeLine.AttachedChargeLine addChargeLine(javax.money.MonetaryAmount price, String description, int index) Adds anChargeLine.AttachedChargeLinewith the given price and description to theOrderLinewith the given index.- Parameters:
 price- must not be null.description- must not be null.index- must be within the range ofOrderLines already registered.- Returns:
 - the 
ChargeLine.AttachedChargeLinecreated. - Since:
 - 7.1
 
 - 
addChargeLine
public ChargeLine.AttachedChargeLine addChargeLine(javax.money.MonetaryAmount price, String description, OrderLine orderLine) Adds anChargeLine.AttachedChargeLinewith 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.AttachedChargeLinecreated. - Since:
 - 7.1
 
 - 
remove
Remove the givenChargeLinefrom theOrder- Parameters:
 chargeLine- must not be null.
 - 
remove
Removes the givenChargeLine.AttachedChargeLinefrom theOrder.- Parameters:
 chargeLine- must not be null.- Since:
 - 7.1
 
 - 
removeChargeLinesFor
Removes allChargeLine.AttachedChargeLines 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 CANCELED- Returns:
 - true if OrderStatus is CANCELED, 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
Sets the givenPaymentMethodfor theOrder- Parameters:
 paymentMethod- must not be null.
 - 
toString
 - 
getPaymentMethod
 - 
getUserAccountIdentifier
 - 
getDateCreated
 - 
getOrderStatus
 
 -