com.elasticpath.domain.order.impl
Class OrderImpl

java.lang.Object
  extended by com.elasticpath.domain.impl.AbstractEpDomainImpl
      extended by com.elasticpath.domain.impl.AbstractPersistenceImpl
          extended by com.elasticpath.domain.impl.AbstractEntityImpl
              extended by com.elasticpath.domain.order.impl.OrderImpl
All Implemented Interfaces:
Entity, EpDomain, Order, Persistence, java.io.Serializable

public class OrderImpl
extends AbstractEntityImpl
implements Order

The default implementation of Order.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
          Serial version id.
 
Constructor Summary
OrderImpl()
           
 
Method Summary
 void addOrderNote(OrderNote orderNote)
          Add a order note.
 void addOrderPayment(OrderPayment orderPayment)
          Add a payment to the order.
 void addOrderSku(OrderSku orderSku)
          Add an order SKU.
 void addReturn(OrderReturn orderReturn)
          Add a return to the order.
 void addShipment(OrderShipment orderShipment)
          Add an order shipment.
 void executeBeforePersistAction()
          Update the last modified date.
 java.util.Set getAppliedRules()
          Get the set of AppliedRule objects that correspond to rules that were fired while processing this order.
 java.math.BigDecimal getBalanceAmount()
          Return the balance amount for this order.
 java.math.BigDecimal getBeforeTaxSubtotal()
          Get the order before-tax subtotal of all items in the cart.
 Money getBeforeTaxSubtotalMoney()
          Get the before-tax subtotal of all items in the cart.
 java.math.BigDecimal getBeforeTaxTotal()
          Get the order before-tax total.
 Money getBeforeTaxTotalMoney()
          Get the before-tax total of all items in the cart as Money object.
 Money getBeforeTaxTotalShippingCostMoney()
          Get the before-tax total shipping cost for this order.
 OrderAddress getBillingAddress()
          Get the billing address corresponding to this order.
 java.util.Date getCreatedDate()
          Get the date that this order was created on.
 java.math.BigDecimal getCreditAmount()
          Return the credit amount for this order.
 java.util.Currency getCurrency()
          Get the order's currency.
 Customer getCustomer()
          Get the customer corresponding to this order.
 java.lang.String getGuid()
          Return the guid.
 java.lang.String getIpAddress()
          Get the ip address of the computer that created the order.
 CmUser getLastModifiedBy()
          Get the CM user who last modifed this order sku.
 java.util.Date getLastModifiedDate()
          Get the date that the order was last modified on.
 java.util.Locale getLocale()
          Get the order's locale.
 java.util.Set getOrderNotes()
          Get the CSR notes associatied with this order.
 java.lang.String getOrderNumber()
          Get the order number that is used by customers to reference their order.
 OrderPayment getOrderPayment()
          Convenience method to retrieve a default order payment for this order.
 java.util.Set getOrderPayments()
          Get the payment(s) for this order.
 java.util.Set getOrderSkus()
          Get the SKUs in this order.
 java.util.Set getOrderTaxes()
          Return the set of OrderTaxValues.
 java.math.BigDecimal getPaidAmount()
          Return the paid amount for this order.
 java.util.Set getReturns()
          Get the returns associatied with this order.
 java.util.Set getShipments()
          Get the shipments associatied with this order.
 Address getShippingAddress()
          Convenience method that should only be used when only a single shipment is supported for a single order.
 OrderStatus getStatus()
          Get the status of the order.
 java.math.BigDecimal getSubtotal()
          Get the order subtotal of all items in the cart.
 java.math.BigDecimal getSubtotalDiscount()
          Get the discount to the shopping cart subtotal.
 Money getSubtotalDiscountMoney()
          Get the sub total of all items in the cart after shipping, promotions, etc.
 Money getSubtotalMoney()
          Get the subtotal of all items in the cart.
 java.math.BigDecimal getTotal()
          Get the order total paid by the customer.
 Money getTotalMoney()
          Get the sub total of all items in the cart after shipping, promotions, etc.
 Money getTotalShippingCostMoney()
          Get the total shipping cost for this order.
 java.math.BigDecimal getTotalTaxes()
          Calculate total taxes on order.
 Money getTotalTaxMoney()
          Get the total tax for this order.
 boolean hasSubtotalDiscount()
          Returns true if an order subtotal discount has been applied.
 boolean isInclusiveTaxCalculation()
          Return whether this order is based on inclusive tax calculation or not.
 void setAppliedRules(java.util.Set appliedRules)
          Set the AppliedRule objects that represent rules that were fired while processing this order.
 void setBeforeTaxSubtotal(java.math.BigDecimal beforeTaxSubtotal)
          Set the order before-tax subtotal paid by the customer.
 void setBeforeTaxTotal(java.math.BigDecimal beforeTaxTotal)
          Set the order before-tax total.
 void setBillingAddress(OrderAddress orderBillingAddress)
          Set the billing address corresponding to this order.
 void setCreatedDate(java.util.Date createdDate)
          Set the date that the order is created.
 void setCurrency(java.util.Currency currency)
          Set the order's currency.
 void setCustomer(Customer customer)
          Set the customer corresponding to this order.
 void setDefaultValues()
          Set default values for those fields need default values.
 void setGuid(java.lang.String guid)
          Set the guid.
 void setInclusiveTaxCalculation(boolean inclusiveTaxCalculation)
          Set whether this order is based on inclusive tax calculation or not.
 void setIpAddress(java.lang.String ipAddress)
          Set the ip address of the computer creating the order.
 void setLastModifiedBy(CmUser lastModifiedBy)
          Set the CM User who last modified this order sku.
 void setLastModifiedDate(java.util.Date lastModifiedDate)
          Set the date that the order was last modified on.
 void setLocale(java.util.Locale locale)
          Set the oder's locale.
 void setOrderNotes(java.util.Set orderNotes)
          Set the CSR Notes of this order.
 void setOrderNumber(java.lang.String orderNumber)
          Set the order number that is used by customers to reference their order.
 void setOrderPayments(java.util.Set orderPayments)
          Set the payment(s) for this order.
 void setOrderSkus(java.util.Set orderSkus)
          Set the SKUs in this order.
 void setOrderTaxes(java.util.Set orderTaxes)
          Set the set of OrderTaxValues.
 void setReturns(java.util.Set returns)
          Set the returns of this order.
 void setShipments(java.util.Set shipments)
          Set the shipments of this order.
 void setStatus(OrderStatus status)
          Set the status of the order.
 void setSubtotal(java.math.BigDecimal subtotal)
          Set the order subtotal paid by the customer.
 void setSubtotalDiscount(java.math.BigDecimal discountAmount)
          Applies a discount to the shopping cart subtotal.
 void setTotal(java.math.BigDecimal orderTotal)
          Set the order total paid by the customer.
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEntityImpl
convertAttributeGroupAttributes
 
