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.batch.service.impl;
017    
018    import org.apache.log4j.Logger;
019    import org.kuali.kfs.module.bc.batch.dataaccess.GeneralLedgerBudgetLoadDao;
020    import org.kuali.kfs.module.bc.batch.service.GLBudgetLoadService;
021    import org.kuali.kfs.module.bc.batch.service.GenesisService;
022    import org.springframework.transaction.annotation.Transactional;
023    
024    @Transactional
025    public class GLBudgetLoadServiceImpl implements GLBudgetLoadService {
026    
027        private static Logger LOG = org.apache.log4j.Logger.getLogger(GLBudgetLoadServiceImpl.class);
028    
029    //
030    //  loads pending budget construction GL (replacing any corresponding GL rows which already exist)
031    //  overloaded methods are provided so that one can load only pending GL rows for a specific fiscal year key
032    //  (if there happens to be more than one fiscal year key in the pending budget construction GL table) or
033    //  for the coming fiscal year.    
034    //
035    //
036    //  load pending budget construction GL for a specific fiscal year
037        
038        
039        private GenesisService genesisService;
040        private GeneralLedgerBudgetLoadDao generalLedgerBudgetLoadDao;
041        
042        public void loadPendingBudgetConstructionGeneralLedger(Integer FiscalYear)
043        {
044    //       generalLedgerBudgetLoadDao.unitTestRoutine(FiscalYear);
045           LOG.warn(String.format("\n\n********Budget construction general ledger load started for %d********",FiscalYear)); 
046           generalLedgerBudgetLoadDao.loadGeneralLedgerFromBudget(FiscalYear); 
047           LOG.warn(String.format("\n\n********Budget construction general ledger load ended********")); 
048        }
049    //
050    //  load for the fiscal year following the fiscal year of the current date
051        public void loadPendingBudgetConstructionGeneralLedger()
052        {
053           Integer nextFiscalYear = genesisService.genesisFiscalYearFromToday()+1;
054           LOG.warn(String.format("\n\n********Budget construction general ledger load started for %d********",nextFiscalYear)); 
055           loadPendingBudgetConstructionGeneralLedger(nextFiscalYear);
056           LOG.warn(String.format("\n\n********Budget construction general ledger load ended********")); 
057        }
058    
059        public void setGeneralLedgerBudgetLoadDao(GeneralLedgerBudgetLoadDao generalLedgerBudgetLoadDao)
060        {
061            this.generalLedgerBudgetLoadDao = generalLedgerBudgetLoadDao;
062        }
063        
064        public void setGenesisService(GenesisService genesisService)
065        {
066            this.genesisService = genesisService;
067        }
068    }