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;
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.businessobject.LedgerEntry;
024    
025    /**
026     * This interface provides its clients with access to labor leger entries in the backend data store.
027     */
028    public interface LaborLedgerEntryService {
029    
030        /**
031         * Save the given ledger entry or update it if it exsits
032         * 
033         * @param ledgerEntry the given ledger entry
034         */
035        void save(LedgerEntry ledgerEntry);
036    
037        /**
038         * The sequence number is one of the primary keys of ledger entry. The entries can be grouped by other keys. This method is used
039         * to get the maximum sequence number in the group of entries.
040         * 
041         * @param ledgerEntry the given ledger entry
042         * @return the maximum sequence number in a group of entries. If the group doesn't exist, return 0.
043         */
044        Integer getMaxSequenceNumber(LedgerEntry ledgerEntry);
045    
046        /**
047         * Find the ledger entries that satisfy the all entries in the given field-value pair
048         * 
049         * @param fieldValues the given field-value pair
050         * @return the ledger entries that satisfy the all entries in the given field-value pair
051         */
052        Iterator<LedgerEntry> find(Map<String, String> fieldValues);
053    
054        /**
055         * find the employees who were paid based on a set of specified pay type within the given report periods. Here, a pay type can
056         * be determined by earn code and pay group.
057         * 
058         * @param payPeriods the given pay periods
059         * @param balanceTypes the specified balance type codes
060         * @param earnCodePayGroupMap the combination of earn codes and pay groups, where pay group is the key and earn code set is the value
061         * @return the employees who were paid based on a set of specified pay type within the given report periods
062         */
063        List<String> findEmployeesWithPayType(Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap);
064        
065        /**
066         * determine whether the given employee was paid based on a set of specified pay type within the given report periods. Here, a pay type can
067         * be determined by earn code and pay group.
068         * 
069         * @param emplid the given employee id
070         * @param payPeriods the given pay periods
071         * @param balanceTypes the specified balance type codes
072         * @param earnCodePayGroupMap the combination of earn codes and pay groups, where pay group is the key and earn code set is the
073         *        value
074         * @return true if the given employee was paid based on a set of specified pay type within the given report periods; otherwise, false
075         */
076        boolean isEmployeeWithPayType(String emplid, Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap);
077    
078        /**
079         * delete the ledger entry records that were posted prior to the given fiscal year
080         * 
081         * @param fiscalYear the given fiscal year
082         * @param chartOfAccountsCode the given chart of account code
083         */
084        void deleteLedgerEntriesPriorToYear(Integer fiscalYear, String chartOfAccountsCode);
085    }