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:
PromotableOrderItem

public class PromotableOrderItemImpl
extends Object
implements PromotableOrderItem


Field Summary
protected  DiscreteOrderItem delegate
           
protected  PromotableItemFactory itemFactory
           
protected  PromotableOrder order
           
protected  List<PromotionDiscount> promotionDiscounts
           
protected  List<PromotionQualifier> promotionQualifiers
           
protected  BigDecimal retailAdjustmentPrice
           
protected  BigDecimal saleAdjustmentPrice
           
 
Constructor Summary
PromotableOrderItemImpl(DiscreteOrderItem orderItem, PromotableOrder order, PromotableItemFactory itemFactory)
           
 
Method Summary
 void addCandidateItemOffer(PromotableCandidateItemOffer candidateItemOffer)
           
 void addOrderItemAdjustment(PromotableOrderItemAdjustment orderItemAdjustment)
          Adds the adjustment to the order item's adjustment list and discounts the order item's adjustment price by the value of the adjustment.
 void addPromotionDiscount(PromotableCandidateItemOffer candidatePromotion, OfferItemCriteria itemCriteria, int quantity)
           
 void addPromotionQualifier(PromotableCandidateItemOffer candidatePromotion, OfferItemCriteria itemCriteria, int quantity)
           
 void assignFinalPrice()
           
 void clearAllDiscount()
           
 void clearAllNonFinalizedDiscounts()
           
 void clearAllNonFinalizedQualifiers()
           
 void clearAllNonFinalizedQuantities()
           
 void clearAllQualifiers()
           
 PromotableOrderItem clone()
           
 void computeAdjustmentPrice()
           
 void finalizeQuantities()
           
 int fixAdjustments(boolean useSaleAdjustments)
          Removes all zero based adjustments and sets the adjusted price on the delegate.
 Money getCurrentPrice()
           
 DiscreteOrderItem getDelegate()
           
 Money getPriceBeforeAdjustments(boolean allowSalesPrice)
           
 int getPromotionDiscountMismatchQuantity()
           
 List<PromotionDiscount> getPromotionDiscounts()
           
 List<PromotionQualifier> getPromotionQualifiers()
           
 int getQuantity()
           
 int getQuantityAvailableToBeUsedAsQualifier(Offer promotion)
           
 int getQuantityAvailableToBeUsedAsTarget(Offer promotion)
           
 Money getRetailAdjustmentPrice()
          The price after discounts if all applicable discounts are applied to the retail price.
 Money getRetailPrice()
           
 Money getSaleAdjustmentPrice()
          The price after discounts if all applicable discounts are applied to the sale price.
 Money getSalePrice()
           
 Sku getSku()
           
 boolean isHasOrderItemAdjustments()
           
 boolean isNotCombinableOfferApplied()
           
 PromotionDiscount lookupOrCreatePromotionDiscount(PromotableCandidateItemOffer candidatePromotion)
           
 PromotionQualifier lookupOrCreatePromotionQualifier(PromotableCandidateItemOffer candidatePromotion)
           
 int removeAllAdjustments()
           
 void reset()
           
 void resetAdjustmentPrice()
           
 void setPromotionDiscounts(List<PromotionDiscount> promotionDiscounts)
           
 void setPromotionQualifiers(List<PromotionQualifier> promotionQualifiers)
           
 void setQuantity(int quantity)
           
 void setRetailAdjustmentPrice(Money retailAdjustmentPrice)
           
 void setSaleAdjustmentPrice(Money saleAdjustmentPrice)
           
 List<PromotableOrderItem> split()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

retailAdjustmentPrice

protected BigDecimal retailAdjustmentPrice

saleAdjustmentPrice

protected BigDecimal saleAdjustmentPrice

promotionDiscounts

protected List<PromotionDiscount> promotionDiscounts

promotionQualifiers

protected List<PromotionQualifier> promotionQualifiers

delegate

protected DiscreteOrderItem delegate

order

protected PromotableOrder order

itemFactory

protected PromotableItemFactory itemFactory
Constructor Detail

PromotableOrderItemImpl

public PromotableOrderItemImpl(DiscreteOrderItem orderItem,
                               PromotableOrder order,
                               PromotableItemFactory itemFactory)
Method Detail

getDelegate

public DiscreteOrderItem getDelegate()
Specified by:
getDelegate in interface PromotableOrderItem

reset

public void reset()
Specified by:
reset in interface PromotableOrderItem

assignFinalPrice

public void assignFinalPrice()
Specified by:
assignFinalPrice in interface PromotableOrderItem

getCurrentPrice

public Money getCurrentPrice()
Specified by:
getCurrentPrice in interface PromotableOrderItem

computeAdjustmentPrice

public void computeAdjustmentPrice()
Specified by:
computeAdjustmentPrice in interface PromotableOrderItem

resetAdjustmentPrice

public void resetAdjustmentPrice()
Specified by:
resetAdjustmentPrice in interface PromotableOrderItem

addOrderItemAdjustment

public void addOrderItemAdjustment(PromotableOrderItemAdjustment orderItemAdjustment)
Description copied from interface: PromotableOrderItem
Adds the adjustment to the order item's adjustment list and discounts the order item's adjustment price by the value of the adjustment.

Specified by:
addOrderItemAdjustment in interface PromotableOrderItem

removeAllAdjustments

public int removeAllAdjustments()
Specified by:
removeAllAdjustments in interface PromotableOrderItem

getRetailAdjustmentPrice

public Money getRetailAdjustmentPrice()
Description copied from interface: PromotableOrderItem
The price after discounts if all applicable discounts are applied to the retail price.

Specified by:
getRetailAdjustmentPrice in interface PromotableOrderItem
Returns:

