Class DefaultSapPromotionEngineService
- java.lang.Object
-
- de.hybris.platform.promotionengineservices.promotionengine.impl.DefaultPromotionEngineService
-
- de.hybris.platform.sap.sappricing.services.impl.DefaultSapPromotionEngineService
-
- All Implemented Interfaces:
PromotionEngineService,PromotionsService
public class DefaultSapPromotionEngineService extends DefaultPromotionEngineService
Default implementation of Sap Promotion Engine Service.
-
-
Constructor Summary
Constructors Constructor Description DefaultSapPromotionEngineService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanupCart(CartModel cart)Delete the the stored promotion results for a Cart.RuleEvaluationResultevaluate(ProductModel product, java.util.Collection<PromotionGroupModel> promotionGroups)Evaluates promotion against a product taking into context which is set by promotions groupjava.util.List<? extends AbstractPromotionModel>getAbstractProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, ProductModel product, boolean evaluateRestrictions, java.util.Date date)Get the ordered list ofAbstractPromotionModelinstances that are related to theProductModelspecified.PromotionOrderResultsgetPromotionResults(AbstractOrderModel order)Get the promotion results for the specified order.PromotionOrderResultsgetPromotionResults(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)Get the promotion results for the specified order.protected SapPricingEnablementServicegetSapPricingEnablementService()voidsetSapPricingEnablementService(SapPricingEnablementService sapPricingEnablementService)voidtransferPromotionsToOrder(AbstractOrderModel source, OrderModel target, boolean onlyTransferAppliedPromotions)Transfer the promotions applied to a cart to a new order.PromotionOrderResultsupdatePromotions(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order)Update the promotions on the specifiedAbstractOrderobject.PromotionOrderResultsupdatePromotions(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)Update the promotions on the specifiedAbstractOrderModelobject.-
Methods inherited from class de.hybris.platform.promotionengineservices.promotionengine.impl.DefaultPromotionEngineService
cleanupAbstractOrder, determineRuleEngineContext, determineRuleEngineContext, evaluate, evaluate, findImmutablePromotionByUniqueKey, getAbstractProductPromotions, getCalculationService, getCatalogVersionService, getCategoryCodesForProduct, getCategoryService, getCommerceRuleEngineService, getConfigurationService, getDataUniqueKey, getDefaultPromotionGroup, getDefaultPromotionsService, getEngineRuleDao, getFactContextFactory, getFlexibleSearchService, getModelService, getOrderPromotions, getOrderPromotions, getOrderPromotions, getOrderPromotions, getOrderPromotions, getOrderPromotions, getOrderPromotions, getOrderPromotions, getProductPromotions, getProductPromotions, getProductUtils, getPromotionDao, getPromotionDescription, getPromotionGroup, getPromotions, getPromotionsForProduct, getPromotionSourceRuleDao, getRestrictions, getRuleActionService, getRuleActionStrategy, getRuleBasedPromotionsContextValidator, getRuleEngineContextDao, getRuleEngineContextFinderStrategy, getRuleEngineContextForCatalogVersionsFinderStrategy, getSessionService, getStrategies, getTimeService, isApplicable, prepareContext, provideRAOs, recalculateCart, setCalculationService, setCatalogVersionService, setCategoryService, setCommerceRuleEngineService, setConfigurationService, setDefaultPromotionsService, setEngineRuleDao, setFactContextFactory, setFlexibleSearchService, setModelService, setProductUtils, setPromotionDao, setPromotionSourceRuleDao, setRuleActionService, setRuleBasedPromotionsContextValidator, setRuleEngineContextDao, setRuleEngineContextFinderStrategy, setRuleEngineContextForCatalogVersionsFinderStrategy, setSessionService, setStrategies, setTimeService, undoPromotionAction, updatePromotionsNotThreadSafe, updatePromotionsNotThreadSafe
-
-
-
-
Method Detail
-
evaluate
public RuleEvaluationResult evaluate(ProductModel product, java.util.Collection<PromotionGroupModel> promotionGroups)
Description copied from interface:PromotionEngineServiceEvaluates promotion against a product taking into context which is set by promotions group- Specified by:
evaluatein interfacePromotionEngineService- Overrides:
evaluatein classDefaultPromotionEngineService- Parameters:
product- to evaluate promotions forpromotionGroups- collection of promotion groups to apply promotions for- Returns:
- Map containing Promotion data as its values along with corresponding identifiers as its keys
-
getAbstractProductPromotions
public java.util.List<? extends AbstractPromotionModel> getAbstractProductPromotions(java.util.Collection<PromotionGroupModel> promotionGroups, ProductModel product, boolean evaluateRestrictions, java.util.Date date)
Description copied from interface:PromotionsServiceGet the ordered list ofAbstractPromotionModelinstances that are related to theProductModelspecified.- Specified by:
getAbstractProductPromotionsin interfacePromotionsService- Overrides:
getAbstractProductPromotionsin classDefaultPromotionEngineService- Parameters:
promotionGroups- The promotion groups to evaluateproduct- The product that the promotions are related toevaluateRestrictions- Flag, pass false to ignore any restrictions specified on the promotions, pass true to observe the restrictions.date- The date to check for promotions, typically the current date- Returns:
- The list of
AbstractPromotionModelrelated to theProductModelspecified
-
updatePromotions
public PromotionOrderResults updatePromotions(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order)
Description copied from interface:PromotionsServiceUpdate the promotions on the specifiedAbstractOrderobject. This method will automatically apply all possible product promotional updates to the cart, but not apply order level promotions. Any previously applied order level promotions will remain applied. Promotions are evaluated at the current system time. The promotion results are stored in the database and the samePromotionOrderResultscan be obtained later by callingPromotionsService.getPromotionResults(de.hybris.platform.core.model.order.AbstractOrderModel).- Specified by:
updatePromotionsin interfacePromotionsService- Overrides:
updatePromotionsin classDefaultPromotionEngineService- Parameters:
promotionGroups- The promotion groups to evaluateorder- The order object to update with the results of the promotions- Returns:
- The promotion results
-
updatePromotions
public PromotionOrderResults updatePromotions(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)
Description copied from interface:PromotionsServiceUpdate the promotions on the specifiedAbstractOrderModelobject. The resulting promotions can be retrieved later by callingPromotionsService.getPromotionResults(de.hybris.platform.core.model.order.AbstractOrderModel). The order must be calculated before calling this method.PromotionsService.updatePromotions(java.util.Collection<de.hybris.platform.promotions.model.PromotionGroupModel>, de.hybris.platform.core.model.order.AbstractOrderModel)must be called after callingAbstractOrder.recalculate()on theAbstractOrderModel. Where thePromotionsManager.AutoApplyModeis set toPromotionsManager.AutoApplyMode.KEEP_APPLIEDthe state of any previously appliedPromotionResultis recorded and if it is still in the fired state (PromotionResult.isApplied()) after reevaluating the promotions it will be automatically reapplied. The promotion results are stored in the database and the samePromotionOrderResultscan be obtained later by callingPromotionsService.getPromotionResults(de.hybris.platform.core.model.order.AbstractOrderModel). After this method is called, please call getModelService().refresh(order) or getModelService().save(order).- Specified by:
updatePromotionsin interfacePromotionsService- Overrides:
updatePromotionsin classDefaultPromotionEngineService- Parameters:
promotionGroups- The promotion groups to evaluateorder- The AbstractOrder object to update the promotions forevaluateRestrictions- If true any promotion restrictions will be observed, if false all promotion restrictions are ignoredproductPromotionMode- The auto apply mode. This determines whether this method applies any product promotional changes to line items or discounts to the overall amountorderPromotionMode- The auto apply mode. This determines whether this method applies any order promotional changes to line items or discounts to the overall amountdate- The effective date for the promotions to check. Use this to to see the effects of promotions in the past or future.- Returns:
- The promotion results
-
getPromotionResults
public PromotionOrderResults getPromotionResults(AbstractOrderModel order)
Description copied from interface:PromotionsServiceGet the promotion results for the specified order. These are the promotion results stored in the database for the specified order as generated by the last call toPromotionsService.updatePromotions(java.util.Collection<de.hybris.platform.promotions.model.PromotionGroupModel>, de.hybris.platform.core.model.order.AbstractOrderModel)for the same order. If any of the promotion results are invalid then they will be ignored.- Specified by:
getPromotionResultsin interfacePromotionsService- Overrides:
getPromotionResultsin classDefaultPromotionEngineService- Parameters:
order- The order to get the promotion results for- Returns:
- The promotion results
-
getPromotionResults
public PromotionOrderResults getPromotionResults(java.util.Collection<PromotionGroupModel> promotionGroups, AbstractOrderModel order, boolean evaluateRestrictions, PromotionsManager.AutoApplyMode productPromotionMode, PromotionsManager.AutoApplyMode orderPromotionMode, java.util.Date date)
Description copied from interface:PromotionsServiceGet the promotion results for the specified order. These are the promotion results stored in the database for the specified order as generated by the last call toPromotionsService.updatePromotions(java.util.Collection<de.hybris.platform.promotions.model.PromotionGroupModel>, de.hybris.platform.core.model.order.AbstractOrderModel)for the same order. If any of the promotion results are invalid then this method will recalculate the promotions by callingPromotionsService.updatePromotions(java.util.Collection<de.hybris.platform.promotions.model.PromotionGroupModel>, de.hybris.platform.core.model.order.AbstractOrderModel).- Specified by:
getPromotionResultsin interfacePromotionsService- Overrides:
getPromotionResultsin classDefaultPromotionEngineService- Parameters:
promotionGroups- The promotion groups to evaluateorder- The AbstractOrder object to get the promotions forevaluateRestrictions- If true any promotion restrictions will be observed, if false all promotion restrictions are ignoredproductPromotionMode- The auto apply mode. This determines whether this method applies any product promotional changes to line items or discounts to the overall amountorderPromotionMode- The auto apply mode. This determines whether this method applies any order promotional changes to line items or discounts to the overall amountdate- The effective date for the promotions to check. Use this to to see the effects of promotions in the past or future.- Returns:
- The promotion results
-
cleanupCart
public void cleanupCart(CartModel cart)
Description copied from interface:PromotionsServiceDelete the the stored promotion results for a Cart.- Specified by:
cleanupCartin interfacePromotionsService- Overrides:
cleanupCartin classDefaultPromotionEngineService- Parameters:
cart- TheCartto delete the results for
-
transferPromotionsToOrder
public void transferPromotionsToOrder(AbstractOrderModel source, OrderModel target, boolean onlyTransferAppliedPromotions)
Description copied from interface:PromotionsServiceTransfer the promotions applied to a cart to a new order. This is used when an order is created from a cart.- Specified by:
transferPromotionsToOrderin interfacePromotionsService- Overrides:
transferPromotionsToOrderin classDefaultPromotionEngineService- Parameters:
source- The cart that has promotionstarget- The order that promotions should be applied toonlyTransferAppliedPromotions- Flag to indicate that only applied promotions should be transfered. If false all promotion results will be transfered
-
getSapPricingEnablementService
protected SapPricingEnablementService getSapPricingEnablementService()
-
setSapPricingEnablementService
public void setSapPricingEnablementService(SapPricingEnablementService sapPricingEnablementService)
-
-