org.broadleafcommerce.core.order.domain
Class BundleOrderItemImpl

java.lang.Object
  extended by org.broadleafcommerce.core.order.domain.OrderItemImpl
      extended by org.broadleafcommerce.core.order.domain.BundleOrderItemImpl
All Implemented Interfaces:
Serializable, Cloneable, BundleOrderItem, OrderItem, OrderItemContainer, SkuAccessor

@Entity
public class BundleOrderItemImpl
extends OrderItemImpl
implements BundleOrderItem

See Also:
Serialized Form

Field Summary
protected  BigDecimal baseRetailPrice
           
protected  BigDecimal baseSalePrice
           
protected  List<BundleOrderItemFeePrice> bundleOrderItemFeePrices
           
protected  List<DiscreteOrderItem> discreteOrderItems
           
protected  ProductBundle productBundle
           
protected  Sku sku
           
 
Fields inherited from class org.broadleafcommerce.core.order.domain.OrderItemImpl
candidateItemOffers, category, discountsAllowed, giftWrapOrderItem, id, itemTaxable, name, order, orderItemAdjustments, orderItemAttributeMap, orderItemPriceDetails, orderItemQualifiers, orderItemType, personalMessage, price, quantity, retailPrice, retailPriceOverride, salePrice, salePriceOverride, totalTax
 
Constructor Summary
BundleOrderItemImpl()
           
 
Method Summary
 OrderItem clone()
           
protected  Money convertToMoney(BigDecimal amount)
           
 boolean equals(Object obj)
           
 boolean getAllowDiscountsOnChildItems()
          Returns true if the contained items can be discounted.
 Money getBaseRetailPrice()
           
 Money getBaseSalePrice()
           
 List<BundleOrderItemFeePrice> getBundleOrderItemFeePrices()
           
 List<DiscreteOrderItem> getDiscreteOrderItems()
           
 List<? extends OrderItem> getOrderItems()
           
 Product getProduct()
          Same as getProductBundle.
 ProductBundle getProductBundle()
          Returns the associated ProductBundle or null if not applicable.
 Money getRetailPrice()
          The retail price of the item that was added to the Order at the time that this was added.
 Money getSalePrice()
          Returns the salePrice for this item.
 Sku getSku()
          For BundleOrderItem created from a ProductBundle, this will represent the default sku of the product bundle.
 Money getTaxablePrice()
           
 Money getTotalPrice()
          Returns the total price to be paid for this order item including item-level adjustments.
 boolean hasAdjustedItems()
           
 int hashCode()
           
 boolean isDiscountingAllowed()
          If true, this item can be discounted..
 boolean isPricingAtContainerLevel()
          Returns true if pricing operations are at the container level (as opposed to being the sum of the contained items)
 Boolean isTaxable()
          Returns whether or not this item is taxable.
 void setBaseRetailPrice(Money baseRetailPrice)
           
 void setBaseSalePrice(Money baseSalePrice)
           
 void setBundleOrderItemFeePrices(List<BundleOrderItemFeePrice> bundleOrderItemFeePrices)
           
 void setDiscreteOrderItems(List<DiscreteOrderItem> discreteOrderItems)
           
 void setProductBundle(ProductBundle productBundle)
          Sets the ProductBundle associated with this BundleOrderItem.
 void setSku(Sku sku)
           
 boolean shouldSumItems()
           
 boolean updateSaleAndRetailPrices()
          Used to reset the base price of the item that the pricing engine uses.
 
