/** * Load the list of rules specified by rule type key * * @param strRuleTypeKey The rule type key * @param ruleTypesSet The rule types set * @return The Collection of the Rules */ public List<Rule> selectRuleListByRuleTypeKey(String strRuleTypeKey, IRuleTypesSet ruleTypesSet) { List<Rule> listRules = new ArrayList<Rule>(); DAOUtil daoUtil = new DAOUtil(SQL_QUERY_SELECT_BY_RULE_TYPE_KEY); daoUtil.setString(1, strRuleTypeKey); daoUtil.executeQuery(); while (daoUtil.next()) { Rule rule = ruleTypesSet.newInstance(strRuleTypeKey); rule.setId(daoUtil.getInt(1)); rule.setRuleTypeId(strRuleTypeKey); loadAttributes(rule); listRules.add(rule); } daoUtil.free(); return listRules; }
/** * Load the data of Rule from the table * * @param nRuleId The identifier of Rule * @param ruleTypesSet The rule type set object * @return the instance of the Rule */ public Rule load(int nRuleId, IRuleTypesSet ruleTypesSet) { Rule rule = null; DAOUtil daoUtil = new DAOUtil(SQL_QUERY_SELECT); daoUtil.setInt(1, nRuleId); daoUtil.executeQuery(); if (daoUtil.next()) { String strRuleTypeId = daoUtil.getString(2); rule = ruleTypesSet.newInstance(strRuleTypeId); rule.setId(nRuleId); rule.setRuleTypeId(strRuleTypeId); loadAttributes(rule); } daoUtil.free(); return rule; }