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.coa.service.impl; 017 018 019 import org.apache.log4j.Logger; 020 import org.kuali.kfs.coa.businessobject.PriorYearAccount; 021 import org.kuali.kfs.coa.dataaccess.PriorYearAccountDao; 022 import org.kuali.kfs.coa.dataaccess.PriorYearAccountDaoJdbc; 023 import org.kuali.kfs.coa.dataaccess.impl.PriorYearAccountDaoJdbcImpl; 024 import org.kuali.kfs.coa.service.PriorYearAccountService; 025 import org.springframework.transaction.annotation.Transactional; 026 027 /** 028 * This class implements the PriorYearAccountService interface. 029 */ 030 @Transactional 031 public class PriorYearAccountServiceImpl implements PriorYearAccountService { 032 private static final Logger LOG = Logger.getLogger(PriorYearAccountServiceImpl.class); 033 034 private PriorYearAccountDao priorYearAccountDao; 035 private PriorYearAccountDaoJdbc priorYearAccountDaoJdbc; 036 037 public PriorYearAccountServiceImpl() { 038 super(); 039 } 040 041 /** 042 * 043 * @see org.kuali.kfs.coa.service.PriorYearAccountService#getByPrimaryKey(java.lang.String, java.lang.String) 044 */ 045 public PriorYearAccount getByPrimaryKey(String chartCode, String accountNumber) { 046 return priorYearAccountDao.getByPrimaryId(chartCode, accountNumber); 047 } 048 049 /** 050 * @see org.kuali.kfs.coa.service.PriorYearAccountService#populatePriorYearAccountsFromCurrent() 051 */ 052 public void populatePriorYearAccountsFromCurrent() { 053 054 int purgedCount = priorYearAccountDaoJdbc.purgePriorYearAccounts(); 055 if (LOG.isInfoEnabled()) { 056 LOG.info("number of prior year accounts purged : " + purgedCount); 057 } 058 059 int copiedCount = priorYearAccountDaoJdbc.copyCurrentAccountsToPriorYearTable(); 060 if (LOG.isInfoEnabled()) { 061 LOG.info("number of current year accounts copied to prior year : " + copiedCount); 062 } 063 } 064 065 066 /** 067 * This method sets the local dao variable to the value provided. 068 * 069 * @param priorYearAccountDao The priorYearAccountDao to set. 070 */ 071 public void setPriorYearAccountDao(PriorYearAccountDao priorYearAccountDao) { 072 this.priorYearAccountDao = priorYearAccountDao; 073 } 074 075 /** 076 * This method sets the local dao jdbc variable to the value provided. 077 * 078 * @param priorYearAccountDaoJdbc The priorYearAccountDaoJdbc to set. 079 */ 080 public void setPriorYearAccountDaoJdbc(PriorYearAccountDaoJdbcImpl priorYearAccountDaoJdbc) { 081 this.priorYearAccountDaoJdbc = priorYearAccountDaoJdbc; 082 } 083 }