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    import org.apache.log4j.Logger;
019    import org.kuali.kfs.coa.dataaccess.PriorYearOrganizationDao;
020    import org.kuali.kfs.coa.service.PriorYearOrganizationService;
021    import org.springframework.transaction.annotation.Transactional;
022    
023    /**
024     * This is the default implementation of the PriorYearOrganizationService
025     */
026    @Transactional
027    public class PriorYearOrganizationServiceImpl implements PriorYearOrganizationService {
028        private static final Logger LOG = Logger.getLogger(PriorYearOrganizationServiceImpl.class);
029    
030        private PriorYearOrganizationDao priorYearOrganizationDao;
031    
032        /**
033         * Constructs a PriorYearOrganizationServiceImpl.java.
034         */
035        public PriorYearOrganizationServiceImpl() {
036            super();
037        }
038    
039        /**
040         * @see org.kuali.kfs.coa.service.PriorYearOrganizationService#populatePriorYearOrganizationFromCurrent()
041         */
042        public void populatePriorYearOrganizationsFromCurrent() {
043    
044            int purgedCount = priorYearOrganizationDao.purgePriorYearOrganizations();
045            if (LOG.isInfoEnabled()) {
046                LOG.info("number of prior year organizations purged : " + purgedCount);
047            }
048    
049            int copiedCount = priorYearOrganizationDao.copyCurrentOrganizationsToPriorYearTable();
050            if (LOG.isInfoEnabled()) {
051                LOG.info("number of current year organizations copied to prior year : " + copiedCount);
052            }
053        }
054    
055        /**
056         * This method sets the local dao variable to the value provided.
057         * 
058         * @param priorYearOrganizationDao The PriorYearOrganizationDao to set.
059         */
060        public void setPriorYearOrganizationDao(PriorYearOrganizationDao priorYearOrganizationDao) {
061            this.priorYearOrganizationDao = priorYearOrganizationDao;
062        }
063    
064    }