public class DefaultAddProductToCartActionStrategy extends AbstractRuleActionStrategy<RuleBasedOrderAddProductActionModel>
| Constructor and Description |
|---|
DefaultAddProductToCartActionStrategy() |
createPromotionAction, getActionUtils, getCalculationService, getExtendedOrderDao, getForceImmediateRecalculation, getMetadataHandlers, getModelService, getPromotionAction, getPromotionActionService, getPromotionResultUtils, getRuleActionMetadataHandlers, getStrategyId, handleActionMetadata, handleUndoActionMetadata, recalculateIfNeeded, setActionUtils, setBeanName, setCalculationService, setExtendedOrderDao, setForceImmediateRecalculation, setModelService, setPromotionAction, setPromotionActionService, setPromotionResultUtils, setRuleActionMetadataHandlers, undoInternalpublic DefaultAddProductToCartActionStrategy()
public java.util.List<PromotionResultModel> apply(AbstractRuleActionRAO action)
DiscountRAO and is applied to Order Entry the discount is added to
corresponding Order Entry model.action - the action to applyPromotionResultModel as a result of the DiscountRAO application.protected AbstractOrderEntryModel addNewEntry(AbstractOrderModel order, ProductModel product, int quantityToAdd)
protected java.util.Optional<AbstractOrderEntryModel> getExistingGiveAwayEntry(AbstractOrderModel order, ProductModel product)
protected RuleBasedOrderAddProductActionModel createOrderAddProductAction(AbstractRuleActionRAO action, int quantity, ProductModel product, PromotionResultModel promoResult)
public void undo(ItemModel item)
RuleActionStrategyitem - the action to be undoneprotected void normalizeEntryNumbers(AbstractOrderModel order)
order's entries by assigning them increasing entry numbers starting from 0. This
method is called during the undo(ItemModel) call of this action if the undo removes an order entry
completely.order - the order to normalizeprotected AbstractOrderEntryModel findOrderEntryForUndo(AbstractOrderModel order, RuleBasedOrderAddProductActionModel action)
undo(ItemModel) method based on matching product, quantity
and giveAway flag: First tries to match an order entry that is marked as giveAway with the same
product and quantity. If none is found, tries to find an entry with just matching product and quantity. If still
none is found, tries to find an entry for the given product with higher quantity.order - the order to look for an order entry foraction - the actionprotected AbstractOrderEntryModel getEntryWithMatchingProductAndQuantity(AbstractOrderModel order, RuleBasedOrderAddProductActionModel action)
protected AbstractOrderEntryModel findMatchingGiveAwayEntry(AbstractOrderModel order, RuleBasedOrderAddProductActionModel action)
protected CartService getCartService()
public void setCartService(CartService cartService)
protected ProductService getProductService()
public void setProductService(ProductService productService)
protected RuleEngineCalculationService getRuleEngineCalculationService()
public void setRuleEngineCalculationService(RuleEngineCalculationService ruleEngineCalculationService)
protected OrderService getOrderService()
public void setOrderService(OrderService orderService)
protected OrderUtils getOrderUtils()
public void setOrderUtils(OrderUtils orderUtils)
Copyright © 2018 SAP SE. All Rights Reserved.