Class DefaultEngineRuleDao
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.dao.AbstractItemDao
-
- de.hybris.platform.ruleengine.dao.impl.DefaultEngineRuleDao
-
- All Implemented Interfaces:
EngineRuleDao
,Dao
public class DefaultEngineRuleDao extends AbstractItemDao implements EngineRuleDao
The default implementation of the Engine Rule Dao.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
FROM_ALL_WITH_MODULE_NAME
protected static java.lang.String
GET_ALL_AVAILABLE_KIE_MODULES
protected static java.lang.String
GET_ALL_RULES_FOR_MODULE_QUERY
protected static java.lang.String
GET_ALL_RULES_FOR_VERSION
protected static java.lang.String
GET_ALL_RULES_QUERY
protected static java.lang.String
GET_MAX_VERSION_FOR_CODE
protected static java.lang.String
GET_MAX_VERSION_WITH_MODULE
protected static java.lang.String
GET_RULE_BY_CODE_AND_MODULE
protected static java.lang.String
GET_RULE_BY_UUID
protected static java.lang.String
GET_RULES_BY_CODE
protected static java.lang.String
GET_RULES_BY_MULTIPLE_UUID
protected static java.lang.String
MODULE_NAME
protected static java.lang.String
RULES_MODULE
-
Fields inherited from class de.hybris.platform.servicelayer.internal.dao.AbstractItemDao
flexibleSearchService, modelService
-
-
Constructor Summary
Constructors Constructor Description DefaultEngineRuleDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<AbstractRuleEngineRuleModel>
findRulesByCode(java.lang.String code)
Finds AbstractRuleEngineRuleModels by their common code.AbstractRuleEngineRuleModel
getActiveRuleByCodeAndMaxVersion(java.lang.String code, java.lang.String moduleName, long version)
Finds activeAbstractRuleEngineRuleModel
by its code and maximum version.java.util.List<AbstractRuleEngineRuleModel>
getActiveRules(AbstractRulesModuleModel ruleModule)
Finds all currently active AbstractRuleEngineRuleModels for a given rule module.java.util.List<AbstractRuleEngineRuleModel>
getActiveRules(java.lang.String moduleName)
Finds all currently activeAbstractRuleEngineRuleModel
for a given rules module.<T extends AbstractRuleEngineRuleModel>
java.util.List<T>getActiveRulesForVersion(java.lang.String moduleName, long version)
Finds currently active rules for the rule module and a given version of knowledge basejava.lang.Long
getCurrentRulesSnapshotVersion(AbstractRulesModuleModel ruleModule)
Returns the current rules snapshot version number for a given moduleprotected java.util.Date
getRoundedTimestamp()
AbstractRuleEngineRuleModel
getRuleByCode(java.lang.String code, java.lang.String moduleName)
Finds AbstractRuleEngineRuleModel by its code and module.AbstractRuleEngineRuleModel
getRuleByCodeAndMaxVersion(java.lang.String code, java.lang.String moduleName, long version)
Finds AbstractRuleEngineRuleModel by its code and maximum version.AbstractRuleEngineRuleModel
getRuleByUuid(java.lang.String uuid)
retrieve the instance of < T extendsAbstractRuleEngineRuleModel
> by UUID<T extends AbstractRuleEngineRuleModel>
java.util.Collection<T>getRulesByUuids(java.util.Collection<java.lang.String> ruleUuids)
<T extends AbstractRuleEngineRuleModel>
java.util.List<T>getRulesForVersion(java.lang.String moduleName, long version)
Finds all rules for the rule module and a given version of knowledge baseprotected <T extends AbstractRuleEngineRuleModel>
java.util.List<T>getRulesForVersion(java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> queryParams, long version)
protected AbstractRulesModuleModel
getRulesModuleIfOneAvailable()
java.lang.Long
getRuleVersion(java.lang.String code, java.lang.String moduleName)
Return the last version of a rule with a given code and given moduleprotected TimeService
getTimeService()
protected AbstractRuleEngineRuleModel
getWithMaximumVersion(FlexibleSearchQuery query, long version)
void
setTimeService(TimeService timeService)
-
Methods inherited from class de.hybris.platform.servicelayer.internal.dao.AbstractItemDao
getAllSources, getFlexibleSearchService, getModelService, getSource, load, loadAll, search, search, searchUnique, setFlexibleSearchService, setModelService
-
-
-
-
Field Detail
-
MODULE_NAME
protected static final java.lang.String MODULE_NAME
- See Also:
- Constant Field Values
-
RULES_MODULE
protected static final java.lang.String RULES_MODULE
- See Also:
- Constant Field Values
-
FROM_ALL_WITH_MODULE_NAME
protected static final java.lang.String FROM_ALL_WITH_MODULE_NAME
- See Also:
- Constant Field Values
-
GET_ALL_RULES_QUERY
protected static final java.lang.String GET_ALL_RULES_QUERY
- See Also:
- Constant Field Values
-
GET_ALL_RULES_FOR_MODULE_QUERY
protected static final java.lang.String GET_ALL_RULES_FOR_MODULE_QUERY
- See Also:
- Constant Field Values
-
GET_RULE_BY_UUID
protected static final java.lang.String GET_RULE_BY_UUID
- See Also:
- Constant Field Values
-
GET_RULES_BY_MULTIPLE_UUID
protected static final java.lang.String GET_RULES_BY_MULTIPLE_UUID
- See Also:
- Constant Field Values
-
GET_RULES_BY_CODE
protected static final java.lang.String GET_RULES_BY_CODE
- See Also:
- Constant Field Values
-
GET_RULE_BY_CODE_AND_MODULE
protected static final java.lang.String GET_RULE_BY_CODE_AND_MODULE
- See Also:
- Constant Field Values
-
GET_MAX_VERSION_FOR_CODE
protected static final java.lang.String GET_MAX_VERSION_FOR_CODE
- See Also:
- Constant Field Values
-
GET_MAX_VERSION_WITH_MODULE
protected static final java.lang.String GET_MAX_VERSION_WITH_MODULE
- See Also:
- Constant Field Values
-
GET_ALL_RULES_FOR_VERSION
protected static final java.lang.String GET_ALL_RULES_FOR_VERSION
- See Also:
- Constant Field Values
-
GET_ALL_AVAILABLE_KIE_MODULES
protected static final java.lang.String GET_ALL_AVAILABLE_KIE_MODULES
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRuleByUuid
public AbstractRuleEngineRuleModel getRuleByUuid(java.lang.String uuid)
Description copied from interface:EngineRuleDao
retrieve the instance of < T extendsAbstractRuleEngineRuleModel
> by UUID- Specified by:
getRuleByUuid
in interfaceEngineRuleDao
- Parameters:
uuid
- the rule uuid- Returns:
- AbstractRuleEngineRuleModel by its uuid. Finds AbstractRuleEngineRuleModel by its uuid.
-
getRulesByUuids
public <T extends AbstractRuleEngineRuleModel> java.util.Collection<T> getRulesByUuids(java.util.Collection<java.lang.String> ruleUuids)
- Specified by:
getRulesByUuids
in interfaceEngineRuleDao
- Type Parameters:
T
- type of the expected engine rule instance- Parameters:
ruleUuids
- a collection of UUIDs to get the rules for- Returns:
- a Collection if rule models
-
findRulesByCode
public java.util.List<AbstractRuleEngineRuleModel> findRulesByCode(java.lang.String code)
Description copied from interface:EngineRuleDao
Finds AbstractRuleEngineRuleModels by their common code.- Specified by:
findRulesByCode
in interfaceEngineRuleDao
- Parameters:
code
- the rule code- Returns:
- list of AbstractRuleEngineRuleModel by its code.
-
getRuleByCode
public AbstractRuleEngineRuleModel getRuleByCode(java.lang.String code, java.lang.String moduleName)
Description copied from interface:EngineRuleDao
Finds AbstractRuleEngineRuleModel by its code and module.- Specified by:
getRuleByCode
in interfaceEngineRuleDao
- Parameters:
code
- the rule codemoduleName
- name of the module- Returns:
- AbstractRuleEngineRuleModel by its code.
-
getRuleByCodeAndMaxVersion
public AbstractRuleEngineRuleModel getRuleByCodeAndMaxVersion(java.lang.String code, java.lang.String moduleName, long version)
Description copied from interface:EngineRuleDao
Finds AbstractRuleEngineRuleModel by its code and maximum version.- Specified by:
getRuleByCodeAndMaxVersion
in interfaceEngineRuleDao
- Parameters:
code
- the rule codemoduleName
- the name of the rules moduleversion
- the maximum version of the rule- Returns:
- AbstractRuleEngineRuleModel by its code and maximum version.
-
getActiveRuleByCodeAndMaxVersion
public AbstractRuleEngineRuleModel getActiveRuleByCodeAndMaxVersion(java.lang.String code, java.lang.String moduleName, long version)
Description copied from interface:EngineRuleDao
Finds activeAbstractRuleEngineRuleModel
by its code and maximum version.- Specified by:
getActiveRuleByCodeAndMaxVersion
in interfaceEngineRuleDao
- Parameters:
code
- the rule codemoduleName
- the rules module nameversion
- the maximum version of the rule- Returns:
- AbstractRuleEngineRuleModel with active=true by its code and maximum version.
-
getActiveRules
public java.util.List<AbstractRuleEngineRuleModel> getActiveRules(java.lang.String moduleName)
Description copied from interface:EngineRuleDao
Finds all currently activeAbstractRuleEngineRuleModel
for a given rules module.- Specified by:
getActiveRules
in interfaceEngineRuleDao
- Parameters:
moduleName
- the name of the rules module- Returns:
- list of currently active AbstractRuleEngineRuleModel
-
getActiveRules
public java.util.List<AbstractRuleEngineRuleModel> getActiveRules(AbstractRulesModuleModel ruleModule)
Description copied from interface:EngineRuleDao
Finds all currently active AbstractRuleEngineRuleModels for a given rule module.- Specified by:
getActiveRules
in interfaceEngineRuleDao
- Parameters:
ruleModule
- the rule module- Returns:
- list of currently active AbstractRuleEngineRuleModel
-
getCurrentRulesSnapshotVersion
public java.lang.Long getCurrentRulesSnapshotVersion(AbstractRulesModuleModel ruleModule)
Description copied from interface:EngineRuleDao
Returns the current rules snapshot version number for a given module- Specified by:
getCurrentRulesSnapshotVersion
in interfaceEngineRuleDao
- Parameters:
ruleModule
- the rule module- Returns:
- maximum version number
-
getRuleVersion
public java.lang.Long getRuleVersion(java.lang.String code, java.lang.String moduleName)
Description copied from interface:EngineRuleDao
Return the last version of a rule with a given code and given module- Specified by:
getRuleVersion
in interfaceEngineRuleDao
- Parameters:
code
- the Rule codemoduleName
- the rules module name- Returns:
- last version number of a rule. Null if not found
-
getRulesForVersion
public <T extends AbstractRuleEngineRuleModel> java.util.List<T> getRulesForVersion(java.lang.String moduleName, long version)
Description copied from interface:EngineRuleDao
Finds all rules for the rule module and a given version of knowledge base- Specified by:
getRulesForVersion
in interfaceEngineRuleDao
- Parameters:
moduleName
- the rules module nameversion
- the KieBase version- Returns:
- list of rules, valid for a given KieBase version
-
getActiveRulesForVersion
public <T extends AbstractRuleEngineRuleModel> java.util.List<T> getActiveRulesForVersion(java.lang.String moduleName, long version)
Description copied from interface:EngineRuleDao
Finds currently active rules for the rule module and a given version of knowledge base- Specified by:
getActiveRulesForVersion
in interfaceEngineRuleDao
- Parameters:
moduleName
- the rules module nameversion
- the KieBase version- Returns:
- list of rules, valid for a given KieBase version
-
getRulesForVersion
protected <T extends AbstractRuleEngineRuleModel> java.util.List<T> getRulesForVersion(java.lang.String query, java.util.Map<java.lang.String,java.lang.Object> queryParams, long version)
-
getWithMaximumVersion
protected AbstractRuleEngineRuleModel getWithMaximumVersion(FlexibleSearchQuery query, long version)
-
getRoundedTimestamp
protected java.util.Date getRoundedTimestamp()
- Returns:
- the current time, but with seconds set to zero (for FlexibleSearchQuery caching benefits to the minute).
-
getRulesModuleIfOneAvailable
protected AbstractRulesModuleModel getRulesModuleIfOneAvailable()
-
getTimeService
protected TimeService getTimeService()
-
setTimeService
public void setTimeService(TimeService timeService)
-
-