Methods inherited from class com.elasticpath.domain.impl.AbstractPersistenceImpl
getUidPk, isPersistent, setUidPk
 
Methods inherited from class com.elasticpath.domain.impl.AbstractEpDomainImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.domain.Persistence
getUidPk, isPersistent, setUidPk
 
Methods inherited from interface com.elasticpath.domain.EpDomain
getElasticPath, setElasticPath
 

Field Detail

serialVersionUID

public static final long serialVersionUID
Serial version id.

See Also:
Constant Field Values
Constructor Detail

OrderImpl

public OrderImpl()
Method Detail

addOrderNote

public void addOrderNote(OrderNote orderNote)
Add a order note.

Specified by:
addOrderNote in interface Order
Parameters:
orderNote - a new order note.

addOrderPayment

public void addOrderPayment(OrderPayment orderPayment)
Add a payment to the order.

Specified by:
addOrderPayment in interface Order
Parameters:
orderPayment - an OrderPayment

addOrderSku

public void addOrderSku(OrderSku orderSku)
Add an order SKU.

Specified by:
addOrderSku in interface Order
Parameters:
orderSku - the order SKU to add

addReturn

public void addReturn(OrderReturn orderReturn)
Add a return to the order.

Specified by:
addReturn in interface Order
Parameters:
orderReturn - the OrderReturn instance.

addShipment

public void addShipment(OrderShipment orderShipment)
Add an order shipment.

Specified by:
addShipment in interface Order
Parameters:
orderShipment - the order shipment to add

executeBeforePersistAction

public void executeBeforePersistAction()
Update the last modified date.

Specified by:
executeBeforePersistAction in interface Persistence
Overrides:
executeBeforePersistAction in class AbstractPersistenceImpl

getAppliedRules

public java.util.Set getAppliedRules()
Get the set of AppliedRule objects that correspond to rules that were fired while processing this order.

