public class DefaultPromotionActionService extends java.lang.Object implements PromotionActionService
PromotionActionService.| Constructor and Description |
|---|
DefaultPromotionActionService() |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Collection<PromotionOrderEntryConsumedModel> |
createConsumedEntries(AbstractRuleActionRAO action)
Creates a list of consumed order entries for the given action.
|
void |
createDiscountValue(DiscountRAO discountRao,
java.lang.String code,
AbstractOrderEntryModel orderEntry)
Creates a
DiscountValue from the given discountRao and adds it to the given orderEntry. |
void |
createDiscountValue(DiscountRAO discountRao,
java.lang.String code,
AbstractOrderModel order)
Creates a
DiscountValue from the given discountRao and adds it to the given order. |
PromotionResultModel |
createPromotionResult(AbstractRuleActionRAO actionRao)
Creates a
PromotionResultModel object for the given AbstractRuleActionRAO. |
protected PromotionResultModel |
findExistingPromotionResultModel(AbstractRuleEngineRuleModel rule,
AbstractOrderModel order)
Tries to find an existing promotion result that has been fired by the same rule as the given rule.
|
protected CalculationService |
getCalculationService() |
protected CartService |
getCartService() |
protected EngineRuleDao |
getEngineRuleDao() |
protected ExtendedOrderDao |
getExtendedOrderDao() |
protected ModelService |
getModelService() |
protected ModuleVersioningService |
getModuleVersioningService() |
protected AbstractOrderModel |
getOrder(AbstractOrderRAO orderRao) |
AbstractOrderModel |
getOrder(AbstractRuleActionRAO action)
Returns the order for the given
action. |
AbstractOrderEntryModel |
getOrderEntry(AbstractRuleActionRAO action)
Looks up the
AbstractOrderEntryModel based on the given AbstractRuleActionRAO. |
protected AbstractOrderEntryModel |
getOrderEntry(OrderEntryRAO orderEntryRao) |
protected AbstractOrderModel |
getOrderInternal(AbstractRuleActionRAO action)
tries to look up the order for the given action.
|
protected ProductDao |
getProductDao() |
protected RuleBasedPromotionModel |
getPromotion(AbstractRuleActionRAO abstractRao)
returns the
RuleBasedPromotionModel for the given AbstractRuleActionRAO by looking up the rule
code as stored in AbstractRuleActionRAO.getFiredRuleCode(). |
protected PromotionResultService |
getPromotionResultService() |
AbstractRuleEngineRuleModel |
getRule(AbstractRuleActionRAO abstractRao)
returns the
AbstractRuleEngineRuleModel for the given AbstractRuleActionRAO by looking up the rule
code as stored in AbstractRuleActionRAO.getFiredRuleCode(). |
void |
recalculateFiredPromotionMessage(PromotionResultModel promoResult)
Recalculates promotion fired message and stores it in provided
PromotionResultModel. |
void |
recalculateTotals(AbstractOrderModel order)
Recalculates totals for the given
order. |
protected boolean |
removeDiscount(java.lang.String code,
java.util.List<DiscountValue> discountValuesList,
java.util.function.Consumer<java.util.List<DiscountValue>> setNewDiscountValues)
Removes the
DiscountValue with the given code from the given list of DiscountValue. |
java.util.List<ItemModel> |
removeDiscountValue(java.lang.String code,
AbstractOrderModel order)
Removes the
DiscountValue with the given code from the given order and its order entries. |
protected boolean |
removeOrderEntryLevelDiscount(java.lang.String code,
AbstractOrderEntryModel orderEntry)
Removes the
DiscountValue with the given code from the given orderEntry. |
protected java.util.List<ItemModel> |
removeOrderEntryLevelDiscounts(java.lang.String code,
AbstractOrderModel order)
Removes the
DiscountValue with the given code from the OrderEntries of the given order. |
protected boolean |
removeOrderLevelDiscount(java.lang.String code,
AbstractOrderModel order)
Removes the
DiscountValue with the given code from the given order. |
void |
setCalculationService(CalculationService calculationService) |
void |
setCartService(CartService cartService) |
void |
setEngineRuleDao(EngineRuleDao engineRuleDao) |
void |
setExtendedOrderDao(ExtendedOrderDao extendedOrderDao) |
void |
setModelService(ModelService modelService) |
void |
setModuleVersioningService(ModuleVersioningService moduleVersioningService) |
void |
setProductDao(ProductDao productDao) |
void |
setPromotionResultService(PromotionResultService promotionResultService) |
protected void |
setRuleModuleVersionIfApplicable(PromotionResultModel promoResult,
AbstractRuleEngineRuleModel rule) |
public void recalculateTotals(AbstractOrderModel order)
PromotionActionServiceorder.recalculateTotals in interface PromotionActionServiceorder - the order to recalculate its totalspublic void recalculateFiredPromotionMessage(PromotionResultModel promoResult)
PromotionActionServicePromotionResultModel. This method should be
used for potential promotion only to update computed values displayed in the messagerecalculateFiredPromotionMessage in interface PromotionActionServicepromoResult - a promotion result that holds fired promotion message which needs to be updatedpublic PromotionResultModel createPromotionResult(AbstractRuleActionRAO actionRao)
PromotionActionServicePromotionResultModel object for the given AbstractRuleActionRAO.createPromotionResult in interface PromotionActionServiceactionRao - the action rao to use for the promotion result creationPromotionResultModel.protected void setRuleModuleVersionIfApplicable(PromotionResultModel promoResult, AbstractRuleEngineRuleModel rule)
protected PromotionResultModel findExistingPromotionResultModel(AbstractRuleEngineRuleModel rule, AbstractOrderModel order)
rule - the ruleorder - the orderprotected java.util.Collection<PromotionOrderEntryConsumedModel> createConsumedEntries(AbstractRuleActionRAO action)
action - Action for which consumed order entries should be createdpublic void createDiscountValue(DiscountRAO discountRao, java.lang.String code, AbstractOrderModel order)
PromotionActionServiceDiscountValue from the given discountRao and adds it to the given order. Note:
The order is not saved!createDiscountValue in interface PromotionActionServicediscountRao - the discountRao to take the values fromcode - the code for the new DiscountValue (e.g. UUID from the respective AbstractPromotionActionModel
that creates this discount)order - the order to apply the discount value toprotected boolean removeDiscount(java.lang.String code,
java.util.List<DiscountValue> discountValuesList,
java.util.function.Consumer<java.util.List<DiscountValue>> setNewDiscountValues)
DiscountValue with the given code from the given list of DiscountValue. Then calls
setNewDiscountValues handler to process the newly gotten list (already w/o the removed item) of
DiscountValue.setNewDiscountValues - if null its method accept(..) is not called.protected boolean removeOrderLevelDiscount(java.lang.String code,
AbstractOrderModel order)
DiscountValue with the given code from the given order. Note: The Order is not saved!protected boolean removeOrderEntryLevelDiscount(java.lang.String code,
AbstractOrderEntryModel orderEntry)
DiscountValue with the given code from the given orderEntry. Note: The OrderEntry is
not saved!protected java.util.List<ItemModel> removeOrderEntryLevelDiscounts(java.lang.String code, AbstractOrderModel order)
DiscountValue with the given code from the OrderEntries of the given order. Note: The
OrderEntries and Order are not saved!public java.util.List<ItemModel> removeDiscountValue(java.lang.String code, AbstractOrderModel order)
PromotionActionServiceDiscountValue with the given code from the given order and its order entries. Returns
the list of all modified items (order, order entries). Note: The returned items are not saved!removeDiscountValue in interface PromotionActionServicecode - the code for the DiscountValue to be removedorder - the order to remove the discount value frompublic void createDiscountValue(DiscountRAO discountRao, java.lang.String code, AbstractOrderEntryModel orderEntry)
PromotionActionServiceDiscountValue from the given discountRao and adds it to the given orderEntry.
Note: The orderEntry is not saved!createDiscountValue in interface PromotionActionServicediscountRao - the discountRao to take the values fromcode - the code for the new DiscountValue (e.g. UUID from the respective AbstractPromotionActionModel
that creates this discount)orderEntry - the orderEntry to apply the discount value topublic AbstractOrderEntryModel getOrderEntry(AbstractRuleActionRAO action)
PromotionActionServiceAbstractOrderEntryModel based on the given AbstractRuleActionRAO.getOrderEntry in interface PromotionActionServiceaction - the action to use for the look-upprotected AbstractOrderEntryModel getOrderEntry(OrderEntryRAO orderEntryRao)
public AbstractOrderModel getOrder(AbstractRuleActionRAO action)
PromotionActionServiceaction.getOrder in interface PromotionActionServiceaction - the orderRaoprotected AbstractOrderModel getOrderInternal(AbstractRuleActionRAO action)
action - the actionprotected RuleBasedPromotionModel getPromotion(AbstractRuleActionRAO abstractRao)
RuleBasedPromotionModel for the given AbstractRuleActionRAO by looking up the rule
code as stored in AbstractRuleActionRAO.getFiredRuleCode().abstractRao - the rao to get the promotion forpublic AbstractRuleEngineRuleModel getRule(AbstractRuleActionRAO abstractRao)
AbstractRuleEngineRuleModel for the given AbstractRuleActionRAO by looking up the rule
code as stored in AbstractRuleActionRAO.getFiredRuleCode().getRule in interface PromotionActionServiceabstractRao - the rao to get the rule forprotected AbstractOrderModel getOrder(AbstractOrderRAO orderRao)
protected ExtendedOrderDao getExtendedOrderDao()
public void setExtendedOrderDao(ExtendedOrderDao extendedOrderDao)
public void setModelService(ModelService modelService)
protected ModelService getModelService()
protected CalculationService getCalculationService()
public void setCalculationService(CalculationService calculationService)
protected ProductDao getProductDao()
public void setProductDao(ProductDao productDao)
protected EngineRuleDao getEngineRuleDao()
public void setEngineRuleDao(EngineRuleDao engineRuleDao)
protected ModuleVersioningService getModuleVersioningService()
public void setModuleVersioningService(ModuleVersioningService moduleVersioningService)
protected PromotionResultService getPromotionResultService()
public void setPromotionResultService(PromotionResultService promotionResultService)
protected CartService getCartService()
public void setCartService(CartService cartService)
Copyright © 2018 SAP SE. All Rights Reserved.