Class DefaultEngineRuleDao

    • Field Detail

      • 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
    • Constructor Detail

      • DefaultEngineRuleDao

        public DefaultEngineRuleDao()
    • Method Detail

      • getRulesByUuids

        public <T extends AbstractRuleEngineRuleModel> java.util.Collection<T> getRulesByUuids​(java.util.Collection<java.lang.String> ruleUuids)
        Specified by:
        getRulesByUuids in interface EngineRuleDao
        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 interface EngineRuleDao
        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 interface EngineRuleDao
        Parameters:
        code - the rule code
        moduleName - 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 interface EngineRuleDao
        Parameters:
        code - the rule code
        moduleName - the name of the rules module
        version - 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 active AbstractRuleEngineRuleModel by its code and maximum version.
        Specified by:
        getActiveRuleByCodeAndMaxVersion in interface EngineRuleDao
        Parameters:
        code - the rule code
        moduleName - the rules module name
        version - the maximum version of the rule
        Returns:
        AbstractRuleEngineRuleModel with active=true by its code and maximum version.
      • 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 interface EngineRuleDao
        Parameters:
        code - the Rule code
        moduleName - 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 interface EngineRuleDao
        Parameters:
        moduleName - the rules module name
        version - 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 interface EngineRuleDao
        Parameters:
        moduleName - the rules module name
        version - 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)
      • getRoundedTimestamp

        protected java.util.Date getRoundedTimestamp()
        Returns:
        the current time, but with seconds set to zero (for FlexibleSearchQuery caching benefits to the minute).
      • getTimeService

        protected TimeService getTimeService()
      • setTimeService

        public void setTimeService​(TimeService timeService)