setRetailAdjustmentPrice

public void setRetailAdjustmentPrice(Money retailAdjustmentPrice)
Specified by:
setRetailAdjustmentPrice in interface PromotableOrderItem

getSaleAdjustmentPrice

public Money getSaleAdjustmentPrice()
Description copied from interface: PromotableOrderItem
The price after discounts if all applicable discounts are applied to the sale price.

Specified by:
getSaleAdjustmentPrice in interface PromotableOrderItem

setSaleAdjustmentPrice

public void setSaleAdjustmentPrice(Money saleAdjustmentPrice)
Specified by:
setSaleAdjustmentPrice in interface PromotableOrderItem

isNotCombinableOfferApplied

public boolean isNotCombinableOfferApplied()
Specified by:
isNotCombinableOfferApplied in interface PromotableOrderItem

isHasOrderItemAdjustments

public boolean isHasOrderItemAdjustments()
Specified by:
isHasOrderItemAdjustments in interface PromotableOrderItem

getPromotionDiscounts

public List<PromotionDiscount> getPromotionDiscounts()
Specified by:
getPromotionDiscounts in interface PromotableOrderItem

setPromotionDiscounts

public void setPromotionDiscounts(List<PromotionDiscount> promotionDiscounts)
Specified by:
setPromotionDiscounts in interface PromotableOrderItem

getPromotionQualifiers

public List<PromotionQualifier> getPromotionQualifiers()
Specified by:
getPromotionQualifiers in interface PromotableOrderItem

setPromotionQualifiers

public void setPromotionQualifiers(List<PromotionQualifier> promotionQualifiers)
Specified by:
setPromotionQualifiers in interface PromotableOrderItem

getQuantityAvailableToBeUsedAsQualifier

public int getQuantityAvailableToBeUsedAsQualifier(Offer promotion)
Specified by:
getQuantityAvailableToBeUsedAsQualifier in interface PromotableOrderItem

getQuantityAvailableToBeUsedAsTarget

public int getQuantityAvailableToBeUsedAsTarget(Offer promotion)
Specified by:
getQuantityAvailableToBeUsedAsTarget in interface PromotableOrderItem

addPromotionQualifier

public void addPromotionQualifier(PromotableCandidateItemOffer candidatePromotion,
                                  OfferItemCriteria itemCriteria,
                                  int quantity)
Specified by:
addPromotionQualifier in interface PromotableOrderItem

addPromotionDiscount

public void addPromotionDiscount(PromotableCandidateItemOffer candidatePromotion,
                                 OfferItemCriteria itemCriteria,
                                 int quantity)
Specified by:
addPromotionDiscount in interface PromotableOrderItem

lookupOrCreatePromotionQualifier

public PromotionQualifier lookupOrCreatePromotionQualifier(PromotableCandidateItemOffer candidatePromotion)
Specified by:
lookupOrCreatePromotionQualifier in interface PromotableOrderItem

lookupOrCreatePromotionDiscount

public PromotionDiscount lookupOrCreatePromotionDiscount(PromotableCandidateItemOffer candidatePromotion)
Specified by:
lookupOrCreatePromotionDiscount in interface PromotableOrderItem

clearAllNonFinalizedQuantities

public void clearAllNonFinalizedQuantities()
Specified by:
clearAllNonFinalizedQuantities in interface PromotableOrderItem

clearAllDiscount

public void clearAllDiscount()
Specified by:
clearAllDiscount in interface PromotableOrderItem

clearAllQualifiers

public void clearAllQualifiers()
Specified by:
clearAllQualifiers in interface PromotableOrderItem

clearAllNonFinalizedDiscounts

public void clearAllNonFinalizedDiscounts()
Specified by:
clearAllNonFinalizedDiscounts in interface PromotableOrderItem

clearAllNonFinalizedQualifiers

public void clearAllNonFinalizedQualifiers()
Specified by:
clearAllNonFinalizedQualifiers in interface PromotableOrderItem

finalizeQuantities

public void finalizeQuantities()
Specified by:
finalizeQuantities in interface PromotableOrderItem

getPromotionDiscountMismatchQuantity

public int getPromotionDiscountMismatchQuantity()
Specified by:
getPromotionDiscountMismatchQuantity in interface PromotableOrderItem

split

public List<PromotableOrderItem> split()
Specified by:
split in interface PromotableOrderItem

getQuantity

public int getQuantity()
Specified by:
getQuantity in interface PromotableOrderItem

setQuantity

public void setQuantity(int quantity)
Specified by:
setQuantity in interface PromotableOrderItem

getSku

public Sku getSku()
Specified by:
getSku in interface PromotableOrderItem

getPriceBeforeAdjustments

public Money getPriceBeforeAdjustments(boolean allowSalesPrice)
Specified by:
getPriceBeforeAdjustments in interface PromotableOrderItem

getSalePrice

public Money getSalePrice()
Specified by:
getSalePrice in interface PromotableOrderItem

getRetailPrice

public Money getRetailPrice()
Specified by:
getRetailPrice in interface PromotableOrderItem

addCandidateItemOffer

public void addCandidateItemOffer(PromotableCandidateItemOffer candidateItemOffer)
Specified by:
addCandidateItemOffer in interface PromotableOrderItem

clone

public PromotableOrderItem clone()
Specified by:
clone in interface PromotableOrderItem
Overrides:
clone in class Object

fixAdjustments

public int fixAdjustments(boolean useSaleAdjustments)
Removes all zero based adjustments and sets the adjusted price on the delegate. For remaining adjustments sets the value to the retail or sale price.

Specified by:
fixAdjustments in interface PromotableOrderItem
Parameters:
useSaleAdjustments -
Returns:


Copyright © 2012. All Rights Reserved.