Methods inherited from class org.broadleafcommerce.core.order.domain.OrderItemImpl
addCandidateItemOffer, assignFinalPrice, checkCloneable, convertOrderItemType, finalizePrice, getAdjustmentValue, getAverageAdjustmentValue, getAveragePrice, getCandidateItemOffers, getCategory, getGiftWrapOrderItem, getId, getIsDiscounted, getIsOnSale, getName, getOrder, getOrderItemAdjustments, getOrderItemAttributes, getOrderItemPriceDetails, getOrderItemQualifiers, getOrderItemType, getPersonalMessage, getPrice, getPriceBeforeAdjustments, getQuantity, getTotalAdjustmentValue, isInCategory, isRetailPriceOverride, isSalePriceOverride, removeAllAdjustments, removeAllCandidateItemOffers, setCandidateItemOffers, setCategory, setDiscountingAllowed, setGiftWrapOrderItem, setId, setName, setOrder, setOrderItemAdjustments, setOrderItemAttributes, setOrderItemPriceDetails, setOrderItemQualifiers, setOrderItemType, setPersonalMessage, setPrice, setQuantity, setRetailPrice, setRetailPriceOverride, setSalePrice, setSalePriceOverride, setTaxable
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.broadleafcommerce.core.order.domain.OrderItem
addCandidateItemOffer, assignFinalPrice, finalizePrice, getAdjustmentValue, getAverageAdjustmentValue, getAveragePrice, getCandidateItemOffers, getCategory, getGiftWrapOrderItem, getId, getIsDiscounted, getIsOnSale, getName, getOrder, getOrderItemAdjustments, getOrderItemAttributes, getOrderItemPriceDetails, getOrderItemQualifiers, getOrderItemType, getPersonalMessage, getPrice, getPriceBeforeAdjustments, getQuantity, getTotalAdjustmentValue, isInCategory, isRetailPriceOverride, isSalePriceOverride, removeAllAdjustments, removeAllCandidateItemOffers, setCandidateItemOffers, setCategory, setDiscountingAllowed, setGiftWrapOrderItem, setId, setName, setOrder, setOrderItemAdjustments, setOrderItemAttributes, setOrderItemPriceDetails, setOrderItemQualifiers, setOrderItemType, setPersonalMessage, setPrice, setQuantity, setRetailPrice, setRetailPriceOverride, setSalePrice, setSalePriceOverride, setTaxable
 

Field Detail

discreteOrderItems

protected List<DiscreteOrderItem> discreteOrderItems

bundleOrderItemFeePrices

protected List<BundleOrderItemFeePrice> bundleOrderItemFeePrices

baseRetailPrice

protected BigDecimal baseRetailPrice

baseSalePrice

protected BigDecimal baseSalePrice

sku

protected Sku sku

productBundle

protected ProductBundle productBundle
Constructor Detail

BundleOrderItemImpl

public BundleOrderItemImpl()
Method Detail

getSku

public Sku getSku()
Description copied from interface: BundleOrderItem
For BundleOrderItem created from a ProductBundle, this will represent the default sku of the product bundle. This can be null for implementations that programatically create product bundles.

Specified by:
getSku in interface BundleOrderItem
Specified by:
getSku in interface SkuAccessor

setSku

public void setSku(Sku sku)
Specified by:
setSku in interface BundleOrderItem

getProductBundle

public ProductBundle getProductBundle()
Description copied from interface: BundleOrderItem
Returns the associated ProductBundle or null if not applicable. If null, then this ProductBundle was manually created.

Specified by:
getProductBundle in interface BundleOrderItem
Returns:

setProductBundle

public void setProductBundle(ProductBundle productBundle)
Description copied from interface: BundleOrderItem
Sets the ProductBundle associated with this BundleOrderItem.

Specified by:
setProductBundle in interface BundleOrderItem

getOrderItems

public List<? extends OrderItem> getOrderItems()
Specified by:
getOrderItems in interface OrderItemContainer

getAllowDiscountsOnChildItems

public boolean getAllowDiscountsOnChildItems()
Description copied from interface: OrderItemContainer
Returns true if the contained items can be discounted.

Specified by:
getAllowDiscountsOnChildItems in interface OrderItemContainer
Returns:

isPricingAtContainerLevel

public boolean isPricingAtContainerLevel()
Description copied from interface: OrderItemContainer
Returns true if pricing operations are at the container level (as opposed to being the sum of the contained items)

Specified by:
isPricingAtContainerLevel in interface OrderItemContainer
Returns:

isDiscountingAllowed

public boolean isDiscountingAllowed()
Description copied from interface: OrderItem
If true, this item can be discounted..

Specified by:
isDiscountingAllowed in interface OrderItem
Overrides:
isDiscountingAllowed in class OrderItemImpl

getDiscreteOrderItems

public List<DiscreteOrderItem> getDiscreteOrderItems()
Specified by:
getDiscreteOrderItems in interface BundleOrderItem

setDiscreteOrderItems

public void setDiscreteOrderItems(List<DiscreteOrderItem> discreteOrderItems)
Specified by:
setDiscreteOrderItems in interface BundleOrderItem

getBundleOrderItemFeePrices

public List<BundleOrderItemFeePrice> getBundleOrderItemFeePrices()
Specified by:
getBundleOrderItemFeePrices in interface BundleOrderItem

