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 Deprecated Methods Modifier and Type Method Description protected voidaddMetadataToRao(AbstractRuleActionRAO rao, RuleActionContext context)protected booleanallowedByRuntimeConfiguration(RuleActionContext context)Deprecated, for removal: This API element is subject to removal in a future version.not used anymore as theRuleAndRuleGroupExecutionTrackerand it's agenda filter are used nowprotected 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.function.Predicate<RuleGroupExecutionRRD>filterByRuleGroup(RuleConfigurationRRD config)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 RuleConfigurationRRDgetRuleConfigurationRRD(java.lang.String ruleCode, RuleActionContext context)Deprecated, for removal: This API element is subject to removal in a future version.not used anymore as theRuleAndRuleGroupExecutionTrackerand it's agenda filter are used nowprotected java.util.function.Predicate<RuleConfigurationRRD>getRuleConfigurationRRDFilter(java.lang.String ruleCode)protected RuleEngineCalculationServicegetRuleEngineCalculationService()protected java.lang.StringgetRuleGroupCode(RuleActionContext context)Returns the rule's rule group code meta data.protected RuleGroupExecutionRRDgetRuleGroupExecutionRRD(java.lang.String ruleGroupCode, RuleActionContext context)retrieves the RuleGroupExecutionRRD for the given ruleGroupCode from the given context.protected java.util.function.Predicate<RuleGroupExecutionRRD>getRuleGroupExecutionRRDFilter(java.lang.String ruleGroupCode)protected RuleAndRuleGroupExecutionTrackergetRuntimeTracker(RuleActionContext context)protected booleanisRuleGroupExclusive(RuleActionContext context)protected booleanisUseDeprecatedRRDs()Deprecated, for removal: This API element is subject to removal in a future version.flag is present only to enable deprecated RRD usage (backwards compatibility)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)voidsetUseDeprecatedRRDs(boolean useDeprecatedRRDs)Deprecated, for removal: This API element is subject to removal in a future version.flag is present only to enable deprecated RRD usage (backwards compatibility)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)
-
allowedByRuntimeConfiguration
@Deprecated(since="20.05", forRemoval=true) protected boolean allowedByRuntimeConfiguration(RuleActionContext context)Deprecated, for removal: This API element is subject to removal in a future version.not used anymore as theRuleAndRuleGroupExecutionTrackerand it's agenda filter are used now- Parameters:
context- instance ofRuleActionContext- Returns:
- true if the execution is allowed
-
filterByRuleGroup
protected java.util.function.Predicate<RuleGroupExecutionRRD> filterByRuleGroup(RuleConfigurationRRD config)
-
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)
-
getRuleGroupExecutionRRD
protected RuleGroupExecutionRRD getRuleGroupExecutionRRD(java.lang.String ruleGroupCode, RuleActionContext context)
retrieves the RuleGroupExecutionRRD for the given ruleGroupCode from the given context.- Parameters:
ruleGroupCode- the rule group codecontext- the drools rule context- Returns:
- the matching RuleGroupExecutionRRD or null if none can be found
-
getRuleGroupExecutionRRDFilter
protected java.util.function.Predicate<RuleGroupExecutionRRD> getRuleGroupExecutionRRDFilter(java.lang.String ruleGroupCode)
-
getRuleConfigurationRRD
@Deprecated(since="20.05", forRemoval=true) protected RuleConfigurationRRD getRuleConfigurationRRD(java.lang.String ruleCode, RuleActionContext context)Deprecated, for removal: This API element is subject to removal in a future version.not used anymore as theRuleAndRuleGroupExecutionTrackerand it's agenda filter are used nowretrieves the RuleConfigurationRRD for the given ruleCode from the given context.- Parameters:
ruleCode- the rule codecontext- the drools rule context- Returns:
- the RuleConfigurationRRD or null if none (or more than one) are found
-
getRuntimeTracker
protected RuleAndRuleGroupExecutionTracker getRuntimeTracker(RuleActionContext context)
-
getRuleConfigurationRRDFilter
protected java.util.function.Predicate<RuleConfigurationRRD> getRuleConfigurationRRDFilter(java.lang.String ruleCode)
-
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)
-
setUseDeprecatedRRDs
@Deprecated(since="20.05", forRemoval=true) public void setUseDeprecatedRRDs(boolean useDeprecatedRRDs)Deprecated, for removal: This API element is subject to removal in a future version.flag is present only to enable deprecated RRD usage (backwards compatibility)
-
isUseDeprecatedRRDs
@Deprecated(since="20.05", forRemoval=true) protected boolean isUseDeprecatedRRDs()Deprecated, for removal: This API element is subject to removal in a future version.flag is present only to enable deprecated RRD usage (backwards compatibility)
-
-