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

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

public class PromotableFulfillmentGroupImpl
extends Object
implements PromotableFulfillmentGroup

See Also:
Serialized Form

Field Summary
protected  Money adjustedPrice
           
 List<PromotableFulfillmentGroupAdjustment> candidateFulfillmentGroupAdjustments
           
protected  List<PromotableOrderItem> discountableOrderItems
           
protected  FulfillmentGroup fulfillmentGroup
           
protected  PromotableItemFactory itemFactory
           
protected  PromotableOrder promotableOrder
           
protected  boolean useSaleAdjustments
           
 
Constructor Summary
PromotableFulfillmentGroupImpl(FulfillmentGroup fulfillmentGroup, PromotableOrder promotableOrder, PromotableItemFactory itemFactory)
           
 
Method Summary
 void addCandidateFulfillmentGroupAdjustment(PromotableFulfillmentGroupAdjustment adjustment)
          Adds a fulfillmentGroupAdjustment
 Money calculatePriceWithAdjustments(boolean useSalePrice)
          Calculates the price with adjustments.
 Money calculatePriceWithoutAdjustments()
          Returns the price of this fulfillment group if no adjustments were applied.
protected  Money calculateRetailAdjustmentPrice()
           
protected  Money calculateSaleAdjustmentPrice()
           
 boolean canApplyOffer(PromotableCandidateFulfillmentGroupOffer fulfillmentGroupOffer)
          Checks to see if the offer can be added to this fulfillmentGroup based on whether or not it is combinable or if this fulfillmentGroup already has a non-combinable offer applied.
 void chooseSaleOrRetailAdjustments()
          This method will check to see if the salePriceAdjustments or retailPriceAdjustments are better and remove those that should not apply.
protected  void finalizeAdjustments(boolean useSaleAdjustments)
           
 List<PromotableFulfillmentGroupAdjustment> getCandidateFulfillmentGroupAdjustments()
          Adds a fulfillmentGroupAdjustment
 List<PromotableOrderItem> getDiscountableOrderItems()
          Return list of discountable discrete order items contained in this fulfillmentGroup.
 Money getFinalizedPriceWithAdjustments()
          Calculates the price with all adjustments.
 FulfillmentGroup getFulfillmentGroup()
          Returns the decorated FulfillmentGroup
protected  Money getSalePriceBeforeAdjustments()
           
 boolean isTotalitarianOfferApplied()
          Returns true if totalitarian offer was applied to this promotable fulfillment group.
 void removeAllCandidateAdjustments()
          Removes all candidate adjustments
protected  void removeRetailOnlyAdjustments()
          Removes retail only adjustments.
protected  void removeZeroDollarAdjustments(boolean useSalePrice)
          If removeUnusedAdjustments is s
 void updateRuleVariables(Map<String,Object> ruleVars)
          Adds the underlying fulfillmentGroup to the rule variable map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fulfillmentGroup

protected FulfillmentGroup fulfillmentGroup

promotableOrder

protected PromotableOrder promotableOrder

itemFactory

protected PromotableItemFactory itemFactory

discountableOrderItems

protected List<PromotableOrderItem> discountableOrderItems

useSaleAdjustments

protected boolean useSaleAdjustments

adjustedPrice

protected Money adjustedPrice

candidateFulfillmentGroupAdjustments

public List<PromotableFulfillmentGroupAdjustment> candidateFulfillmentGroupAdjustments
Constructor Detail

PromotableFulfillmentGroupImpl

public PromotableFulfillmentGroupImpl(FulfillmentGroup fulfillmentGroup,
                                      PromotableOrder promotableOrder,
                                      PromotableItemFactory itemFactory)
Method Detail

getFulfillmentGroup

public FulfillmentGroup getFulfillmentGroup()
Description copied from interface: PromotableFulfillmentGroup
Returns the decorated FulfillmentGroup

Specified by:
getFulfillmentGroup in interface PromotableFulfillmentGroup

updateRuleVariables

public void updateRuleVariables(Map<String,Object> ruleVars)
Description copied from interface: PromotableFulfillmentGroup
Adds the underlying fulfillmentGroup to the rule variable map.

