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

public class AbstractRuleExecutableSupport extends Object implements org.springframework.beans.factory.BeanNameAware, RAOAction
  • Constructor Details

    • AbstractRuleExecutableSupport

      public AbstractRuleExecutableSupport()
  • Method Details

    • 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(Map<String,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
    • 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 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 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 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 String getMetaDataFromRule(RuleActionContext context, 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)
    • getMetaDataFromRule

      protected Map<String,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(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
    • splitEntriesSelectionStrategies

      protected void splitEntriesSelectionStrategies(List<EntriesSelectionStrategyRPD> entriesSelectionStrategyRPDs, List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForAction, List<EntriesSelectionStrategyRPD> selectionStrategyRPDsForTriggering)
    • mergeDiscounts

      protected boolean mergeDiscounts(RuleActionContext context, DiscountRAO discountRao, OrderEntryRAO entry)
    • validateCurrencyIsoCode

      protected void validateCurrencyIsoCode(boolean absolute, String currencyIsoCode)
    • extractAmountForCurrency

      protected Optional<BigDecimal> extractAmountForCurrency(RuleActionContext context, Object currencyAmount)
    • getBeanName

      public String getBeanName()
    • setBeanName

      public void setBeanName(String beanName)
      Specified by:
      setBeanName in interface org.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 List<ActionSupplementStrategy> getActionSupplementStrategies()
    • setActionSupplementStrategies

      public void setActionSupplementStrategies(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)