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

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

public class PromotableOrderImpl
extends Object
implements PromotableOrder

See Also:
Serialized Form

Field Summary
protected  List<PromotableOrderItem> allOrderItems
           
protected  List<PromotableOrderAdjustment> candidateOrderOfferAdjustments
           
protected  boolean currentSortParam
           
protected  List<PromotableOrderItem> discountableOrderItems
           
protected  List<PromotableFulfillmentGroup> fulfillmentGroups
           
protected  boolean includeOrderAndItemAdjustments
           
protected  PromotableItemFactory itemFactory
           
protected  Order order
           
 
Constructor Summary
PromotableOrderImpl(Order order, PromotableItemFactory itemFactory, boolean includeOrderAndItemAdjustments)
           
 
Method Summary
 void addCandidateOrderAdjustment(PromotableOrderAdjustment orderAdjustment)
          Adds the adjustment to the order's adjustment list and discounts the order's adjustment price by the value of the adjustment.
protected  void addPromotableOrderItem(OrderItem orderItem, List<PromotableOrderItem> discountableOrderItems)
           
protected  List<PromotableOrderItem> buildPromotableOrderItemsList()
           
 Money calculateItemAdjustmentTotal()
          Calculates the total adjustment to be received from the item adjustments.
 Money calculateOrderAdjustmentTotal()
          Calculates the total adjustment to be received from the order adjustments.
 Money calculateSubtotalWithAdjustments()
          Returns the price of the order with adjustments.
 Money calculateSubtotalWithoutAdjustments()
          Returns the price of the order without adjustments.
 boolean canApplyOrderOffer(PromotableCandidateOrderOffer offer)
          Returns true if this order can apply another order promotion.
protected  void createExistingOrderAdjustments()
          Bring over the order adjustments.
 List<PromotableOrderItem> getAllOrderItems()
          Returns all OrderItems for the order wrapped with PromotableOrderItem
 List<PromotableOrderItemPriceDetail> getAllPromotableOrderItemPriceDetails()
          Returns all of the price detail items for this order.
 List<PromotableOrderAdjustment> getCandidateOrderAdjustments()
          Returns the list of orderAdjustments being proposed for the order.
 List<PromotableOrderItem> getDiscountableOrderItems()
          Returns all OrderItems that can receive discounts.
 List<PromotableOrderItem> getDiscountableOrderItems(boolean applyDiscountToSalePrice)
          Returns all OrderItems that can receive discounts.
 List<PromotableFulfillmentGroup> getFulfillmentGroups()
          Returns the fulfillmentGroups associated with the order after converting them to promotableFulfillmentGroups.
 Order getOrder()
          Returns the associated order.
 BroadleafCurrency getOrderCurrency()
          Returns the BroadleafCurrency for the current order.
 boolean isHasOrderAdjustments()
          Returns true if this promotableOrder has any order adjustments.
 boolean isIncludeOrderAndItemAdjustments()
          Returns true if this order was created in a way that existing order and item adjustments were copied over to this item.
protected  boolean isNotCombinableOrderOfferApplied()
           
 boolean isTotalitarianOfferApplied()
          Returns true if a totalitarian offer has been applied.
 void removeAllCandidateFulfillmentOfferAdjustments()
          Removes all adjustments from the order's fulfillment items and resets the adjustment price for each item.
 void removeAllCandidateItemOfferAdjustments()
          Removes all adjustments from the order's order items and resets the adjustment price for each item.
 void removeAllCandidateOfferAdjustments()
          Removes all order, order item, and fulfillment adjustments from the order and resets the adjustment price.
 void removeAllCandidateOrderOfferAdjustments()
          Removes all order adjustments from the order and resets the adjustment price.
 void setOrderSubTotalToPriceWithAdjustments()
          Sets the order subTotal to the sum of item total prices without adjustments.
 void setOrderSubTotalToPriceWithoutAdjustments()
          Sets the order subTotal to the sum of item total prices without adjustments.
 void setTotalFufillmentCharges(Money totalFulfillmentCharges)
          Sets the total fulfillmentCharges the order.
 void updateRuleVariables(Map<String,Object> ruleVars)
          Adds the underlying order 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

itemFactory

protected PromotableItemFactory itemFactory

order

protected Order order

allOrderItems

protected List<PromotableOrderItem> allOrderItems

