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.kuali.kfs.module.bc.batch.dataaccess.BudgetConstructionHumanResourcesPayrollInterfaceDao;
019    import org.kuali.kfs.module.bc.batch.service.BudgetConstructionHumanResourcesPayrollInterfaceService;
020    import org.springframework.transaction.annotation.Transactional;
021    
022    @Transactional
023    public class BudgetConstructionHumanResourcesPayrollInterfaceServiceImpl implements BudgetConstructionHumanResourcesPayrollInterfaceService {
024    
025        private BudgetConstructionHumanResourcesPayrollInterfaceDao budgetConstructionHumanResourcesPayrollInterfaceDao;
026        
027        
028        /**
029         * 
030         * @see org.kuali.kfs.module.bc.batch.service.BudgetConstructionHumanResourcesPayrollInterfaceService#refreshBudgetConstructionPosition(java.lang.Integer, boolean, boolean)
031         */
032        public void refreshBudgetConstructionPosition(Integer baseYear, boolean positionSynchOK, boolean CSFUpdateOK) {
033         /**
034          *  base year positions are built only if current payroll information is still flowing into budget construction
035          *  otherwise, the base year positions are frozen
036          */
037            Integer requestYear = baseYear+1;
038            if (positionSynchOK && CSFUpdateOK)
039            {
040                budgetConstructionHumanResourcesPayrollInterfaceDao.buildBudgetConstructionPositionBaseYear(baseYear);
041            }
042            /**
043             *  request year positions are updated as long as human resources information is still flowing into budget construction
044             */
045            if (positionSynchOK)
046            {
047                budgetConstructionHumanResourcesPayrollInterfaceDao.buildBudgetConstructionPositonRequestYear(requestYear);
048                budgetConstructionHumanResourcesPayrollInterfaceDao.buildBudgetConstructionAdministrativePosts();
049            }
050        }
051    
052        /**
053         * 
054         * @see org.kuali.kfs.module.bc.batch.service.BudgetConstructionHumanResourcesPayrollInterfaceService#refreshBudgetConstructionIntendedIncumbent(java.lang.Integer, boolean, boolean)
055         */
056        public void refreshBudgetConstructionIntendedIncumbent(Integer baseYear, boolean positionSynchOK, boolean CSFUpdateOK, boolean BCUpdatesAllowed) {
057            Integer requestYear = baseYear+1;
058            /**
059             *  the intended incumbent table is updated when human resources information is still flowing into budget construction.
060             *  when this is no longer the case, only the names are updated (unless all of budget construction is no longer in update mode).
061             */
062            if (positionSynchOK)
063            {
064                if (CSFUpdateOK)
065                {
066                    // we update the faculty level (full, associate, assistant, etc.) only if base payroll information is still flowing into budget construction.
067                    // otherwise, we assume that the base payroll is "frozen" as a base-line for salary setting, and we stop allowing people to move between faculty levels.
068                    // this version builds intended incumbent and updates faculty ranks.
069                    budgetConstructionHumanResourcesPayrollInterfaceDao.buildBudgetConstructionIntendedIncumbentWithFacultyAttributes(requestYear);
070                }
071                else
072                {
073                    // this version builds intended incumbent without adding anyone to the faculty levels.
074                    budgetConstructionHumanResourcesPayrollInterfaceDao.buildBudgetConstructionIntendedIncumbent(requestYear);
075                }
076            }
077            else
078            {
079               // the name is always updated if the budget is in update mode, even if intended incumbent was not rebuilt because position synchronization was off.
080                if (BCUpdatesAllowed)
081                {
082                   budgetConstructionHumanResourcesPayrollInterfaceDao.updateNamesInBudgetConstructionIntendedIncumbent();
083                }
084            }
085        }
086    
087        public void setBudgetConstructionHumanResourcesPayrollInterfaceDao (BudgetConstructionHumanResourcesPayrollInterfaceDao budgetConstructionHumanResourcesPayrollInterfaceDao)
088        {
089            this.budgetConstructionHumanResourcesPayrollInterfaceDao = budgetConstructionHumanResourcesPayrollInterfaceDao;
090        }
091        
092    }