Specified by:
getAppliedRules in interface Order
Returns:
a set of AppliedRule objects

getBalanceAmount

public java.math.BigDecimal getBalanceAmount()
Return the balance amount for this order.

Specified by:
getBalanceAmount in interface Order
Returns:
the balance amount for this order.

getBeforeTaxSubtotal

public java.math.BigDecimal getBeforeTaxSubtotal()
Get the order before-tax subtotal of all items in the cart.

Specified by:
getBeforeTaxSubtotal in interface Order
Returns:
a BigDecimal object representing the order before-tax subtotal

getBeforeTaxSubtotalMoney

public Money getBeforeTaxSubtotalMoney()
Get the before-tax subtotal of all items in the cart.

Specified by:
getBeforeTaxSubtotalMoney in interface Order
Returns:
a Money object representing the before-tax subtotal

getBeforeTaxTotal

public java.math.BigDecimal getBeforeTaxTotal()
Get the order before-tax total.

Specified by:
getBeforeTaxTotal in interface Order
Returns:
a BigDecimal object representing the order before-tax total

getBeforeTaxTotalMoney

public Money getBeforeTaxTotalMoney()
Get the before-tax total of all items in the cart as Money object.

Specified by:
getBeforeTaxTotalMoney in interface Order
Returns:
a Money object representing the before-tax total

getBeforeTaxTotalShippingCostMoney

public Money getBeforeTaxTotalShippingCostMoney()
Get the before-tax total shipping cost for this order.

Specified by:
getBeforeTaxTotalShippingCostMoney in interface Order
Returns:
a Money representing the before-tax total shipping cost

getBillingAddress

public OrderAddress getBillingAddress()
Get the billing address corresponding to this order.

Specified by:
getBillingAddress in interface Order
Returns:
the order address Uid

getCreatedDate

public java.util.Date getCreatedDate()
Get the date that this order was created on.

Specified by:
getCreatedDate in interface Order
Returns:
the created date

getCreditAmount

public java.math.BigDecimal getCreditAmount()
Return the credit amount for this order.

Specified by:
getCreditAmount in interface Order
Returns:
the credit amount for this order.

getCurrency

public java.util.Currency getCurrency()
Get the order's currency.

Specified by:
getCurrency in interface Order
Returns:
the Currency

getCustomer

public Customer getCustomer()
Get the customer corresponding to this order.

Specified by:
getCustomer in interface Order
Returns:
the customer Uid

getGuid

public java.lang.String getGuid()
Return the guid.

Specified by:
getGuid in interface Entity
Overrides:
getGuid in class AbstractEntityImpl
Returns:
the guid.

getIpAddress

public java.lang.String getIpAddress()
Get the ip address of the computer that created the order.

Specified by:
getIpAddress in interface Order
Returns:
the ip address

getLastModifiedBy

public CmUser getLastModifiedBy()
Get the CM user who last modifed this order sku.

Specified by:
getLastModifiedBy in interface Order
Returns:
the CM user

getLastModifiedDate

public java.util.Date getLastModifiedDate()
Get the date that the order was last modified on.

Specified by:
getLastModifiedDate in interface Order
Returns:
the last modified date

getLocale

public java.util.Locale getLocale()
Get the order's locale.

Specified by:
getLocale in interface Order
Returns:
the Locale

getOrderNotes

public java.util.Set getOrderNotes()
Get the CSR notes associatied with this order.

Specified by:
getOrderNotes in interface Order
Returns:
the orders's OrderNotes

getOrderNumber

public java.lang.String getOrderNumber()
Get the order number that is used by customers to reference their order.

Specified by:
getOrderNumber in interface Order
Returns:
the order number

getOrderPayment

public OrderPayment getOrderPayment()
Convenience method to retrieve a default order payment for this order. This should only be used when only a single payment is supported for a single order.

Specified by:
getOrderPayment in interface Order
Returns:
the first order payment for this Order

getOrderPayments

public java.util.Set getOrderPayments()
Get the payment(s) for this order.

Specified by:
getOrderPayments in interface Order
Returns:
a set of OrderPayment objects

getOrderSkus

public java.util.Set getOrderSkus()
Get the SKUs in this order.

Specified by:
getOrderSkus in interface Order
Returns:
the orders's OrderSkuss

getOrderTaxes

public java.util.Set getOrderTaxes()
Return the set of OrderTaxValues.

Specified by:
getOrderTaxes in interface Order
Returns:
the set of OrderTaxValues.

