001 /* 002 * Copyright 2011 The Kuali Foundation. 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.kfs.module.bc.document.dataaccess.impl; 017 018 import org.kuali.kfs.module.bc.document.dataaccess.ReportDumpDao; 019 020 /** 021 * JCBC implementation of ReportDumpDao 022 * 023 * @see org.kuali.kfs.module.bc.document.dataaccess.ReportDumpDao 024 */ 025 public class ReportDumpDaoJdbc extends BudgetConstructionDaoJdbcBase implements ReportDumpDao { 026 private static String updateAccountDump = new String(); 027 028 public ReportDumpDaoJdbc() { 029 super(); 030 031 // SQL to update account dump table from control list and sub-fund selections 032 StringBuilder sqlText = new StringBuilder(500); 033 sqlText.append("INSERT INTO LD_BCN_ACCT_DUMP_T\n"); 034 sqlText.append("SELECT ?, ctrl.univ_fiscal_yr, ctrl.fin_coa_cd, ctrl.account_nbr, ctrl.sub_acct_nbr, ctrl.ver_nbr \n"); 035 sqlText.append("FROM LD_BCN_CTRL_LIST_T ctrl, LD_BCN_SUBFUND_PICK_T pick \n"); 036 sqlText.append("WHERE ctrl.person_unvl_id = ? \n"); 037 sqlText.append("AND pick.person_unvl_id = ctrl.person_unvl_id \n"); 038 sqlText.append("AND pick.sub_fund_grp_cd = ctrl.sel_sub_fund_grp \n"); 039 sqlText.append("AND pick.report_flag > 0 \n"); 040 041 updateAccountDump = sqlText.toString(); 042 sqlText.delete(0, sqlText.length()); 043 } 044 045 /** 046 * @see org.kuali.kfs.module.bc.document.dataaccess.ReportDumpDao#cleanAccountDump(java.lang.String) 047 */ 048 public void cleanAccountDump(String principalName) { 049 // clear out previous account dump data for user 050 clearTempTableByUnvlId("LD_BCN_ACCT_DUMP_T", "PERSON_UNVL_ID", principalName); 051 } 052 053 /** 054 * @see org.kuali.kfs.module.bc.document.dataaccess.ReportDumpDao#updateAccountDump(java.lang.String) 055 */ 056 public void updateAccountDump(String principalId) { 057 cleanAccountDump(principalId); 058 059 // rebuild account dump table 060 getSimpleJdbcTemplate().update(updateAccountDump, principalId, principalId); 061 } 062 063 } 064