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,ProductConfigAbstractRAOAction,RuleAddCouponRAOAction,RuleChangeDeliveryModeRAOAction,RuleHaltRAOAction,RuleOrderEntryFixedDiscountRAOAction,RuleOrderEntryFixedPriceRAOAction,RuleOrderEntryPercentageDiscountRAOAction,RuleOrderFixedDiscountRAOAction,RuleOrderPercentageDiscountRAOAction,RuleTriggerMessageRAOAction
public class AbstractRuleExecutableSupport extends java.lang.Object implements org.springframework.beans.factory.BeanNameAware, RAOAction
-
-
Constructor Summary
Constructors Constructor Description AbstractRuleExecutableSupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMetadataToRao(AbstractRuleActionRAO rao, RuleActionContext context)protected org.drools.core.spi.KnowledgeHelpercheckAndGetRuleContext(RuleActionContext context)Checks that the givenruleContextis of typeKnowledgeHelper(i.e.protected java.util.Optional<java.math.BigDecimal>extractAmountForCurrency(RuleActionContext context, java.lang.Object currencyAmount)protected java.util.List<ActionSupplementStrategy>getActionSupplementStrategies()java.lang.StringgetBeanName()protected ConfigurationServicegetConfigurationService()protected RAOConsumptionSupportgetConsumptionSupport()protected CurrencyUtilsgetCurrencyUtils()protected java.util.Map<java.lang.String,java.lang.String>getMetaDataFromRule(RuleActionContext context)protected java.lang.StringgetMetaDataFromRule(RuleActionContext context, java.lang.String key)Returns the rule's meta-data for the given key (ornull).protected PriceAdjustmentStrategy<OrderEntryRAO>getPriceAdjustmentStrategy()protected RAOLookupServicegetRaoLookupService()protected RaoUtilsgetRaoUtils()protected java.lang.StringgetRuleCode(RuleActionContext context)Returns the rule's rule code meta data.protected RuleEngineCalculationServicegetRuleEngineCalculationService()protected java.lang.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(java.util.List<ActionSupplementStrategy> actionSupplementStrategies)voidsetBeanName(java.lang.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(java.util.List<EntriesSelectionStrategyRPD> entriesSelectionStrategyRPDs, java.util.List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForAction, java.util.List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForTriggering)protected voidtrackActionExecution(RuleActionContext context)protected voidvalidateCurrencyIsoCode(boolean absolute, java.lang.String currencyIsoCode)protected voidvalidateParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)protected voidvalidateRule(RuleActionContext context)Validates that the required meta-data is available.protected voidvalidateSelectionStrategy(java.util.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.
-
-
-
Method Detail
-
performAction
public void performAction(RuleActionContext context)
Description copied from interface:RAOActionperform action on RAO objects- Specified by:
performActionin interfaceRAOAction- Parameters:
context- - instance of RuleActionContext
-
validateParameters
protected void validateParameters(java.util.Map<java.lang.String,java.lang.Object> parameters)
-
performActionInternal
protected boolean performActionInternal(RuleActionContext context)
template method called inside ofperformAction(RuleActionContext)- Parameters:
context- the context- Returns:
- true if the action was performed successfully, otherwise false
-
postProcessAction
protected void postProcessAction(AbstractRuleActionRAO actionRao, RuleActionContext context)
-
shouldPerformAction
protected boolean shouldPerformAction(AbstractRuleActionRAO actionRao, RuleActionContext context)
-
trackActionExecution
protected void trackActionExecution(RuleActionContext context)
-
checkAndGetRuleContext
protected org.drools.core.spi.KnowledgeHelper checkAndGetRuleContext(RuleActionContext context)
Checks that the givenruleContextis of typeKnowledgeHelper(i.e. drools-specific)- Parameters:
context- the RuleActionContext instance- Returns:
- the
KnowledgeHelper
-
validateRule
protected void validateRule(RuleActionContext context)
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
protected java.lang.String getRuleCode(RuleActionContext context)
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
protected java.lang.String getRuleGroupCode(RuleActionContext context)
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
protected boolean isRuleGroupExclusive(RuleActionContext context)
-
getMetaDataFromRule
protected java.lang.String getMetaDataFromRule(RuleActionContext context, java.lang.String key)
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
protected java.util.Map<java.lang.String,java.lang.String> getMetaDataFromRule(RuleActionContext context)
-
setRAOMetaData
public void setRAOMetaData(RuleActionContext context, AbstractRuleActionRAO... raos)
-
addMetadataToRao
protected void addMetadataToRao(AbstractRuleActionRAO rao, RuleActionContext context)
-
getRuntimeTracker
protected RuleAndRuleGroupExecutionTracker getRuntimeTracker(RuleActionContext context)
-
validateSelectionStrategy
protected void validateSelectionStrategy(java.util.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(java.util.List<EntriesSelectionStrategyRPD> entriesSelectionStrategyRPDs, java.util.List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForAction, java.util.List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForTriggering)
-
mergeDiscounts
protected boolean mergeDiscounts(RuleActionContext context, DiscountRAO discountRao, OrderEntryRAO entry)
-
validateCurrencyIsoCode
protected void validateCurrencyIsoCode(boolean absolute, java.lang.String currencyIsoCode)
-
extractAmountForCurrency
protected java.util.Optional<java.math.BigDecimal> extractAmountForCurrency(RuleActionContext context, java.lang.Object currencyAmount)
-
getBeanName
public java.lang.String getBeanName()
-
setBeanName
public void setBeanName(java.lang.String beanName)
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
setConfigurationService
public void setConfigurationService(ConfigurationService configurationService)
-
getConfigurationService
protected ConfigurationService getConfigurationService()
-
setRuleEngineCalculationService
public void setRuleEngineCalculationService(RuleEngineCalculationService ruleEngineCalculationService)
-
getRuleEngineCalculationService
protected RuleEngineCalculationService getRuleEngineCalculationService()
-
getCurrencyUtils
protected CurrencyUtils getCurrencyUtils()
-
setCurrencyUtils
public void setCurrencyUtils(CurrencyUtils currencyUtils)
-
getActionSupplementStrategies
protected java.util.List<ActionSupplementStrategy> getActionSupplementStrategies()
-
setActionSupplementStrategies
public void setActionSupplementStrategies(java.util.List<ActionSupplementStrategy> actionSupplementStrategies)
-
getRaoUtils
protected RaoUtils getRaoUtils()
-
setRaoUtils
public void setRaoUtils(RaoUtils raoUtils)
-
getConsumptionSupport
protected RAOConsumptionSupport getConsumptionSupport()
-
setConsumptionSupport
public void setConsumptionSupport(RAOConsumptionSupport consumptionSupport)
-
getRaoLookupService
protected RAOLookupService getRaoLookupService()
-
setRaoLookupService
public void setRaoLookupService(RAOLookupService raoLookupService)
-
getPriceAdjustmentStrategy
protected PriceAdjustmentStrategy<OrderEntryRAO> getPriceAdjustmentStrategy()
-
setPriceAdjustmentStrategy
public void setPriceAdjustmentStrategy(PriceAdjustmentStrategy<OrderEntryRAO> priceAdjustmentStrategy)
-
-