getPaidAmount

public java.math.BigDecimal getPaidAmount()
Return the paid amount for this order.

Specified by:
getPaidAmount in interface Order
Returns:
the paid amount for this order.

getReturns

public java.util.Set getReturns()
Get the returns associatied with this order.

Specified by:
getReturns in interface Order
Returns:
the orders's OrderReturns

getShipments

public java.util.Set getShipments()
Get the shipments associatied with this order.

Specified by:
getShipments in interface Order
Returns:
the orders's OrderShipments

getShippingAddress

public Address getShippingAddress()
Convenience method that should only be used when only a single shipment is supported for a single order.

Specified by:
getShippingAddress in interface Order
Returns:
The shipping address of one of this order's shipments

getStatus

public OrderStatus getStatus()
Get the status of the order.

Specified by:
getStatus in interface Order
Returns:
the order status

getSubtotal

public java.math.BigDecimal getSubtotal()
Get the order subtotal of all items in the cart.

Specified by:
getSubtotal in interface Order
Returns:
a BigDecimal object representing the order subtotal

getSubtotalDiscount

public java.math.BigDecimal getSubtotalDiscount()
Get the discount to the shopping cart subtotal.

Specified by:
getSubtotalDiscount in interface Order
Returns:
the amount discounted from the subtotal

getSubtotalDiscountMoney

public Money getSubtotalDiscountMoney()
Get the sub total of all items in the cart after shipping, promotions, etc. The order payment must be set before calling this method.

Specified by:
getSubtotalDiscountMoney in interface Order
Returns:
a Money object representing the total

getSubtotalMoney

public Money getSubtotalMoney()
Get the subtotal of all items in the cart.

Specified by:
getSubtotalMoney in interface Order
Returns:
a Money object representing the subtotal

getTotal

public java.math.BigDecimal getTotal()
Get the order total paid by the customer.

Specified by:
getTotal in interface Order
Returns:
the order total

getTotalMoney

public Money getTotalMoney()
Get the sub total of all items in the cart after shipping, promotions, etc. The order payment must be set before calling this method.

Specified by:
getTotalMoney in interface Order
Returns:
a Money object representing the total

getTotalShippingCostMoney

public Money getTotalShippingCostMoney()
Get the total shipping cost for this order.

Specified by:
getTotalShippingCostMoney in interface Order
Returns:
a Money representing the total shipping cost

getTotalTaxes

public java.math.BigDecimal getTotalTaxes()
Calculate total taxes on order. Iterate thru order taxes.

Specified by:
getTotalTaxes in interface Order
Returns:
total taxes on order.

getTotalTaxMoney

public Money getTotalTaxMoney()
Get the total tax for this order.

Specified by:
getTotalTaxMoney in interface Order
Returns:
a Money object representing the total tax

hasSubtotalDiscount

public boolean hasSubtotalDiscount()
Returns true if an order subtotal discount has been applied.

Specified by:
hasSubtotalDiscount in interface Order
Returns:
true if an order subtotal discount has been applied

isInclusiveTaxCalculation

public boolean isInclusiveTaxCalculation()
Return whether this order is based on inclusive tax calculation or not.

Specified by:
isInclusiveTaxCalculation in interface Order
Returns:
true if this order is based on inclusive tax calculation; otherwise, false.

setAppliedRules

public void setAppliedRules(java.util.Set appliedRules)
Set the AppliedRule objects that represent rules that were fired while processing this order.

Specified by:
setAppliedRules in interface Order
Parameters:
appliedRules - a set of AppliedRule objects

setBeforeTaxSubtotal

public void setBeforeTaxSubtotal(java.math.BigDecimal beforeTaxSubtotal)
Set the order before-tax subtotal paid by the customer.

Specified by:
setBeforeTaxSubtotal in interface Order
Parameters:
beforeTaxSubtotal - the order before-tax sub-total

setBeforeTaxTotal

public void setBeforeTaxTotal(java.math.BigDecimal beforeTaxTotal)
Set the order before-tax total.

Specified by:
setBeforeTaxTotal in interface Order
Parameters:
beforeTaxTotal - the order before-tax total

setBillingAddress

public void setBillingAddress(OrderAddress orderBillingAddress)
Set the billing address corresponding to this order.

Specified by:
setBillingAddress in interface Order
Parameters:
orderBillingAddress - the Uid of the corresponding order address.

setCreatedDate

