org.broadleafcommerce.core.offer.service.discount.domain
Class PromotableOrderItemImpl

java.lang.Object
  extended by org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderItemImpl
All Implemented Interfaces:
Serializable, PromotableOrderItem

public class PromotableOrderItemImpl
extends Object
implements PromotableOrderItem

See Also:
Serialized Form

Field Summary
protected  boolean includeAdjustments
           
protected  PromotableItemFactory itemFactory
           
protected  List<PromotableOrderItemPriceDetail> itemPriceDetails
           
protected  OrderItem orderItem
           
protected  PromotableOrder promotableOrder
           
 
Constructor Summary
PromotableOrderItemImpl(OrderItem orderItem, PromotableOrder promotableOrder, PromotableItemFactory itemFactory, boolean includeAdjustments)
           
 
Method Summary
 Money calculateTotalAdjustmentValue()
          Returns the value of all adjustments.
 Money calculateTotalWithAdjustments()
          Returns the final total for this item taking into account the finalized adjustments.
 Money calculateTotalWithoutAdjustments()
          Returns the total for this item if not adjustments applied.
 PromotableOrderItemPriceDetail createNewDetail(int quantity)
          Creates a new detail with the associated quantity.
 BroadleafCurrency getCurrency()
          Returns the currency of the related order.
 Money getCurrentBasePrice()
          Returns the basePrice of the item (baseSalePrice or baseRetailPrice)
 OrderItem getOrderItem()
          Returns the underlying orderItem.
 OrderItemContainer getOrderItemContainer()
          Returns an OrderItemContainer for this OrderItem or null if this item is not an instance of OrderItemContainer.
 Long getOrderItemId()
          Returns the id of the contained OrderItem
 Money getPriceBeforeAdjustments(boolean applyToSalePrice)
          Return the salePriceBeforeAdjustments if the passed in param is true.
 List<PromotableOrderItemPriceDetail> getPromotableOrderItemPriceDetails()
          Returns the list of priceDetails associated with this item.
 int getQuantity()
          Returns the quantity for this orderItem
 Money getRetailPriceBeforeAdjustments()
          Returns the retailPrice without adjustments
 Money getSalePriceBeforeAdjustments()
          Returns the salePrice without adjustments
 boolean isDiscountingAllowed()
          Returns true if this item can receive item level discounts.
 boolean isOnSale()
          Returns true if the item has a sale price that is lower than the retail price.
 boolean isOrderItemContainer()
          Returns true if this PromotableOrderItem contains other items
protected  void mergeDetails(PromotableOrderItemPriceDetail firstDetail, PromotableOrderItemPriceDetail secondDetail)
           
 void mergeLikeDetails()
          Merges any priceDetails that share the same adjustments.
 void removeAllItemAdjustments()
          Effectively deletes all priceDetails associated with this item and r
 void resetPriceDetails()
          Called by pricing engine to reset the state of this item.
 void updateRuleVariables(Map<String,Object> ruleVars)
          Adds the item to the rule variables map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

promotableOrder

protected PromotableOrder promotableOrder

orderItem

protected OrderItem orderItem

itemFactory

protected PromotableItemFactory itemFactory

itemPriceDetails

protected List<PromotableOrderItemPriceDetail> itemPriceDetails

includeAdjustments

protected boolean includeAdjustments
Constructor Detail

PromotableOrderItemImpl

public PromotableOrderItemImpl(OrderItem orderItem,
                               PromotableOrder promotableOrder,
                               PromotableItemFactory itemFactory,
                               boolean includeAdjustments)
Method Detail

resetPriceDetails

public void resetPriceDetails()
Description copied from interface: PromotableOrderItem
Called by pricing engine to reset the state of this item.

Specified by:
resetPriceDetails in interface PromotableOrderItem

updateRuleVariables

public void updateRuleVariables(Map<String,Object> ruleVars)
Adds the item to the rule variables map.

Specified by:
updateRuleVariables in interface PromotableOrderItem
Parameters:
ruleVars -

isDiscountingAllowed

public boolean isDiscountingAllowed()
Description copied from interface: PromotableOrderItem
Returns true if this item can receive item level discounts.

Specified by:
isDiscountingAllowed in interface PromotableOrderItem
Returns:

isOrderItemContainer

public boolean isOrderItemContainer()
Description copied from interface: PromotableOrderItem
Returns true if this PromotableOrderItem contains other items

Specified by:
isOrderItemContainer in interface PromotableOrderItem

getOrderItemContainer

