public class DefaultPromotionActionService extends Object implements PromotionActionService
PromotionActionService.| Constructor and Description |
|---|
DefaultPromotionActionService() |
| Modifier and Type | Method and Description |
|---|---|
protected Collection<PromotionOrderEntryConsumedModel> |
createConsumedEntries(AbstractRuleActionRAO action)
Creates a list of consumed order entries for the given action.
|
void |
createDiscountValue(DiscountRAO discountRao,
String code,
AbstractOrderEntryModel orderEntry)
Creates a
DiscountValue from the given discountRao and adds it to the given orderEntry. |
void |
createDiscountValue(DiscountRAO discountRao,
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 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(). |
AbstractRuleEngineRuleModel |
getRule(AbstractRuleActionRAO abstractRao)
returns the
AbstractRuleEngineRuleModel for the given AbstractRuleActionRAO by looking up the rule
code as stored in AbstractRuleActionRAO.getFiredRuleCode(). |
void |
recalculateTotals(AbstractOrderModel order)
Recalculates totals for the given
order. |
protected boolean |
removeDiscount(String code,
List<DiscountValue> discountValuesList,
Consumer<List<DiscountValue>> setNewDiscountValues)
Removes the
DiscountValue with the given code from the given list of DiscountValue. |
List<ItemModel> |
removeDiscountValue(String code,
AbstractOrderModel order)
Removes the
DiscountValue with the given code from the given order and its order entries. |
protected boolean |
removeOrderEntryLevelDiscount(String code,
AbstractOrderEntryModel orderEntry)
Removes the
DiscountValue with the given code from the given orderEntry. |
protected List<ItemModel> |
removeOrderEntryLevelDiscounts(String code,
AbstractOrderModel order)
Removes the
DiscountValue with the given code from the OrderEntries of the given order. |
protected boolean |
removeOrderLevelDiscount(String code,
AbstractOrderModel order)
Removes the
DiscountValue with the given code from the given order. |
void |
setCalculationService(CalculationService calculationService) |
void |
setEngineRuleDao(EngineRuleDao engineRuleDao) |
void |
setExtendedOrderDao(ExtendedOrderDao extendedOrderDao) |
void |
setModelService(ModelService modelService) |
void |
setModuleVersioningService(ModuleVersioningService moduleVersioningService) |
void |
setProductDao(ProductDao productDao) |
protected void |
setRuleModuleVersionIfApplicable(PromotionResultModel promoResult,
AbstractRuleEngineRuleModel ruleModel) |
public void recalculateTotals(AbstractOrderModel order)
PromotionActionServiceorder.recalculateTotals in interface PromotionActionServiceorder - the order to recalculate its totalspublic 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 ruleModel)
protected PromotionResultModel findExistingPromotionResultModel(AbstractRuleEngineRuleModel rule, AbstractOrderModel order)
rule - the ruleorder - the orderprotected Collection<PromotionOrderEntryConsumedModel> createConsumedEntries(AbstractRuleActionRAO action)
action - Action for which consumed order entries should be createdpublic void createDiscountValue(DiscountRAO discountRao, 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(String code, List<DiscountValue> discountValuesList, Consumer<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(String code, AbstractOrderModel order)
DiscountValue with the given code from the given order. Note: The Order is not saved!protected boolean removeOrderEntryLevelDiscount(String code, AbstractOrderEntryModel orderEntry)
DiscountValue with the given code from the given orderEntry. Note: The OrderEntry is
not saved!protected List<ItemModel> removeOrderEntryLevelDiscounts(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 List<ItemModel> removeDiscountValue(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, 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)
Copyright © 2017 SAP SE. All Rights Reserved.