Class DefaultRuleDao
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.dao.AbstractItemDao
-
- de.hybris.platform.ruleengineservices.rule.dao.impl.DefaultRuleDao
-
public class DefaultRuleDao extends AbstractItemDao implements RuleDao
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringGET_ALL_ACTIVE_RULES_QUERYprotected static java.lang.StringGET_ALL_NOT_ARCHIVED_RULES_QUERYDeprecated, for removal: This API element is subject to removal in a future version.since 1811protected static java.lang.StringGET_ALL_RULES_QUERYprotected static java.lang.StringGET_ENGINE_RULE_TYPE_FOR_RULE_TYPEprotected static java.lang.StringGET_MAX_VERSION_FOR_CODEprotected static java.lang.StringGET_RULE_BY_CODEprotected static java.lang.StringGET_RULE_BY_CODE_STATUSprotected static java.lang.StringGET_RULE_BY_CODE_STATUSESprotected static java.lang.StringGET_RULE_BY_CODE_VERSIONprotected static java.lang.StringGET_RULE_BY_STATUS_AND_VERSIONprotected static java.lang.StringGET_RULE_BY_STATUSES-
Fields inherited from class de.hybris.platform.servicelayer.internal.dao.AbstractItemDao
flexibleSearchService, modelService
-
-
Constructor Summary
Constructors Constructor Description DefaultRuleDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.lang.StringBuildercreateSelectStatement(java.lang.String typecode)protected <T extends AbstractRuleModel>
java.util.List<T>filterByLastVersion(java.util.List<T> rulesWithVersion)<T extends AbstractRuleModel>
java.util.List<T>findAllActiveRules()Finds all activeAbstractRuleModels<T extends AbstractRuleModel>
java.util.List<T>findAllActiveRulesByType(java.lang.Class<T> type)Finds all active rules by a specified type<T extends AbstractRuleModel>
java.util.List<T>findAllRules()Finds all rules with latest version<T extends AbstractRuleModel>
java.util.List<T>findAllRulesByType(java.lang.Class<T> type)Finds all rules by a specified type<T extends AbstractRuleModel>
java.util.List<T>findAllRulesWithStatuses(RuleStatus... ruleStatuses)Return all rule versions with one of the statuses listed in ruleStatuses param<T extends AbstractRuleModel>
java.util.List<T>findAllRuleVersionsByCode(java.lang.String code)Finds all versions ofAbstractRuleModelby code.<T extends AbstractRuleModel>
java.util.List<T>findAllRuleVersionsByCodeAndStatus(java.lang.String code, RuleStatus ruleStatus)Return all rule versions with a given code and status<T extends AbstractRuleModel>
java.util.List<T>findAllRuleVersionsByCodeAndStatuses(java.lang.String code, RuleStatus... ruleStatuses)Return all rule versions with a given code and one of the statuses listed in ruleStatuses param.<T extends AbstractRuleModel>
java.util.List<T>findAllToBePublishedRules()Deprecated, for removal: This API element is subject to removal in a future version.since 1811<T extends AbstractRuleModel>
java.util.List<T>findAllToBePublishedRulesByType(java.lang.Class<T> type)Deprecated, for removal: This API element is subject to removal in a future version.since 1811<T extends AbstractRuleModel>
java.util.List<T>findByVersionAndStatuses(java.lang.Long version, RuleStatus... ruleStatuses)Return all rules within statuses and versionRuleTypefindEngineRuleTypeByRuleType(java.lang.Class<?> type)Finds engine rule type for given rule type.<T extends AbstractRuleModel>
TfindRuleByCode(java.lang.String code)Finds the latest version ofAbstractRuleModelby code.java.util.Optional<AbstractRuleModel>findRuleByCodeAndStatus(java.lang.String code, RuleStatus ruleStatus)Return a rule, having latest version with the status<T extends AbstractRuleModel>
TfindRuleByCodeAndType(java.lang.String code, java.lang.Class<T> type)FindsAbstractRuleModelby code.java.util.Optional<AbstractRuleModel>findRuleByCodeAndVersion(java.lang.String code, java.lang.Long version)Return a rule with a specified versionprotected I18NServicegetI18NService()java.lang.LonggetRuleVersion(java.lang.String code)Return the last version of a rule with a given codeprotected TypeServicegetTypeService()voidsetI18NService(I18NService i18NService)voidsetTypeService(TypeService typeService)-
Methods inherited from class de.hybris.platform.servicelayer.internal.dao.AbstractItemDao
getAllSources, getFlexibleSearchService, getModelService, getSource, load, loadAll, search, search, searchUnique, setFlexibleSearchService, setModelService
-
-
-
-
Field Detail
-
GET_ALL_RULES_QUERY
protected static final java.lang.String GET_ALL_RULES_QUERY
- See Also:
- Constant Field Values
-
GET_ALL_ACTIVE_RULES_QUERY
protected static final java.lang.String GET_ALL_ACTIVE_RULES_QUERY
- See Also:
- Constant Field Values
-
GET_RULE_BY_CODE
protected static final java.lang.String GET_RULE_BY_CODE
- See Also:
- Constant Field Values
-
GET_ALL_NOT_ARCHIVED_RULES_QUERY
@Deprecated(since="1811", forRemoval=true) protected static final java.lang.String GET_ALL_NOT_ARCHIVED_RULES_QUERYDeprecated, for removal: This API element is subject to removal in a future version.since 1811- See Also:
- Constant Field Values
-
GET_ENGINE_RULE_TYPE_FOR_RULE_TYPE
protected static final java.lang.String GET_ENGINE_RULE_TYPE_FOR_RULE_TYPE
- 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_RULE_BY_CODE_STATUS
protected static final java.lang.String GET_RULE_BY_CODE_STATUS
- See Also:
- Constant Field Values
-
GET_RULE_BY_CODE_STATUSES
protected static final java.lang.String GET_RULE_BY_CODE_STATUSES
- See Also:
- Constant Field Values
-
GET_RULE_BY_STATUSES
protected static final java.lang.String GET_RULE_BY_STATUSES
- See Also:
- Constant Field Values
-
GET_RULE_BY_CODE_VERSION
protected static final java.lang.String GET_RULE_BY_CODE_VERSION
- See Also:
- Constant Field Values
-
GET_RULE_BY_STATUS_AND_VERSION
protected static final java.lang.String GET_RULE_BY_STATUS_AND_VERSION
- See Also:
- Constant Field Values
-
-
Method Detail
-
findAllRules
public <T extends AbstractRuleModel> java.util.List<T> findAllRules()
Description copied from interface:RuleDaoFinds all rules with latest version- Specified by:
findAllRulesin interfaceRuleDao- Returns:
- List of
AbstractRuleModels
-
findAllRulesByType
public <T extends AbstractRuleModel> java.util.List<T> findAllRulesByType(java.lang.Class<T> type)
Description copied from interface:RuleDaoFinds all rules by a specified type- Specified by:
findAllRulesByTypein interfaceRuleDao- Parameters:
type- - type of the rule. Must extendAbstractRuleModel- Returns:
- list of all rules of specified type
-
findAllActiveRules
public <T extends AbstractRuleModel> java.util.List<T> findAllActiveRules()
Description copied from interface:RuleDaoFinds all activeAbstractRuleModels- Specified by:
findAllActiveRulesin interfaceRuleDao- Returns:
- List of
AbstractRuleModels
-
findAllActiveRulesByType
public <T extends AbstractRuleModel> java.util.List<T> findAllActiveRulesByType(java.lang.Class<T> type)
Description copied from interface:RuleDaoFinds all active rules by a specified type- Specified by:
findAllActiveRulesByTypein interfaceRuleDao- Parameters:
type- - type of the rule. Must extendAbstractRuleModel- Returns:
- list of all active rules of specified type
-
findAllToBePublishedRules
@Deprecated(since="1811", forRemoval=true) public <T extends AbstractRuleModel> java.util.List<T> findAllToBePublishedRules()Deprecated, for removal: This API element is subject to removal in a future version.since 1811Description copied from interface:RuleDaoFinds all rules to be publishedAbstractRuleModels- Specified by:
findAllToBePublishedRulesin interfaceRuleDao- Returns:
- List of
AbstractRuleModels
-
findAllToBePublishedRulesByType
@Deprecated(since="1811", forRemoval=true) public <T extends AbstractRuleModel> java.util.List<T> findAllToBePublishedRulesByType(java.lang.Class<T> type)Deprecated, for removal: This API element is subject to removal in a future version.since 1811Description copied from interface:RuleDaoFinds all rules to be published by a specified type- Specified by:
findAllToBePublishedRulesByTypein interfaceRuleDao- Parameters:
type- - type of the rule. Must extendAbstractRuleModel- Returns:
- list of all rules to be published of specified type
-
findRuleByCode
public <T extends AbstractRuleModel> T findRuleByCode(java.lang.String code)
Description copied from interface:RuleDaoFinds the latest version ofAbstractRuleModelby code.- Specified by:
findRuleByCodein interfaceRuleDao- Parameters:
code- - code of the rule- Returns:
- a rule, extending
AbstractRuleModelor null if not found
-
findAllRuleVersionsByCode
public <T extends AbstractRuleModel> java.util.List<T> findAllRuleVersionsByCode(java.lang.String code)
Description copied from interface:RuleDaoFinds all versions ofAbstractRuleModelby code.- Specified by:
findAllRuleVersionsByCodein interfaceRuleDao- Parameters:
code- - code of the rule- Returns:
- list of rules, extending
AbstractRuleModel
-
findRuleByCodeAndType
public <T extends AbstractRuleModel> T findRuleByCodeAndType(java.lang.String code, java.lang.Class<T> type)
Description copied from interface:RuleDaoFindsAbstractRuleModelby code.- Specified by:
findRuleByCodeAndTypein interfaceRuleDao- Parameters:
code- - code of the ruletype- - type of the rule. Must extendAbstractRuleModel- Returns:
AbstractRuleModel
-
findEngineRuleTypeByRuleType
public RuleType findEngineRuleTypeByRuleType(java.lang.Class<?> type)
Description copied from interface:RuleDaoFinds engine rule type for given rule type.- Specified by:
findEngineRuleTypeByRuleTypein interfaceRuleDao- Parameters:
type- - type of the rule.- Returns:
- RuleType of the engine rule
-
getRuleVersion
public java.lang.Long getRuleVersion(java.lang.String code)
Description copied from interface:RuleDaoReturn the last version of a rule with a given code- Specified by:
getRuleVersionin interfaceRuleDao- Parameters:
code- the Rule code- Returns:
- last version number of a rule. Null if not found
-
findRuleByCodeAndStatus
public java.util.Optional<AbstractRuleModel> findRuleByCodeAndStatus(java.lang.String code, RuleStatus ruleStatus)
Description copied from interface:RuleDaoReturn a rule, having latest version with the status- Specified by:
findRuleByCodeAndStatusin interfaceRuleDao- Parameters:
code- the Rule coderuleStatus- the rule status- Returns:
- an optional of the rule with latest version with the specified status
-
findAllRuleVersionsByCodeAndStatus
public <T extends AbstractRuleModel> java.util.List<T> findAllRuleVersionsByCodeAndStatus(java.lang.String code, RuleStatus ruleStatus)
Description copied from interface:RuleDaoReturn all rule versions with a given code and status- Specified by:
findAllRuleVersionsByCodeAndStatusin interfaceRuleDao- Parameters:
code- the Rule coderuleStatus- the rule status- Returns:
- list of rules extending
AbstractRuleModel
-
findAllRuleVersionsByCodeAndStatuses
public <T extends AbstractRuleModel> java.util.List<T> findAllRuleVersionsByCodeAndStatuses(java.lang.String code, RuleStatus... ruleStatuses)
Description copied from interface:RuleDaoReturn all rule versions with a given code and one of the statuses listed in ruleStatuses param. If no status is provided, the method fallback toRuleDao.findAllRuleVersionsByCode(String)- Specified by:
findAllRuleVersionsByCodeAndStatusesin interfaceRuleDao- Parameters:
code- the Rule coderuleStatuses- the rule status array- Returns:
- list of rules extending
AbstractRuleModel
-
findAllRulesWithStatuses
public <T extends AbstractRuleModel> java.util.List<T> findAllRulesWithStatuses(RuleStatus... ruleStatuses)
Description copied from interface:RuleDaoReturn all rule versions with one of the statuses listed in ruleStatuses param- Specified by:
findAllRulesWithStatusesin interfaceRuleDao- Parameters:
ruleStatuses- the rule status array- Returns:
- list of rules extending
AbstractRuleModel
-
findByVersionAndStatuses
public <T extends AbstractRuleModel> java.util.List<T> findByVersionAndStatuses(java.lang.Long version, RuleStatus... ruleStatuses)
Description copied from interface:RuleDaoReturn all rules within statuses and version- Specified by:
findByVersionAndStatusesin interfaceRuleDao- Parameters:
version- the rule versionruleStatuses- the rule statuses- Returns:
- list of rules extending
AbstractRuleModel
-
findRuleByCodeAndVersion
public java.util.Optional<AbstractRuleModel> findRuleByCodeAndVersion(java.lang.String code, java.lang.Long version)
Description copied from interface:RuleDaoReturn a rule with a specified version- Specified by:
findRuleByCodeAndVersionin interfaceRuleDao- Parameters:
code- the Rule codeversion- the version number- Returns:
- an optional of the rule with code and version
-
createSelectStatement
protected java.lang.StringBuilder createSelectStatement(java.lang.String typecode)
-
filterByLastVersion
protected <T extends AbstractRuleModel> java.util.List<T> filterByLastVersion(java.util.List<T> rulesWithVersion)
-
getI18NService
protected I18NService getI18NService()
-
setI18NService
public void setI18NService(I18NService i18NService)
-
getTypeService
protected TypeService getTypeService()
-
setTypeService
public void setTypeService(TypeService typeService)
-
-