public void setCreatedDate(java.util.Date createdDate)
Set the date that the order is created.

Specified by:
setCreatedDate in interface Order
Parameters:
createdDate - the start date

setCurrency

public void setCurrency(java.util.Currency currency)
Set the order's currency.

Specified by:
setCurrency in interface Order
Parameters:
currency - the Currency

setCustomer

public void setCustomer(Customer customer)
Set the customer corresponding to this order.

Specified by:
setCustomer in interface Order
Parameters:
customer - the Uid of the corresponding customer.

setDefaultValues

public void setDefaultValues()
Set default values for those fields need default values.

Specified by:
setDefaultValues in interface Persistence
Overrides:
setDefaultValues in class AbstractEntityImpl

setGuid

public void setGuid(java.lang.String guid)
Set the guid.

Specified by:
setGuid in interface Entity
Overrides:
setGuid in class AbstractEntityImpl
Parameters:
guid - the guid to set.

setInclusiveTaxCalculation

public void setInclusiveTaxCalculation(boolean inclusiveTaxCalculation)
Set whether this order is based on inclusive tax calculation or not.

Specified by:
setInclusiveTaxCalculation in interface Order
Parameters:
inclusiveTaxCalculation - true if this order is based on inclusive tax calculation; otherwise, false.

setIpAddress

public void setIpAddress(java.lang.String ipAddress)
Set the ip address of the computer creating the order.

Specified by:
setIpAddress in interface Order
Parameters:
ipAddress - the ip address of the creating computer

setLastModifiedBy

public void setLastModifiedBy(CmUser lastModifiedBy)
Set the CM User who last modified this order sku.

Specified by:
setLastModifiedBy in interface Order
Parameters:
lastModifiedBy - the CM user

setLastModifiedDate

public void setLastModifiedDate(java.util.Date lastModifiedDate)
Set the date that the order was last modified on.

Specified by:
setLastModifiedDate in interface Order
Parameters:
lastModifiedDate - the date that the order was last modified

setLocale

public void setLocale(java.util.Locale locale)
Set the oder's locale.

Specified by:
setLocale in interface Order
Parameters:
locale - the Locale

setOrderNotes

public void setOrderNotes(java.util.Set orderNotes)
Set the CSR Notes of this order.

Specified by:
setOrderNotes in interface Order
Parameters:
orderNotes - the set of OrderNotes

setOrderNumber

public void setOrderNumber(java.lang.String orderNumber)
Set the order number that is used by customers to reference their order.

Specified by:
setOrderNumber in interface Order
Parameters:
orderNumber - the order number, which may include characters.

setOrderPayments

public void setOrderPayments(java.util.Set orderPayments)
Set the payment(s) for this order.

Specified by:
setOrderPayments in interface Order
Parameters:
orderPayments - a set of OrderPayment objects.

setOrderSkus

public void setOrderSkus(java.util.Set orderSkus)
Set the SKUs in this order.

Specified by:
setOrderSkus in interface Order
Parameters:
orderSkus - the set of OrderSkus

setOrderTaxes

public void setOrderTaxes(java.util.Set orderTaxes)
Set the set of OrderTaxValues.

Specified by:
setOrderTaxes in interface Order
Parameters:
orderTaxes - - set of OrderTaxValues.

setReturns

public void setReturns(java.util.Set returns)
Set the returns of this order.

Specified by:
setReturns in interface Order
Parameters:
returns - the set of OrderReturns

setShipments

public void setShipments(java.util.Set shipments)
Set the shipments of this order.

Specified by:
setShipments in interface Order
Parameters:
shipments - the set of OrderShipments

setStatus

public void setStatus(OrderStatus status)
Set the status of the order.

Specified by:
setStatus in interface Order
Parameters:
status - the status of the order

setSubtotal

public void setSubtotal(java.math.BigDecimal subtotal)
Set the order subtotal paid by the customer.

Specified by:
setSubtotal in interface Order
Parameters:
subtotal - the order subtotal

setSubtotalDiscount

public void setSubtotalDiscount(java.math.BigDecimal discountAmount)
Applies a discount to the shopping cart subtotal.

Specified by:
setSubtotalDiscount in interface Order
Parameters:
discountAmount - the amount to discount the subtotal by as a BigInteger

setTotal

public void setTotal(java.math.BigDecimal orderTotal)
Set the order total paid by the customer.

Specified by:
setTotal in interface Order
Parameters:
orderTotal - the order total