public class DefaultPromotionEngineResultService extends Object implements PromotionResultService
| Modifier and Type | Field and Description |
|---|---|
protected static String |
EMPTY_VALUE |
protected static Pattern |
LIST_PATTERN |
protected static 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 String |
formatMessage(String pattern,
List<Object> arguments,
Locale locale)
Formats the given
message using Java's MessageFormat |
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.
|
Optional<Set<String>> |
getCouponCodesFromPromotion(PromotionResultModel promotionResult)
Return give way coupon code for promotion.
|
protected DefaultPromotionResultService |
getDefaultPromotionResultService() |
String |
getDescription(PromotionResultModel promotionResult)
Get the description of this promotion result.
|
String |
getDescription(PromotionResultModel promotionResult,
Locale locale)
Get the description of this promotion result.
|
boolean |
getFired(PromotionResultModel promotionResult)
Returns true if the promotion fired and has produced a result.
|
List<PromotionResultModel> |
getFiredOrderPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for promotions that fired and did not consume products.
|
List<PromotionResultModel> |
getFiredProductPromotions(PromotionOrderResults promoResult,
AbstractPromotionModel promotion)
Return a list of results for promotions that fired and consumed products.
|
protected String |
getMessageWithResolvedParameters(PromotionResultModel promotionResult,
Locale locale,
String messageFiredPositional,
List<RuleParameterData> parameters) |
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.
|
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 MessagePlaceholderReplacementStrategy |
getReplacementStrategy() |
protected Map<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 RuleParameterData |
replaceRuleParameterValue(PromotionResultModel promotionResult,
Map<String,Object> messageActionValues,
RuleParameterData parameter) |
protected Object |
resolveParameterValue(RuleParameterData parameter,
PromotionResultModel promotionResult,
Locale locale) |
void |
setCommonI18NService(CommonI18NService commonI18NService) |
void |
setDefaultPromotionResultService(DefaultPromotionResultService defaultPromotionResultService) |
void |
setReplacementStrategy(MessagePlaceholderReplacementStrategy replacementStrategy) |
void |
setResolutionStrategies(Map<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 String EMPTY_VALUE
protected static final Pattern LIST_PATTERN
protected static final Pattern MAP_PATTERN
public String getDescription(PromotionResultModel promotionResult)
PromotionResultServicegetDescription in interface PromotionResultServicePromotionResultService.getDescription(PromotionResultModel, java.util.Locale)public boolean apply(PromotionResultModel promotionResult)
PromotionResultServiceapply in interface PromotionResultServicepublic long getConsumedCount(PromotionResultModel promotionResult, boolean paramBoolean)
PromotionResultServicegetConsumedCount in interface PromotionResultServiceparamBoolean - include could fire promotionspublic boolean getCouldFire(PromotionResultModel promotionResult)
PromotionResultServicegetCouldFire in interface PromotionResultServicepublic String getDescription(PromotionResultModel promotionResult, 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 PromotionResultServicelocale - 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 boolean isRuleBasedPromotion(AbstractPromotionModel abstractPromotion)
protected RuleParameterData replaceRuleParameterValue(PromotionResultModel promotionResult, Map<String,Object> messageActionValues, RuleParameterData parameter)
protected String getMessageWithResolvedParameters(PromotionResultModel promotionResult, Locale locale, String messageFiredPositional, List<RuleParameterData> parameters)
protected Object resolveParameterValue(RuleParameterData parameter, PromotionResultModel promotionResult, Locale locale)
protected String formatMessage(String pattern, List<Object> arguments, Locale locale)
message using Java's MessageFormatpattern - the message patternarguments - the arguments to pass into the patternlocale - the rendering localepublic boolean getFired(PromotionResultModel promotionResult)
PromotionResultServicegetFired in interface PromotionResultServicepublic double getTotalDiscount(PromotionResultModel promotionResult)
PromotionResultServicegetTotalDiscount in interface PromotionResultServicepublic boolean isApplied(PromotionResultModel promotionResult)
PromotionResultServiceisApplied in interface PromotionResultServicepublic boolean isAppliedToOrder(PromotionResultModel promotionResult)
PromotionResultServiceisAppliedToOrder in interface PromotionResultServicepublic boolean undo(PromotionResultModel promotionResult)
PromotionResultServiceundo in interface PromotionResultServicepublic List<PromotionResultModel> getPotentialProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
PromotionResultServicegetPotentialProductPromotions in interface PromotionResultServicepublic List<PromotionResultModel> getPotentialOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
PromotionResultServicegetPotentialOrderPromotions in interface PromotionResultServicepublic List<PromotionResultModel> getFiredProductPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
PromotionResultServicegetFiredProductPromotions in interface PromotionResultServicepublic List<PromotionResultModel> getFiredOrderPromotions(PromotionOrderResults promoResult, AbstractPromotionModel promotion)
PromotionResultServicegetFiredOrderPromotions in interface PromotionResultServicepublic Optional<Set<String>> getCouponCodesFromPromotion(PromotionResultModel promotionResult)
PromotionResultServicegetCouponCodesFromPromotion in interface PromotionResultServiceprotected DefaultPromotionResultService getDefaultPromotionResultService()
public void setDefaultPromotionResultService(DefaultPromotionResultService defaultPromotionResultService)
protected CommonI18NService getCommonI18NService()
public void setCommonI18NService(CommonI18NService commonI18NService)
protected Map<String,PromotionMessageParameterResolutionStrategy> getResolutionStrategies()
public void setResolutionStrategies(Map<String,PromotionMessageParameterResolutionStrategy> resolutionStrategies)
protected MessagePlaceholderReplacementStrategy getReplacementStrategy()
public void setReplacementStrategy(MessagePlaceholderReplacementStrategy replacementStrategy)
protected RuleParametersService getRuleParametersService()
public void setRuleParametersService(RuleParametersService ruleParametersService)
Copyright © 2017 SAP SE. All Rights Reserved.