Class AbstractRuleExecutableSupport
java.lang.Object
de.hybris.platform.ruleengineservices.rule.evaluation.actions.AbstractRuleExecutableSupport
- All Implemented Interfaces:
RAOAction,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware
- Direct Known Subclasses:
AbstractRulePartnerProductAction,AbstractRuleSubsetProductAction,ProductConfigAbstractRAOAction,RuleAddCouponRAOAction,RuleChangeDeliveryModeRAOAction,RuleHaltRAOAction,RuleOrderEntryFixedDiscountRAOAction,RuleOrderEntryFixedPriceRAOAction,RuleOrderEntryPercentageDiscountRAOAction,RuleOrderFixedDiscountRAOAction,RuleOrderPercentageDiscountRAOAction,RuleTriggerMessageRAOAction
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddMetadataToRao(AbstractRuleActionRAO rao, RuleActionContext context) protected org.drools.core.spi.KnowledgeHelpercheckAndGetRuleContext(RuleActionContext context) Checks that the givenruleContextis of typeKnowledgeHelper(i.e.protected Optional<BigDecimal>extractAmountForCurrency(RuleActionContext context, Object currencyAmount) protected List<ActionSupplementStrategy>protected ConfigurationServiceprotected RAOConsumptionSupportprotected CurrencyUtilsgetMetaDataFromRule(RuleActionContext context) protected StringgetMetaDataFromRule(RuleActionContext context, String key) Returns the rule's meta-data for the given key (ornull).protected PriceAdjustmentStrategy<OrderEntryRAO>protected RAOLookupServiceprotected RaoUtilsprotected StringgetRuleCode(RuleActionContext context) Returns the rule's rule code meta data.protected RuleEngineCalculationServiceprotected StringgetRuleGroupCode(RuleActionContext context) Returns the rule's rule group code meta data.protected RuleAndRuleGroupExecutionTrackergetRuntimeTracker(RuleActionContext context) protected booleanisRuleGroupExclusive(RuleActionContext context) protected booleanmergeDiscounts(RuleActionContext context, DiscountRAO discountRao, OrderEntryRAO entry) voidperformAction(RuleActionContext context) perform action on RAO objectsprotected booleanperformActionInternal(RuleActionContext context) template method called inside ofperformAction(RuleActionContext)protected voidpostProcessAction(AbstractRuleActionRAO actionRao, RuleActionContext context) voidsetActionSupplementStrategies(List<ActionSupplementStrategy> actionSupplementStrategies) voidsetBeanName(String beanName) voidsetConfigurationService(ConfigurationService configurationService) voidsetConsumptionSupport(RAOConsumptionSupport consumptionSupport) voidsetCurrencyUtils(CurrencyUtils currencyUtils) voidsetPriceAdjustmentStrategy(PriceAdjustmentStrategy<OrderEntryRAO> priceAdjustmentStrategy) voidsetRaoLookupService(RAOLookupService raoLookupService) voidsetRAOMetaData(RuleActionContext context, AbstractRuleActionRAO... raos) voidsetRaoUtils(RaoUtils raoUtils) voidsetRuleEngineCalculationService(RuleEngineCalculationService ruleEngineCalculationService) protected booleanshouldPerformAction(AbstractRuleActionRAO actionRao, RuleActionContext context) protected voidsplitEntriesSelectionStrategies(List<EntriesSelectionStrategyRPD> entriesSelectionStrategyRPDs, List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForAction, List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForTriggering) protected voidtrackActionExecution(RuleActionContext context) protected voidvalidateCurrencyIsoCode(boolean absolute, String currencyIsoCode) protected voidvalidateParameters(Map<String, Object> parameters) protected voidvalidateRule(RuleActionContext context) Validates that the required meta-data is available.protected voidvalidateSelectionStrategy(Collection<EntriesSelectionStrategyRPD> strategies, RuleActionContext context) ValidatesentriesSelectionStrategyRPDschecking if the collection is not empty, if orderEntries list of each entry of entriesSelectionStrategyRPDs is not empty and all the orderEntries are from the same Order.
-
Constructor Details
-
AbstractRuleExecutableSupport
public AbstractRuleExecutableSupport()
-
-
Method Details
-
performAction
Description copied from interface:RAOActionperform action on RAO objects- Specified by:
performActionin interfaceRAOAction- Parameters:
context- - instance of RuleActionContext
-
validateParameters
-
performActionInternal
template method called inside ofperformAction(RuleActionContext)- Parameters:
context- the context- Returns:
- true if the action was performed successfully, otherwise false
-
postProcessAction
-
shouldPerformAction
-
trackActionExecution
-
checkAndGetRuleContext
Checks that the givenruleContextis of typeKnowledgeHelper(i.e. drools-specific)- Parameters:
context- the RuleActionContext instance- Returns:
- the
KnowledgeHelper
-
validateRule
Validates that the required meta-data is available. Validation can be disabled by setting the propertydroolsruleengineservices.validate.droolsrule.rulecodeto false.- Parameters:
context- instance ofRuleActionContext
-
getRuleCode
Returns the rule's rule code meta data.- Parameters:
context- the context- Returns:
- the rule's rule code (or null, if none is found)
-
getRuleGroupCode
Returns the rule's rule group code meta data.- Parameters:
context- the context- Returns:
- the rule's rule code (or null, if none is found)
-
isRuleGroupExclusive
-
getMetaDataFromRule
Returns the rule's meta-data for the given key (ornull). CallstoString()on the meta-data object.- Parameters:
context- the RuleActionContext instancekey- the key of the meta-data- Returns:
- the string representation of the meta-data (or null)
-
getMetaDataFromRule
-
setRAOMetaData
-
addMetadataToRao
-
getRuntimeTracker
-
validateSelectionStrategy
protected void validateSelectionStrategy(Collection<EntriesSelectionStrategyRPD> strategies, RuleActionContext context) ValidatesentriesSelectionStrategyRPDschecking if the collection is not empty, if orderEntries list of each entry of entriesSelectionStrategyRPDs is not empty and all the orderEntries are from the same Order.- Parameters:
strategies- collection ofEntriesSelectionStrategyRPDto check.context- the RuleActionContext instance
-
splitEntriesSelectionStrategies
protected void splitEntriesSelectionStrategies(List<EntriesSelectionStrategyRPD> entriesSelectionStrategyRPDs, List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForAction, List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForTriggering) -
mergeDiscounts
protected boolean mergeDiscounts(RuleActionContext context, DiscountRAO discountRao, OrderEntryRAO entry) -
validateCurrencyIsoCode
-
extractAmountForCurrency
protected Optional<BigDecimal> extractAmountForCurrency(RuleActionContext context, Object currencyAmount) -
getBeanName
-
setBeanName
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
setConfigurationService
-
getConfigurationService
-
setRuleEngineCalculationService
public void setRuleEngineCalculationService(RuleEngineCalculationService ruleEngineCalculationService) -
getRuleEngineCalculationService
-
getCurrencyUtils
-
setCurrencyUtils
-
getActionSupplementStrategies
-
setActionSupplementStrategies
public void setActionSupplementStrategies(List<ActionSupplementStrategy> actionSupplementStrategies) -
getRaoUtils
-
setRaoUtils
-
getConsumptionSupport
-
setConsumptionSupport
-
getRaoLookupService
-
setRaoLookupService
-
getPriceAdjustmentStrategy
-
setPriceAdjustmentStrategy
public void setPriceAdjustmentStrategy(PriceAdjustmentStrategy<OrderEntryRAO> priceAdjustmentStrategy)
-