setBundleOrderItemFeePrices

public void setBundleOrderItemFeePrices(List<BundleOrderItemFeePrice> bundleOrderItemFeePrices)
Specified by:
setBundleOrderItemFeePrices in interface BundleOrderItem

getTaxablePrice

public Money getTaxablePrice()
Specified by:
getTaxablePrice in interface BundleOrderItem
Specified by:
getTaxablePrice in interface OrderItem
Overrides:
getTaxablePrice in class OrderItemImpl
Returns:

isTaxable

public Boolean isTaxable()
Description copied from interface: OrderItem
Returns whether or not this item is taxable. If this flag is not set, it returns true by default

Specified by:
isTaxable in interface OrderItem
Overrides:
isTaxable in class OrderItemImpl
Returns:
the taxable flag. If null, returns true

shouldSumItems

public boolean shouldSumItems()
Specified by:
shouldSumItems in interface BundleOrderItem

getRetailPrice

public Money getRetailPrice()
Description copied from interface: OrderItem
The retail price of the item that was added to the Order at the time that this was added. This is preferable to use as opposed to checking the price of the item that was added from the catalog domain (like in DiscreteOrderItem, using DiscreteOrderItem.getSku()'s retail price) since the price in the catalog domain could have changed since the item was added to the Order.

Specified by:
getRetailPrice in interface OrderItem
Overrides:
getRetailPrice in class OrderItemImpl
Returns:

getSalePrice

public Money getSalePrice()
Description copied from interface: OrderItem
Returns the salePrice for this item. Note this method will return the lower of the retailPrice or salePrice. It will return the retailPrice instead of null. For SKU based pricing, a call to OrderItem.updateSaleAndRetailPrices() will ensure that the retailPrice being used is current.

Specified by:
getSalePrice in interface OrderItem
Overrides:
getSalePrice in class OrderItemImpl
Returns:

getBaseRetailPrice

public Money getBaseRetailPrice()
Specified by:
getBaseRetailPrice in interface BundleOrderItem

setBaseRetailPrice

public void setBaseRetailPrice(Money baseRetailPrice)
Specified by:
setBaseRetailPrice in interface BundleOrderItem

getBaseSalePrice

public Money getBaseSalePrice()
Specified by:
getBaseSalePrice in interface BundleOrderItem

setBaseSalePrice

public void setBaseSalePrice(Money baseSalePrice)
Specified by:
setBaseSalePrice in interface BundleOrderItem

hasAdjustedItems

public boolean hasAdjustedItems()
Specified by:
hasAdjustedItems in interface BundleOrderItem

updateSaleAndRetailPrices

public boolean updateSaleAndRetailPrices()
Description copied from interface: OrderItem
Used to reset the base price of the item that the pricing engine uses. Generally, this will update the retailPrice and salePrice based on the corresponding value in the SKU. If the retail or sale price was manually set, this method will not change those prices. For non-manually set prices, prices can change based on system activities such as locale changes and customer authentication, this method is used to ensure that all cart items reflect the current base price before executing other pricing / adjustment operations. Other known scenarios that can effect the base prices include the automatic bundling or loading a stale cart from the database. See notes in subclasses for specific behavior of this method.

Specified by:
updateSaleAndRetailPrices in interface OrderItem
Overrides:
updateSaleAndRetailPrices in class OrderItemImpl
Returns:
true if the base prices changed as a result of this call

equals

public boolean equals(Object obj)
Overrides:
equals in class OrderItemImpl

getProduct

public Product getProduct()
Description copied from interface: BundleOrderItem
Same as getProductBundle.

Specified by:
getProduct in interface BundleOrderItem

convertToMoney

protected Money convertToMoney(BigDecimal amount)
Overrides:
convertToMoney in class OrderItemImpl

getTotalPrice

public Money getTotalPrice()
Description copied from interface: OrderItem
Returns the total price to be paid for this order item including item-level adjustments. It does not include the effect of order level adjustments. Calculated by looping through the orderItemPriceDetails

Specified by:
getTotalPrice in interface OrderItem
Overrides:
getTotalPrice in class OrderItemImpl
Returns:

clone

public OrderItem clone()
Specified by:
clone in interface OrderItem
Overrides:
clone in class OrderItemImpl

hashCode

public int hashCode()
Overrides:
hashCode in class OrderItemImpl


Copyright © 2013. All Rights Reserved.