Specified by:
updateRuleVariables in interface PromotableFulfillmentGroup

getDiscountableOrderItems

public List<PromotableOrderItem> getDiscountableOrderItems()
Description copied from interface: PromotableFulfillmentGroup
Return list of discountable discrete order items contained in this fulfillmentGroup.

Specified by:
getDiscountableOrderItems in interface PromotableFulfillmentGroup
Returns:

getSalePriceBeforeAdjustments

protected Money getSalePriceBeforeAdjustments()

calculateSaleAdjustmentPrice

protected Money calculateSaleAdjustmentPrice()

calculateRetailAdjustmentPrice

protected Money calculateRetailAdjustmentPrice()

chooseSaleOrRetailAdjustments

public void chooseSaleOrRetailAdjustments()
This method will check to see if the salePriceAdjustments or retailPriceAdjustments are better and remove those that should not apply.

Specified by:
chooseSaleOrRetailAdjustments in interface PromotableFulfillmentGroup

finalizeAdjustments

protected void finalizeAdjustments(boolean useSaleAdjustments)

removeRetailOnlyAdjustments

protected void removeRetailOnlyAdjustments()
Removes retail only adjustments.


removeZeroDollarAdjustments

protected void removeZeroDollarAdjustments(boolean useSalePrice)
If removeUnusedAdjustments is s

Parameters:
useSaleAdjustments -

getFinalizedPriceWithAdjustments

public Money getFinalizedPriceWithAdjustments()
Description copied from interface: PromotableFulfillmentGroup
Calculates the price with all adjustments. May error in the case where adjustments have not been finalized with a call to chooseSaleOrRetailAdjustments.

Specified by:
getFinalizedPriceWithAdjustments in interface PromotableFulfillmentGroup

calculatePriceWithoutAdjustments

public Money calculatePriceWithoutAdjustments()
Description copied from interface: PromotableFulfillmentGroup
Returns the price of this fulfillment group if no adjustments were applied.

Specified by:
calculatePriceWithoutAdjustments in interface PromotableFulfillmentGroup
Returns:

addCandidateFulfillmentGroupAdjustment

public void addCandidateFulfillmentGroupAdjustment(PromotableFulfillmentGroupAdjustment adjustment)
Description copied from interface: PromotableFulfillmentGroup
Adds a fulfillmentGroupAdjustment

Specified by:
addCandidateFulfillmentGroupAdjustment in interface PromotableFulfillmentGroup

getCandidateFulfillmentGroupAdjustments

public List<PromotableFulfillmentGroupAdjustment> getCandidateFulfillmentGroupAdjustments()
Description copied from interface: PromotableFulfillmentGroup
Adds a fulfillmentGroupAdjustment

Specified by:
getCandidateFulfillmentGroupAdjustments in interface PromotableFulfillmentGroup
Returns:

canApplyOffer

public boolean canApplyOffer(PromotableCandidateFulfillmentGroupOffer fulfillmentGroupOffer)
Description copied from interface: PromotableFulfillmentGroup
Checks to see if the offer can be added to this fulfillmentGroup based on whether or not it is combinable or if this fulfillmentGroup already has a non-combinable offer applied.

Specified by:
canApplyOffer in interface PromotableFulfillmentGroup
Returns:

calculatePriceWithAdjustments

public Money calculatePriceWithAdjustments(boolean useSalePrice)
Description copied from interface: PromotableFulfillmentGroup
Calculates the price with adjustments. Uses the sale or retail adjustments based on the passed in parameter.

Specified by:
calculatePriceWithAdjustments in interface PromotableFulfillmentGroup

isTotalitarianOfferApplied

public boolean isTotalitarianOfferApplied()
Description copied from interface: PromotableFulfillmentGroup
Returns true if totalitarian offer was applied to this promotable fulfillment group.

Specified by:
isTotalitarianOfferApplied in interface PromotableFulfillmentGroup
Returns:

removeAllCandidateAdjustments

public void removeAllCandidateAdjustments()
Description copied from interface: PromotableFulfillmentGroup
Removes all candidate adjustments

Specified by:
removeAllCandidateAdjustments in interface PromotableFulfillmentGroup


Copyright © 2013. All Rights Reserved.