Interface RuleEngineContextFinderStrategy

All Known Implementing Classes:
DefaultRuleEngineContextFinderStrategy

public interface RuleEngineContextFinderStrategy
Strategy for retrieving rule engine contexts based on rule type
  • Method Details

    • findRuleEngineContext

      <T extends AbstractRuleEngineContextModel> Optional<T> findRuleEngineContext(RuleType ruleType)
      Finds rule engine contexts for the given rule type. The method only works in rule environments where only 1 rules module exists for the given ruleType. If there are multiple rules modules for the given ruleType it will throw an IllegalStateException exception.
      Parameters:
      ruleType - the rule type to look up rule engine contexts for
      Returns:
      an optional of unique rule engine context for the given rule type. Otherwise throw IllegalStateException
    • findRuleEngineContext

      <T extends AbstractRuleEngineContextModel, O extends AbstractOrderModel> Optional<T> findRuleEngineContext(O order, RuleType ruleType)
      Given the order, finds the rule engine context, compatible with specified rule type
      Parameters:
      order - the order, for which we need to find the rule engine context
      ruleType - filters to return only mappings which rules module is of the given rule type
      Returns:
      a rule engine context, compatible with given rule type. Empty optional if did not find any
    • findRuleEngineContext

      <T extends AbstractRuleEngineContextModel> Optional<T> findRuleEngineContext(ProductModel product, RuleType ruleType)
      Given the product, finds the rule engine context, compatible with specified rule type
      Parameters:
      product - the product, for which we need to find the rule engine context
      ruleType - filters to return only mappings which rules module is of the given rule type
      Returns:
      a rule engine context, compatible with given rule type. Empty optional if did not find any
    • getRuleEngineContextForCatalogVersions

      <T extends AbstractRuleEngineContextModel> Optional<T> getRuleEngineContextForCatalogVersions(Collection<CatalogVersionModel> catalogVersions, RuleType ruleType)
      Finds rule engine contexts for the given catalog versions and rule type. If there are multiple rules modules for the provided parameters it will throw an IllegalStateException exception.
      Parameters:
      catalogVersions - collection of catalog versions to perform look up of engine context for
      ruleType - the rule type to look up rule engine context for
      Returns:
      a rule engine context compatible with the given rule type and catalog versions