discountableOrderItems

protected List<PromotableOrderItem> discountableOrderItems

currentSortParam

protected boolean currentSortParam

fulfillmentGroups

protected List<PromotableFulfillmentGroup> fulfillmentGroups

candidateOrderOfferAdjustments

protected List<PromotableOrderAdjustment> candidateOrderOfferAdjustments

includeOrderAndItemAdjustments

protected boolean includeOrderAndItemAdjustments
Constructor Detail

PromotableOrderImpl

public PromotableOrderImpl(Order order,
                           PromotableItemFactory itemFactory,
                           boolean includeOrderAndItemAdjustments)
Method Detail

createExistingOrderAdjustments

protected void createExistingOrderAdjustments()
Bring over the order adjustments. Intended to be used when processing fulfillment orders.


setOrderSubTotalToPriceWithoutAdjustments

public void setOrderSubTotalToPriceWithoutAdjustments()
Description copied from interface: PromotableOrder
Sets the order subTotal to the sum of item total prices without adjustments.

Specified by:
setOrderSubTotalToPriceWithoutAdjustments in interface PromotableOrder

setOrderSubTotalToPriceWithAdjustments

public void setOrderSubTotalToPriceWithAdjustments()
Description copied from interface: PromotableOrder
Sets the order subTotal to the sum of item total prices without adjustments.

Specified by:
setOrderSubTotalToPriceWithAdjustments in interface PromotableOrder

getAllOrderItems

public List<PromotableOrderItem> getAllOrderItems()
Description copied from interface: PromotableOrder
Returns all OrderItems for the order wrapped with PromotableOrderItem

Specified by:
getAllOrderItems in interface PromotableOrder
Returns:

getDiscountableOrderItems

public List<PromotableOrderItem> getDiscountableOrderItems()
Description copied from interface: PromotableOrder
Returns all OrderItems that can receive discounts.

Specified by:
getDiscountableOrderItems in interface PromotableOrder
Returns:

getDiscountableOrderItems

public List<PromotableOrderItem> getDiscountableOrderItems(boolean applyDiscountToSalePrice)
Description copied from interface: PromotableOrder
Returns all OrderItems that can receive discounts. Sorts the results by SalePrice or RetailPrice depending upon the passed in variable.

Specified by:
getDiscountableOrderItems in interface PromotableOrder
Returns:

buildPromotableOrderItemsList

protected List<PromotableOrderItem> buildPromotableOrderItemsList()

addPromotableOrderItem

protected void addPromotableOrderItem(OrderItem orderItem,
                                      List<PromotableOrderItem> discountableOrderItems)

getFulfillmentGroups

public List<PromotableFulfillmentGroup> getFulfillmentGroups()
Description copied from interface: PromotableOrder
Returns the fulfillmentGroups associated with the order after converting them to promotableFulfillmentGroups.

Specified by:
getFulfillmentGroups in interface PromotableOrder
Returns:

isHasOrderAdjustments

public boolean isHasOrderAdjustments()
Description copied from interface: PromotableOrder
Returns true if this promotableOrder has any order adjustments.

Specified by:
isHasOrderAdjustments in interface PromotableOrder
Returns:

getCandidateOrderAdjustments

public List<PromotableOrderAdjustment> getCandidateOrderAdjustments()
Description copied from interface: PromotableOrder
Returns the list of orderAdjustments being proposed for the order. This will be converted to actual order adjustments on completion of the offer processing.

Specified by:
getCandidateOrderAdjustments in interface PromotableOrder
Returns:

addCandidateOrderAdjustment

public void addCandidateOrderAdjustment(PromotableOrderAdjustment orderAdjustment)
Description copied from interface: PromotableOrder
Adds the adjustment to the order's adjustment list and discounts the order's adjustment price by the value of the adjustment.

Specified by:
addCandidateOrderAdjustment in interface PromotableOrder

removeAllCandidateOfferAdjustments

public void removeAllCandidateOfferAdjustments()
Description copied from interface: PromotableOrder
Removes all order, order item, and fulfillment adjustments from the order and resets the adjustment price.

Specified by:
removeAllCandidateOfferAdjustments in interface PromotableOrder

removeAllCandidateOrderOfferAdjustments

public void removeAllCandidateOrderOfferAdjustments()
Description copied from interface: PromotableOrder
Removes all order adjustments from the order and resets the adjustment price.

