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.ld.service.impl;
017    
018    import java.util.Iterator;
019    import java.util.List;
020    import java.util.Map;
021    import java.util.Set;
022    
023    import org.kuali.kfs.module.ld.batch.service.LaborAccountingCycleCachingService;
024    import org.kuali.kfs.module.ld.businessobject.LedgerEntry;
025    import org.kuali.kfs.module.ld.dataaccess.LaborLedgerEntryDao;
026    import org.kuali.kfs.module.ld.service.LaborLedgerEntryService;
027    import org.springframework.transaction.annotation.Transactional;
028    
029    /**
030     * This class implements LaborLedgerEntryService to provide the access to labor ledger entries in data stores.
031     * 
032     * @see org.kuali.kfs.module.ld.businessobject.LedgerEntry
033     */
034    @Transactional
035    public class LaborLedgerEntryServiceImpl implements LaborLedgerEntryService {
036    
037        private LaborLedgerEntryDao laborLedgerEntryDao;
038        private LaborAccountingCycleCachingService laborAccountingCycleCachingService;
039        /**
040         * @see org.kuali.kfs.module.ld.service.LaborLedgerEntryService#save(org.kuali.kfs.module.ld.businessobject.LedgerEntry)
041         */
042        public void save(LedgerEntry ledgerEntry) {
043            laborAccountingCycleCachingService.insertLedgerEntry(ledgerEntry);
044        }
045    
046        /**
047         * @see org.kuali.kfs.module.ld.service.LaborLedgerEntryService#getMaxSquenceNumber(org.kuali.kfs.module.ld.businessobject.LedgerEntry)
048         */
049        public Integer getMaxSequenceNumber(LedgerEntry ledgerEntry) {
050            return laborAccountingCycleCachingService.getMaxLaborSequenceNumber(ledgerEntry);
051        }
052    
053        /**
054         * @see org.kuali.kfs.module.ld.service.LaborLedgerEntryService#find(java.util.Map)
055         */
056        public Iterator<LedgerEntry> find(Map<String, String> fieldValues) {
057            return laborLedgerEntryDao.find(fieldValues);
058        }
059    
060        /**
061         * @see org.kuali.kfs.module.ld.service.LaborLedgerEntryService#findEmployeesWithPayType(java.util.Map, java.util.List, java.util.Map)
062         */
063        public List<String> findEmployeesWithPayType(Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap) {
064            return laborLedgerEntryDao.findEmployeesWithPayType(payPeriods, balanceTypes, earnCodePayGroupMap);
065        }
066        
067        /**
068         * @see org.kuali.kfs.module.ld.service.LaborLedgerEntryService#isEmployeeWithPayType(java.lang.String, java.util.Map, java.util.List, java.util.Map)
069         */
070        public boolean isEmployeeWithPayType(String emplid, Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap) {
071            return laborLedgerEntryDao.isEmployeeWithPayType(emplid, payPeriods, balanceTypes, earnCodePayGroupMap);
072        }
073        
074        /**
075         * @see org.kuali.kfs.module.ld.service.LaborLedgerEntryService#deleteLedgerEntriesPriorToYear(java.lang.Integer, java.lang.String)
076         */
077        public void deleteLedgerEntriesPriorToYear(Integer fiscalYear, String chartOfAccountsCode) {
078            laborLedgerEntryDao.deleteLedgerEntriesPriorToYear(fiscalYear, chartOfAccountsCode);       
079        }
080        
081        /**
082         * Sets the laborLedgerEntryDao attribute value.
083         * 
084         * @param laborLedgerEntryDao The laborLedgerEntryDao to set.
085         */
086        public void setLaborLedgerEntryDao(LaborLedgerEntryDao laborLedgerEntryDao) {
087            this.laborLedgerEntryDao = laborLedgerEntryDao;
088        }
089    
090        public void setLaborAccountingCycleCachingService(LaborAccountingCycleCachingService laborAccountingCycleCachingService) {
091            this.laborAccountingCycleCachingService = laborAccountingCycleCachingService;
092        }
093    }