public OrderItemContainer getOrderItemContainer()
Description copied from interface: PromotableOrderItem
Returns an OrderItemContainer for this OrderItem or null if this item is not an instance of OrderItemContainer.

Specified by:
getOrderItemContainer in interface PromotableOrderItem

getPromotableOrderItemPriceDetails

public List<PromotableOrderItemPriceDetail> getPromotableOrderItemPriceDetails()
Description copied from interface: PromotableOrderItem
Returns the list of priceDetails associated with this item.

Specified by:
getPromotableOrderItemPriceDetails in interface PromotableOrderItem
Returns:

getSalePriceBeforeAdjustments

public Money getSalePriceBeforeAdjustments()
Description copied from interface: PromotableOrderItem
Returns the salePrice without adjustments

Specified by:
getSalePriceBeforeAdjustments in interface PromotableOrderItem

getRetailPriceBeforeAdjustments

public Money getRetailPriceBeforeAdjustments()
Description copied from interface: PromotableOrderItem
Returns the retailPrice without adjustments

Specified by:
getRetailPriceBeforeAdjustments in interface PromotableOrderItem

getPriceBeforeAdjustments

public Money getPriceBeforeAdjustments(boolean applyToSalePrice)
Description copied from interface: PromotableOrderItem
Return the salePriceBeforeAdjustments if the passed in param is true. Otherwise return the retailPriceBeforeAdjustments.

Specified by:
getPriceBeforeAdjustments in interface PromotableOrderItem
Returns:

getCurrentBasePrice

public Money getCurrentBasePrice()
Description copied from interface: PromotableOrderItem
Returns the basePrice of the item (baseSalePrice or baseRetailPrice)

Specified by:
getCurrentBasePrice in interface PromotableOrderItem
Returns:

getQuantity

public int getQuantity()
Description copied from interface: PromotableOrderItem
Returns the quantity for this orderItem

Specified by:
getQuantity in interface PromotableOrderItem
Returns:

isOnSale

public boolean isOnSale()
Description copied from interface: PromotableOrderItem
Returns true if the item has a sale price that is lower than the retail price.

Specified by:
isOnSale in interface PromotableOrderItem

getCurrency

public BroadleafCurrency getCurrency()
Description copied from interface: PromotableOrderItem
Returns the currency of the related order.

Specified by:
getCurrency in interface PromotableOrderItem
Returns:

removeAllItemAdjustments

public void removeAllItemAdjustments()
Description copied from interface: PromotableOrderItem
Effectively deletes all priceDetails associated with this item and r

Specified by:
removeAllItemAdjustments in interface PromotableOrderItem

mergeDetails

protected void mergeDetails(PromotableOrderItemPriceDetail firstDetail,
                            PromotableOrderItemPriceDetail secondDetail)

mergeLikeDetails

public void mergeLikeDetails()
Description copied from interface: PromotableOrderItem
Merges any priceDetails that share the same adjustments.

Specified by:
mergeLikeDetails in interface PromotableOrderItem

getOrderItemId

public Long getOrderItemId()
Description copied from interface: PromotableOrderItem
Returns the id of the contained OrderItem

Specified by:
getOrderItemId in interface PromotableOrderItem

calculateTotalWithAdjustments

public Money calculateTotalWithAdjustments()
Description copied from interface: PromotableOrderItem
Returns the final total for this item taking into account the finalized adjustments. Intended to be called after the adjustments have been finalized.

Specified by:
calculateTotalWithAdjustments in interface PromotableOrderItem

calculateTotalWithoutAdjustments

public Money calculateTotalWithoutAdjustments()
Description copied from interface: PromotableOrderItem
Returns the total for this item if not adjustments applied.

Specified by:
calculateTotalWithoutAdjustments in interface PromotableOrderItem

calculateTotalAdjustmentValue

public Money calculateTotalAdjustmentValue()
Description copied from interface: PromotableOrderItem
Returns the value of all adjustments.

Specified by:
calculateTotalAdjustmentValue in interface PromotableOrderItem

createNewDetail

public PromotableOrderItemPriceDetail createNewDetail(int quantity)
Description copied from interface: PromotableOrderItem
Creates a new detail with the associated quantity. Intended for use as part of the PriceDetail split.

Specified by:
createNewDetail in interface PromotableOrderItem
Returns:

getOrderItem

public OrderItem getOrderItem()
Description copied from interface: PromotableOrderItem
Returns the underlying orderItem. Manipulation of the underlying orderItem is not recommended. This method is intended for unit test and read only access although that is not strictly enforced.

Specified by:
getOrderItem in interface PromotableOrderItem
Returns:


Copyright © 2013. All Rights Reserved.