Class DefaultRuleEngineContextFinderStrategy
- java.lang.Object
-
- de.hybris.platform.ruleengine.strategies.impl.DefaultRuleEngineContextFinderStrategy
-
- All Implemented Interfaces:
RuleEngineContextFinderStrategy
public class DefaultRuleEngineContextFinderStrategy extends java.lang.Object implements RuleEngineContextFinderStrategy
Default implementation for the RuleEngineContextFinderStrategy.
-
-
Constructor Summary
Constructors Constructor Description DefaultRuleEngineContextFinderStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
catalogVersionToString(CatalogVersionModel catalogVersion)
<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 typeprotected java.util.Collection<CatalogVersionModel>
getAvailableCatalogVersions()
protected CatalogVersionService
getCatalogVersionService()
protected java.util.Collection<CatalogVersionModel>
getCatalogVersionsForProducts(java.util.Collection<ProductModel> products)
protected <T extends AbstractOrderModel>
java.util.Collection<ProductModel>getProductsForOrder(T order)
protected RuleEngineContextDao
getRuleEngineContextDao()
<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.protected RuleEngineContextForCatalogVersionsFinderStrategy
getRuleEngineContextForCatalogVersionsFinderStrategy()
protected RulesModuleDao
getRulesModuleDao()
void
setCatalogVersionService(CatalogVersionService catalogVersionService)
void
setRuleEngineContextDao(RuleEngineContextDao ruleEngineContextDao)
void
setRuleEngineContextForCatalogVersionsFinderStrategy(RuleEngineContextForCatalogVersionsFinderStrategy ruleEngineContextForCatalogVersionsFinderStrategy)
void
setRulesModuleDao(RulesModuleDao rulesModuleDao)
-
-
-
Method Detail
-
findRuleEngineContext
public <T extends AbstractRuleEngineContextModel> java.util.Optional<T> findRuleEngineContext(RuleType ruleType)
Description copied from interface:RuleEngineContextFinderStrategy
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.- Specified by:
findRuleEngineContext
in 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> java.util.Optional<T> findRuleEngineContext(O order, RuleType ruleType)
Description copied from interface:RuleEngineContextFinderStrategy
Given the order, finds the rule engine context, compatible with specified rule type- Specified by:
findRuleEngineContext
in 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> java.util.Optional<T> findRuleEngineContext(ProductModel product, RuleType ruleType)
Description copied from interface:RuleEngineContextFinderStrategy
Given the product, finds the rule engine context, compatible with specified rule type- Specified by:
findRuleEngineContext
in 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> java.util.Optional<T> getRuleEngineContextForCatalogVersions(java.util.Collection<CatalogVersionModel> catalogVersions, RuleType ruleType)
Description copied from interface:RuleEngineContextFinderStrategy
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.- Specified by:
getRuleEngineContextForCatalogVersions
in 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
protected java.lang.String catalogVersionToString(CatalogVersionModel catalogVersion)
-
getCatalogVersionsForProducts
protected java.util.Collection<CatalogVersionModel> getCatalogVersionsForProducts(java.util.Collection<ProductModel> products)
-
getAvailableCatalogVersions
protected java.util.Collection<CatalogVersionModel> getAvailableCatalogVersions()
-
getProductsForOrder
protected <T extends AbstractOrderModel> java.util.Collection<ProductModel> getProductsForOrder(T order)
-
getCatalogVersionService
protected CatalogVersionService getCatalogVersionService()
-
setCatalogVersionService
public void setCatalogVersionService(CatalogVersionService catalogVersionService)
-
getRuleEngineContextForCatalogVersionsFinderStrategy
protected RuleEngineContextForCatalogVersionsFinderStrategy getRuleEngineContextForCatalogVersionsFinderStrategy()
-
setRuleEngineContextForCatalogVersionsFinderStrategy
public void setRuleEngineContextForCatalogVersionsFinderStrategy(RuleEngineContextForCatalogVersionsFinderStrategy ruleEngineContextForCatalogVersionsFinderStrategy)
-
getRulesModuleDao
protected RulesModuleDao getRulesModuleDao()
-
setRulesModuleDao
public void setRulesModuleDao(RulesModuleDao rulesModuleDao)
-
getRuleEngineContextDao
protected RuleEngineContextDao getRuleEngineContextDao()
-
setRuleEngineContextDao
public void setRuleEngineContextDao(RuleEngineContextDao ruleEngineContextDao)
-
-