Class AbstractRuleExecutableSupport

    • Constructor Detail

      • AbstractRuleExecutableSupport

        public AbstractRuleExecutableSupport()
    • Method Detail

      • performAction

        public void performAction​(RuleActionContext context)
        Description copied from interface: RAOAction
        perform action on RAO objects
        Specified by:
        performAction in interface RAOAction
        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 of performAction(RuleActionContext)
        Parameters:
        context - the context
        Returns:
        true if the action was performed successfully, otherwise false
      • trackActionExecution

        protected void trackActionExecution​(RuleActionContext context)
      • checkAndGetRuleContext

        protected org.drools.core.spi.KnowledgeHelper checkAndGetRuleContext​(RuleActionContext context)
        Checks that the given ruleContext is of type KnowledgeHelper (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 property droolsruleengineservices.validate.droolsrule.rulecode to false.
        Parameters:
        context - instance of RuleActionContext
      • 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 (or null). Calls toString() on the meta-data object.
        Parameters:
        context - the RuleActionContext instance
        key - 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 the RuleAndRuleGroupExecutionTracker and it's agenda filter are used now
        Parameters:
        context - instance of RuleActionContext
        Returns:
        true if the execution is allowed
      • getMetaDataFromRule

        protected java.util.Map<java.lang.String,​java.lang.String> getMetaDataFromRule​(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 code
        context - 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 the RuleAndRuleGroupExecutionTracker and it's agenda filter are used now
        retrieves the RuleConfigurationRRD for the given ruleCode from the given context.
        Parameters:
        ruleCode - the rule code
        context - the drools rule context
        Returns:
        the RuleConfigurationRRD or null if none (or more than one) are found
      • getRuleConfigurationRRDFilter

        protected java.util.function.Predicate<RuleConfigurationRRD> getRuleConfigurationRRDFilter​(java.lang.String ruleCode)
      • validateSelectionStrategy

        protected void validateSelectionStrategy​(java.util.Collection<EntriesSelectionStrategyRPD> strategies,
                                                 RuleActionContext context)
        Validates entriesSelectionStrategyRPDs checking 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 of EntriesSelectionStrategyRPD to check.
        context - the RuleActionContext instance
      • 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:
        setBeanName in interface org.springframework.beans.factory.BeanNameAware
      • setConfigurationService

        public void setConfigurationService​(ConfigurationService configurationService)
      • setRuleEngineCalculationService

        public void setRuleEngineCalculationService​(RuleEngineCalculationService ruleEngineCalculationService)
      • setCurrencyUtils

        public void setCurrencyUtils​(CurrencyUtils currencyUtils)
      • setActionSupplementStrategies

        public void setActionSupplementStrategies​(java.util.List<ActionSupplementStrategy> actionSupplementStrategies)
      • getRaoUtils

        protected RaoUtils getRaoUtils()
      • setRaoUtils

        public void setRaoUtils​(RaoUtils raoUtils)
      • setConsumptionSupport

        public void setConsumptionSupport​(RAOConsumptionSupport consumptionSupport)
      • setRaoLookupService

        public void setRaoLookupService​(RAOLookupService raoLookupService)
      • 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)