Interface RuleEngineContextFinderStrategy
-
- All Known Implementing Classes:
DefaultRuleEngineContextFinderStrategy
public interface RuleEngineContextFinderStrategy
Strategy for retrieving rule engine contexts based on rule type
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T extends AbstractRuleEngineContextModel>
java.util.Optional<T>findRuleEngineContext(ProductModel product, RuleType ruleType)
Given the product, finds the rule engine context, compatible with specified rule type<T extends AbstractRuleEngineContextModel>
java.util.Optional<T>findRuleEngineContext(RuleType ruleType)
Finds rule engine contexts for the given rule type.<T extends AbstractRuleEngineContextModel,O extends AbstractOrderModel>
java.util.Optional<T>findRuleEngineContext(O order, RuleType ruleType)
Given the order, finds the rule engine context, compatible with specified rule type<T extends AbstractRuleEngineContextModel>
java.util.Optional<T>getRuleEngineContextForCatalogVersions(java.util.Collection<CatalogVersionModel> catalogVersions, RuleType ruleType)
Finds rule engine contexts for the given catalog versions and rule type.
-
-
-
Method Detail
-
findRuleEngineContext
<T extends AbstractRuleEngineContextModel> java.util.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> java.util.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 contextruleType
- 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> java.util.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 contextruleType
- 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> java.util.Optional<T> getRuleEngineContextForCatalogVersions(java.util.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 anIllegalStateException
exception.- Parameters:
catalogVersions
- collection of catalog versions to perform look up of engine context forruleType
- the rule type to look up rule engine context for- Returns:
- a rule engine context compatible with the given rule type and catalog versions
-
-