public class DefaultPromotionEngineResultService extends java.lang.Object implements PromotionResultService
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
EMPTY_VALUE |
protected static java.util.regex.Pattern |
LIST_PATTERN |
protected static java.util.regex.Pattern |
MAP_PATTERN |
| Constructor and Description |
|---|
DefaultPromotionEngineResultService() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(PromotionResultModel promotionResult)
Apply all of the actions that this promotion generated to the order.
|
protected CommonI18NService |
getCommonI18NService() |
long |
getConsumedCount(PromotionResultModel promotionResult,
boolean paramBoolean)
Get the total number of items consumed by this promotion.
|
boolean |
getCouldFire(PromotionResultModel promotionResult)
Is this a potential result.
|
protected CouponCodeRetrievalStrategy |
getCouponCodeRetrievalStrategy() |
java.util.Optional<java.util.Set<java.lang.String>> |
getCouponCodesFromPromotion(PromotionResultModel promotionResult)
Return give way coupon code for promotion.
|
protected DefaultPromotionResultService |
getDefaultPromotionResultService() |
java.lang.String |
getDescription(PromotionResultModel promotionResult)
Get the description of this promotion result.
|
java.lang.String |
getDescription(PromotionResultModel promotionResult,
java.util.Locale locale)
Get the description of this promotion result.
|
boolean |
getFired(PromotionResultModel promotionResult)
Returns true if the promotion fired and has produced a result.
|
java.util.List<PromotionResultModel> |
getFiredOrderPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for promotions that fired and did not consume products.
|
java.util.List<PromotionResultModel> |
getFiredProductPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for promotions that fired and consumed products.
|
protected java.lang.String |
getMessageWithResolvedParameters(PromotionResultModel promotionResult,
java.util.Locale locale,
java.lang.String messageFiredPositional,
java.util.List<RuleParameterData> parameters)
Formats message by resolving placeholders defined in the message.
|
protected ModelService |
getModelService() |
java.util.List<PromotionResultModel> |
getPotentialOrderPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for potential promotions that fired and did not consume products and have been applied.
|
java.util.List<PromotionResultModel> |
getPotentialProductPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for potential promotions that fired and consumed products and have been applied.
|
protected java.util.Map<java.lang.String,PromotionMessageParameterResolutionStrategy> |
getResolutionStrategies() |
protected RuleParametersService |
getRuleParametersService() |
double |
getTotalDiscount(PromotionResultModel promotionResult)
Get the total value of all discounts in this result.
|
boolean |
isApplied(PromotionResultModel promotionResult)
Returns true if the promotion fired and all of its actions have been applied to the order.
|
boolean |
isAppliedToOrder(PromotionResultModel promotionResult)
Returns true if the promotion fired and all of its actions have been applied to the order.
|
protected boolean |
isRuleBasedPromotion(AbstractPromotionModel abstractPromotion) |
protected void |
logMissingParametersResolutionStrategies(java.util.List<RuleParameterData> parameters,
java.util.Map<java.lang.String,java.lang.Object> messageActionValues) |
protected void |
logUnresolvedPlaceholder(PromotionResultModel promotionResult,
java.lang.String resolvedMessage) |
protected RuleParameterData |
replaceRuleParameterValue(PromotionResultModel promotionResult,
java.util.Map<java.lang.String,java.lang.Object> messageActionValues,
RuleParameterData parameter) |
protected java.lang.Object |
resolveParameterValue(RuleParameterData parameter,
PromotionResultModel promotionResult,
java.util.Locale locale) |
void |
setCommonI18NService(CommonI18NService commonI18NService) |
void |
setCouponCodeRetrievalStrategy(CouponCodeRetrievalStrategy couponCodeRetrievalStrategy) |
void |
setDefaultPromotionResultService(DefaultPromotionResultService defaultPromotionResultService) |
void |
setModelService(ModelService modelService) |
void |
setResolutionStrategies(java.util.Map<java.lang.String,PromotionMessageParameterResolutionStrategy> resolutionStrategies) |
void |
setRuleParametersService(RuleParametersService ruleParametersService) |
boolean |
undo(PromotionResultModel promotionResult)
Undo all of the changes that this promotion made to the order.
|
protected static final java.lang.String EMPTY_VALUE
protected static final java.util.regex.Pattern LIST_PATTERN
protected static final java.util.regex.Pattern MAP_PATTERN
public java.lang.String getDescription(PromotionResultModel promotionResult)
PromotionResultServicegetDescription in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelPromotionResultService.getDescription(PromotionResultModel, java.util.Locale)public boolean apply(PromotionResultModel promotionResult)
PromotionResultServiceapply in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelpublic long getConsumedCount(PromotionResultModel promotionResult, boolean paramBoolean)
PromotionResultServicegetConsumedCount in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelparamBoolean - include could fire promotionspublic boolean getCouldFire(PromotionResultModel promotionResult)
PromotionResultServicegetCouldFire in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelpublic java.lang.String getDescription(PromotionResultModel promotionResult, java.util.Locale locale)
PromotionResultServiceLocale specified is used to format any numbers, dates or currencies for display to the user. It is
important that this locale best represents the formatting options appropriate for display to the user. The default
currency for the locale is ignored. The currency is always explicitly taken from the
GeneratedAbstractOrder.getCurrency(). The currency is then formatted appropriately in
the locale specified. For example, this does mean that values in the EURO currency will be formatted differently
depending on the locale specified as each locale can specify currency specific formatting.
The currency formatting is part of the Java VM configuration to support multiple locales. If the formatting is
incorrect check your VM configuration for the locale and currency combination.getDescription in interface PromotionResultServicepromotionResult - - instance of PromotionResultModellocale - The locale to use to format the messages. This locale must support currency formatting, i.e. this should
be a region specific local. e.g de_DE, en_US, en_GBprotected void logMissingParametersResolutionStrategies(java.util.List<RuleParameterData> parameters, java.util.Map<java.lang.String,java.lang.Object> messageActionValues)
protected boolean isRuleBasedPromotion(AbstractPromotionModel abstractPromotion)
protected RuleParameterData replaceRuleParameterValue(PromotionResultModel promotionResult, java.util.Map<java.lang.String,java.lang.Object> messageActionValues, RuleParameterData parameter)
protected java.lang.String getMessageWithResolvedParameters(PromotionResultModel promotionResult, java.util.Locale locale, java.lang.String messageFiredPositional, java.util.List<RuleParameterData> parameters)
promotionResult - locale - messageFiredPositional - parameters - protected void logUnresolvedPlaceholder(PromotionResultModel promotionResult, java.lang.String resolvedMessage)
protected java.lang.Object resolveParameterValue(RuleParameterData parameter, PromotionResultModel promotionResult, java.util.Locale locale)
public boolean getFired(PromotionResultModel promotionResult)
PromotionResultServicegetFired in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelpublic double getTotalDiscount(PromotionResultModel promotionResult)
PromotionResultServicegetTotalDiscount in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelpublic boolean isApplied(PromotionResultModel promotionResult)
PromotionResultServiceisApplied in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelpublic boolean isAppliedToOrder(PromotionResultModel promotionResult)
PromotionResultServiceisAppliedToOrder in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelpublic boolean undo(PromotionResultModel promotionResult)
PromotionResultServiceundo in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelpublic java.util.List<PromotionResultModel> getPotentialProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
PromotionResultServicegetPotentialProductPromotions in interface PromotionResultServicepromoResult - - instance of PromotionOrderResultspromotion - - instance of AbstractPromotionModelpublic java.util.List<PromotionResultModel> getPotentialOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
PromotionResultServicegetPotentialOrderPromotions in interface PromotionResultServicepromoResult - - instance of PromotionOrderResultspromotion - - instance of AbstractPromotionModelpublic java.util.List<PromotionResultModel> getFiredProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
PromotionResultServicegetFiredProductPromotions in interface PromotionResultServicepromoResult - - instance of PromotionOrderResultspromotion - - instance of AbstractPromotionModelpublic java.util.List<PromotionResultModel> getFiredOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
PromotionResultServicegetFiredOrderPromotions in interface PromotionResultServicepromoResult - - instance of PromotionOrderResultspromotion - - instance of AbstractPromotionModelpublic java.util.Optional<java.util.Set<java.lang.String>> getCouponCodesFromPromotion(PromotionResultModel promotionResult)
PromotionResultServicegetCouponCodesFromPromotion in interface PromotionResultServicepromotionResult - - instance of PromotionResultModelprotected DefaultPromotionResultService getDefaultPromotionResultService()
public void setDefaultPromotionResultService(DefaultPromotionResultService defaultPromotionResultService)
protected CommonI18NService getCommonI18NService()
public void setCommonI18NService(CommonI18NService commonI18NService)
protected java.util.Map<java.lang.String,PromotionMessageParameterResolutionStrategy> getResolutionStrategies()
public void setResolutionStrategies(java.util.Map<java.lang.String,PromotionMessageParameterResolutionStrategy> resolutionStrategies)
protected RuleParametersService getRuleParametersService()
public void setRuleParametersService(RuleParametersService ruleParametersService)
protected CouponCodeRetrievalStrategy getCouponCodeRetrievalStrategy()
public void setCouponCodeRetrievalStrategy(CouponCodeRetrievalStrategy couponCodeRetrievalStrategy)
protected ModelService getModelService()
public void setModelService(ModelService modelService)
Copyright © 2018 SAP SE. All Rights Reserved.