Class DefaultRuleDao

    • 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_QUERY
        Deprecated, 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
    • Constructor Detail

      • DefaultRuleDao

        public DefaultRuleDao()
    • Method Detail

      • findAllRulesByType

        public <T extends AbstractRuleModel> java.util.List<T> findAllRulesByType​(java.lang.Class<T> type)
        Description copied from interface: RuleDao
        Finds all rules by a specified type
        Specified by:
        findAllRulesByType in interface RuleDao
        Parameters:
        type - - type of the rule. Must extend AbstractRuleModel
        Returns:
        list of all rules of specified type
      • findAllActiveRulesByType

        public <T extends AbstractRuleModel> java.util.List<T> findAllActiveRulesByType​(java.lang.Class<T> type)
        Description copied from interface: RuleDao
        Finds all active rules by a specified type
        Specified by:
        findAllActiveRulesByType in interface RuleDao
        Parameters:
        type - - type of the rule. Must extend AbstractRuleModel
        Returns:
        list of all active rules of specified type
      • 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 1811
        Description copied from interface: RuleDao
        Finds all rules to be published by a specified type
        Specified by:
        findAllToBePublishedRulesByType in interface RuleDao
        Parameters:
        type - - type of the rule. Must extend AbstractRuleModel
        Returns:
        list of all rules to be published of specified type
      • findEngineRuleTypeByRuleType

        public RuleType findEngineRuleTypeByRuleType​(java.lang.Class<?> type)
        Description copied from interface: RuleDao
        Finds engine rule type for given rule type.
        Specified by:
        findEngineRuleTypeByRuleType in interface RuleDao
        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: RuleDao
        Return the last version of a rule with a given code
        Specified by:
        getRuleVersion in interface RuleDao
        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: RuleDao
        Return a rule, having latest version with the status
        Specified by:
        findRuleByCodeAndStatus in interface RuleDao
        Parameters:
        code - the Rule code
        ruleStatus - 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: RuleDao
        Return all rule versions with a given code and status
        Specified by:
        findAllRuleVersionsByCodeAndStatus in interface RuleDao
        Parameters:
        code - the Rule code
        ruleStatus - the rule status
        Returns:
        list of rules extending AbstractRuleModel
      • findAllRulesWithStatuses

        public <T extends AbstractRuleModel> java.util.List<T> findAllRulesWithStatuses​(RuleStatus... ruleStatuses)
        Description copied from interface: RuleDao
        Return all rule versions with one of the statuses listed in ruleStatuses param
        Specified by:
        findAllRulesWithStatuses in interface RuleDao
        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: RuleDao
        Return all rules within statuses and version
        Specified by:
        findByVersionAndStatuses in interface RuleDao
        Parameters:
        version - the rule version
        ruleStatuses - 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: RuleDao
        Return a rule with a specified version
        Specified by:
        findRuleByCodeAndVersion in interface RuleDao
        Parameters:
        code - the Rule code
        version - 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)