Class PromotableOrderItemImpl
java.lang.Object
org.broadleafcommerce.core.offer.service.discount.domain.PromotableOrderItemImpl
- All Implemented Interfaces:
Serializable,PromotableOrderItem
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected PromotableItemFactoryprotected List<PromotableOrderItemPriceDetail>protected OrderItemprotected PromotableOrder -
Constructor Summary
ConstructorsConstructorDescriptionPromotableOrderItemImpl(OrderItem orderItem, PromotableOrder promotableOrder, PromotableItemFactory itemFactory, boolean includeAdjustments) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of all adjustments.Returns the final total for this item taking into account the finalized adjustments.Returns the total for this item if not adjustments applied.createNewDetail(int quantity) Creates a new detail with the associated quantity.Returns the currency of the related order.Returns the basePrice of the item (baseSalePrice or baseRetailPrice)Map available to implementations to store data needed for custom logic.Returns the underlying orderItem.Returns an OrderItemContainer for this OrderItem or null if this item is not an instance of OrderItemContainer.Returns the id of the contained OrderItemgetPriceBeforeAdjustments(boolean applyToSalePrice) Return the salePriceBeforeAdjustments if the passed in param is true.Returns the list of priceDetails associated with this item.intReturns the quantity for this orderItemReturns the retailPrice without adjustmentsReturns the salePrice without adjustmentsprotected voidbooleanReturns true if this item can receive item level discounts.booleanisOnSale()Returns true if the item has a sale price that is lower than the retail price.booleanReturns true if this PromotableOrderItem contains other itemsprotected voidmergeDetails(PromotableOrderItemPriceDetail firstDetail, PromotableOrderItemPriceDetail secondDetail) voidMerges any priceDetails that share the same adjustments.voidEffectively deletes all priceDetails associated with this item and rvoidCalled by pricing engine to reset the state of this item.voidupdateRuleVariables(Map<String, Object> ruleVars) Adds the item to the rule variables map.
-
Field Details
-
promotableOrder
-
orderItem
-
itemFactory
-
itemPriceDetails
-
includeAdjustments
protected boolean includeAdjustments -
extraDataMap
-
-
Constructor Details
-
PromotableOrderItemImpl
public PromotableOrderItemImpl(OrderItem orderItem, PromotableOrder promotableOrder, PromotableItemFactory itemFactory, boolean includeAdjustments)
-
-
Method Details
-
resetPriceDetails
public void resetPriceDetails()Description copied from interface:PromotableOrderItemCalled by pricing engine to reset the state of this item.- Specified by:
resetPriceDetailsin interfacePromotableOrderItem
-
initializePriceDetails
protected void initializePriceDetails() -
updateRuleVariables
Adds the item to the rule variables map.- Specified by:
updateRuleVariablesin interfacePromotableOrderItem- Parameters:
ruleVars-
-
isDiscountingAllowed
public boolean isDiscountingAllowed()Description copied from interface:PromotableOrderItemReturns true if this item can receive item level discounts.- Specified by:
isDiscountingAllowedin interfacePromotableOrderItem- Returns:
-
isOrderItemContainer
public boolean isOrderItemContainer()Description copied from interface:PromotableOrderItemReturns true if this PromotableOrderItem contains other items- Specified by:
isOrderItemContainerin interfacePromotableOrderItem
-
getOrderItemContainer
Description copied from interface:PromotableOrderItemReturns an OrderItemContainer for this OrderItem or null if this item is not an instance of OrderItemContainer.- Specified by:
getOrderItemContainerin interfacePromotableOrderItem
-
getPromotableOrderItemPriceDetails
Description copied from interface:PromotableOrderItemReturns the list of priceDetails associated with this item.- Specified by:
getPromotableOrderItemPriceDetailsin interfacePromotableOrderItem- Returns:
-
getSalePriceBeforeAdjustments
Description copied from interface:PromotableOrderItemReturns the salePrice without adjustments- Specified by:
getSalePriceBeforeAdjustmentsin interfacePromotableOrderItem
-
getRetailPriceBeforeAdjustments
Description copied from interface:PromotableOrderItemReturns the retailPrice without adjustments- Specified by:
getRetailPriceBeforeAdjustmentsin interfacePromotableOrderItem
-
getPriceBeforeAdjustments
Description copied from interface:PromotableOrderItemReturn the salePriceBeforeAdjustments if the passed in param is true. Otherwise return the retailPriceBeforeAdjustments.- Specified by:
getPriceBeforeAdjustmentsin interfacePromotableOrderItem- Returns:
-
getCurrentBasePrice
Description copied from interface:PromotableOrderItemReturns the basePrice of the item (baseSalePrice or baseRetailPrice)- Specified by:
getCurrentBasePricein interfacePromotableOrderItem- Returns:
-
getQuantity
public int getQuantity()Description copied from interface:PromotableOrderItemReturns the quantity for this orderItem- Specified by:
getQuantityin interfacePromotableOrderItem- Returns:
-
isOnSale
public boolean isOnSale()Description copied from interface:PromotableOrderItemReturns true if the item has a sale price that is lower than the retail price.- Specified by:
isOnSalein interfacePromotableOrderItem
-
getCurrency
Description copied from interface:PromotableOrderItemReturns the currency of the related order.- Specified by:
getCurrencyin interfacePromotableOrderItem- Returns:
-
removeAllItemAdjustments
public void removeAllItemAdjustments()Description copied from interface:PromotableOrderItemEffectively deletes all priceDetails associated with this item and r- Specified by:
removeAllItemAdjustmentsin interfacePromotableOrderItem
-
mergeDetails
protected void mergeDetails(PromotableOrderItemPriceDetail firstDetail, PromotableOrderItemPriceDetail secondDetail) -
mergeLikeDetails
public void mergeLikeDetails()Description copied from interface:PromotableOrderItemMerges any priceDetails that share the same adjustments.- Specified by:
mergeLikeDetailsin interfacePromotableOrderItem
-
getOrderItemId
Description copied from interface:PromotableOrderItemReturns the id of the contained OrderItem- Specified by:
getOrderItemIdin interfacePromotableOrderItem
-
calculateTotalWithAdjustments
Description copied from interface:PromotableOrderItemReturns the final total for this item taking into account the finalized adjustments. Intended to be called after the adjustments have been finalized.- Specified by:
calculateTotalWithAdjustmentsin interfacePromotableOrderItem
-
calculateTotalWithoutAdjustments
Description copied from interface:PromotableOrderItemReturns the total for this item if not adjustments applied.- Specified by:
calculateTotalWithoutAdjustmentsin interfacePromotableOrderItem
-
calculateTotalAdjustmentValue
Description copied from interface:PromotableOrderItemReturns the value of all adjustments.- Specified by:
calculateTotalAdjustmentValuein interfacePromotableOrderItem
-
createNewDetail
Description copied from interface:PromotableOrderItemCreates a new detail with the associated quantity. Intended for use as part of the PriceDetail split.- Specified by:
createNewDetailin interfacePromotableOrderItem- Returns:
-
getOrderItem
Description copied from interface:PromotableOrderItemReturns 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:
getOrderItemin interfacePromotableOrderItem- Returns:
-
getExtraDataMap
Description copied from interface:PromotableOrderItemMap available to implementations to store data needed for custom logic.- Specified by:
getExtraDataMapin interfacePromotableOrderItem
-