Specified by:
removeAllCandidateOrderOfferAdjustments in interface PromotableOrder

removeAllCandidateItemOfferAdjustments

public void removeAllCandidateItemOfferAdjustments()
Description copied from interface: PromotableOrder
Removes all adjustments from the order's order items and resets the adjustment price for each item.

Specified by:
removeAllCandidateItemOfferAdjustments in interface PromotableOrder

removeAllCandidateFulfillmentOfferAdjustments

public void removeAllCandidateFulfillmentOfferAdjustments()
Description copied from interface: PromotableOrder
Removes all adjustments from the order's fulfillment items and resets the adjustment price for each item.

Specified by:
removeAllCandidateFulfillmentOfferAdjustments in interface PromotableOrder

updateRuleVariables

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

Specified by:
updateRuleVariables in interface PromotableOrder

getOrder

public Order getOrder()
Description copied from interface: PromotableOrder
Returns the associated order.

Specified by:
getOrder in interface PromotableOrder

isTotalitarianOfferApplied

public boolean isTotalitarianOfferApplied()
Description copied from interface: PromotableOrder
Returns true if a totalitarian offer has been applied. A totalitarian offer is an offer that does not allow any other offers to be used at the same time. As opposed to a "non-combinable" offer which can't be used with other offers of the same type but can be used with other offers of a different type (e.g. a non-combinable order offer can be used with a non-combinable item offer).

Specified by:
isTotalitarianOfferApplied in interface PromotableOrder
Returns:

calculateOrderAdjustmentTotal

public Money calculateOrderAdjustmentTotal()
Description copied from interface: PromotableOrder
Calculates the total adjustment to be received from the order adjustments.

Specified by:
calculateOrderAdjustmentTotal in interface PromotableOrder
Returns:

calculateItemAdjustmentTotal

public Money calculateItemAdjustmentTotal()
Description copied from interface: PromotableOrder
Calculates the total adjustment to be received from the item adjustments.

Specified by:
calculateItemAdjustmentTotal in interface PromotableOrder
Returns:

getAllPromotableOrderItemPriceDetails

public List<PromotableOrderItemPriceDetail> getAllPromotableOrderItemPriceDetails()
Description copied from interface: PromotableOrder
Returns all of the price detail items for this order.

Specified by:
getAllPromotableOrderItemPriceDetails in interface PromotableOrder
Returns:

getOrderCurrency

public BroadleafCurrency getOrderCurrency()
Description copied from interface: PromotableOrder
Returns the BroadleafCurrency for the current order.

Specified by:
getOrderCurrency in interface PromotableOrder
Returns:

setTotalFufillmentCharges

public void setTotalFufillmentCharges(Money totalFulfillmentCharges)
Description copied from interface: PromotableOrder
Sets the total fulfillmentCharges the order.

Specified by:
setTotalFufillmentCharges in interface PromotableOrder

isNotCombinableOrderOfferApplied

protected boolean isNotCombinableOrderOfferApplied()

canApplyOrderOffer

public boolean canApplyOrderOffer(PromotableCandidateOrderOffer offer)
Description copied from interface: PromotableOrder
Returns true if this order can apply another order promotion. Returns false if a totalitarian or not-combinable offer has already been applied Returns false if the passed in order is not-combinable or totalitarian and this order already has adjustments

Specified by:
canApplyOrderOffer in interface PromotableOrder

calculateSubtotalWithoutAdjustments

public Money calculateSubtotalWithoutAdjustments()
Description copied from interface: PromotableOrder
Returns the price of the order without adjustments.

Specified by:
calculateSubtotalWithoutAdjustments in interface PromotableOrder
Returns:

calculateSubtotalWithAdjustments

public Money calculateSubtotalWithAdjustments()
Description copied from interface: PromotableOrder
Returns the price of the order with adjustments.

Specified by:
calculateSubtotalWithAdjustments in interface PromotableOrder
Returns:

isIncludeOrderAndItemAdjustments

public boolean isIncludeOrderAndItemAdjustments()
Description copied from interface: PromotableOrder
Returns true if this order was created in a way that existing order and item adjustments were copied over to this item.

Specified by:
isIncludeOrderAndItemAdjustments in interface PromotableOrder
Returns:


Copyright © 2013. All Rights Reserved.