Class DefaultRuleEngineContextFinderStrategy
java.lang.Object
de.hybris.platform.ruleengine.strategies.impl.DefaultRuleEngineContextFinderStrategy
- All Implemented Interfaces:
RuleEngineContextFinderStrategy
public class DefaultRuleEngineContextFinderStrategy
extends Object
implements RuleEngineContextFinderStrategy
Default implementation for the RuleEngineContextFinderStrategy.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcatalogVersionToString(CatalogVersionModel catalogVersion) <T extends AbstractRuleEngineContextModel>
Optional<T>findRuleEngineContext(ProductModel product, RuleType ruleType) Given the product, finds the rule engine context, compatible with specified rule type<T extends AbstractRuleEngineContextModel>
Optional<T>findRuleEngineContext(RuleType ruleType) Finds rule engine contexts for the given rule type.<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 typeprotected Collection<CatalogVersionModel>protected CatalogVersionServiceprotected Collection<CatalogVersionModel>getCatalogVersionsForProducts(Collection<ProductModel> products) protected <T extends AbstractOrderModel>
Collection<ProductModel>getProductsForOrder(T order) protected RuleEngineContextDao<T extends AbstractRuleEngineContextModel>
Optional<T>getRuleEngineContextForCatalogVersions(Collection<CatalogVersionModel> catalogVersions, RuleType ruleType) Finds rule engine contexts for the given catalog versions and rule type.protected RulesModuleDaovoidsetCatalogVersionService(CatalogVersionService catalogVersionService) voidsetRuleEngineContextDao(RuleEngineContextDao ruleEngineContextDao) voidsetRuleEngineContextForCatalogVersionsFinderStrategy(RuleEngineContextForCatalogVersionsFinderStrategy ruleEngineContextForCatalogVersionsFinderStrategy) voidsetRulesModuleDao(RulesModuleDao rulesModuleDao)
-
Constructor Details
-
DefaultRuleEngineContextFinderStrategy
public DefaultRuleEngineContextFinderStrategy()
-
-
Method Details
-
findRuleEngineContext
public <T extends AbstractRuleEngineContextModel> Optional<T> findRuleEngineContext(RuleType ruleType) Description copied from interface:RuleEngineContextFinderStrategyFinds 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.- Specified by:
findRuleEngineContextin interfaceRuleEngineContextFinderStrategy- 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
public <T extends AbstractRuleEngineContextModel,O extends AbstractOrderModel> Optional<T> findRuleEngineContext(O order, RuleType ruleType) Description copied from interface:RuleEngineContextFinderStrategyGiven the order, finds the rule engine context, compatible with specified rule type- Specified by:
findRuleEngineContextin interfaceRuleEngineContextFinderStrategy- 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
public <T extends AbstractRuleEngineContextModel> Optional<T> findRuleEngineContext(ProductModel product, RuleType ruleType) Description copied from interface:RuleEngineContextFinderStrategyGiven the product, finds the rule engine context, compatible with specified rule type- Specified by:
findRuleEngineContextin interfaceRuleEngineContextFinderStrategy- 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
public <T extends AbstractRuleEngineContextModel> Optional<T> getRuleEngineContextForCatalogVersions(Collection<CatalogVersionModel> catalogVersions, RuleType ruleType) Description copied from interface:RuleEngineContextFinderStrategyFinds rule engine contexts for the given catalog versions and rule type. If there are multiple rules modules for the provided parameters it will throw anIllegalStateExceptionexception.- Specified by:
getRuleEngineContextForCatalogVersionsin interfaceRuleEngineContextFinderStrategy- 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
-
catalogVersionToString
-
getCatalogVersionsForProducts
protected Collection<CatalogVersionModel> getCatalogVersionsForProducts(Collection<ProductModel> products) -
getAvailableCatalogVersions
-
getProductsForOrder
-
getCatalogVersionService
-
setCatalogVersionService
-
getRuleEngineContextForCatalogVersionsFinderStrategy
protected RuleEngineContextForCatalogVersionsFinderStrategy getRuleEngineContextForCatalogVersionsFinderStrategy() -
setRuleEngineContextForCatalogVersionsFinderStrategy
public void setRuleEngineContextForCatalogVersionsFinderStrategy(RuleEngineContextForCatalogVersionsFinderStrategy ruleEngineContextForCatalogVersionsFinderStrategy) -
getRulesModuleDao
-
setRulesModuleDao
-
getRuleEngineContextDao
-
setRuleEngineContextDao
-