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.dataaccess;
017    
018    import java.util.Collection;
019    import java.util.Iterator;
020    import java.util.List;
021    import java.util.Map;
022    import java.util.Set;
023    
024    import org.kuali.kfs.module.ld.businessobject.LedgerEntry;
025    
026    /**
027     * This is the data access object for ledger entry.
028     * 
029     * @see org.kuali.kfs.module.ld.businessobject.LedgerEntry
030     */
031    public interface LaborLedgerEntryDao {
032    
033        /**
034         * The sequence number is one of the primary keys of ledger entry. The entries can be grouped by other keys. This method is used
035         * to get the maximum sequence number in the group of entries.
036         * 
037         * @param ledgerEntry the given ledger entry
038         * @return the maximum sequence number in a group of entries. If the group doesn't exist, return 0.
039         */
040        Integer getMaxSquenceNumber(LedgerEntry ledgerEntry);
041    
042        /**
043         * Find the ledger entries that satisfy the all entries in the given field-value pair
044         * 
045         * @param fieldValues the given field-value pair
046         * @return the ledger entries that satisfy the all entries in the given field-value pair
047         */
048        Iterator<LedgerEntry> find(Map<String, String> fieldValues);
049    
050        /**
051         * save the given ledger entry into the underlying data store
052         * 
053         * @param ledgerEntry the given ledger entry
054         */
055        void save(LedgerEntry ledgerEntry);
056    
057        /**
058         * find the employees who were paid based on a set of specified pay type within the given report periods. Here, a pay type can
059         * be determined by earn code and pay group.
060         * 
061         * @param payPeriods the given pay periods
062         * @param balanceTypes the specified balance type codes
063         * @param earnCodePayGroupMap the combination of earn codes and pay groups, where pay group is the key and earn code set is the
064         *        value
065         * @return the employees who were paid based on a set of specified pay type within the given report periods
066         */
067        List<String> findEmployeesWithPayType(Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap);
068        
069        /**
070         * get the ledger entries for the given employee based on a set of specified pay type within the given report periods. Here, a pay type can
071         * be determined by earn code and pay group.
072         * 
073         * @param emplid the given employee id
074         * @param payPeriods the given pay periods
075         * @param balanceTypes the specified balance type codes
076         * @param earnCodePayGroupMap the combination of earn codes and pay groups, where pay group is the key and earn code set is the
077         *        value
078         * @return true if the given employee was paid based on a set of specified pay type within the given report periods; otherwise, false
079         */
080        Collection<LedgerEntry> getLedgerEntriesForEmployeeWithPayType(String emplid, Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap);
081        
082        /**
083         * determine if the given employee is associated with a set of specified pay type within the given report periods. Here, a pay type can
084         * be determined by earn code and pay group.
085         * 
086         * @param emplid the given employee id
087         * @param payPeriods the given pay periods
088         * @param balanceTypes the specified balance type codes
089         * @param earnCodePayGroupMap the combination of earn codes and pay groups, where pay group is the key and earn code set is the
090         *        value
091         * @return true if the given employee was paid based on a set of specified pay type within the given report periods; otherwise, false
092         */
093        boolean isEmployeeWithPayType(String emplid, Map<Integer, Set<String>> payPeriods, List<String> balanceTypes, Map<String, Set<String>> earnCodePayGroupMap);
094    
095        /**
096         * delete the ledger entry records that were posted prior to the given fiscal year
097         * 
098         * @param fiscalYear the given fiscal year
099         * @param chartOfAccountsCode the given chart of account code
100         */
101        void deleteLedgerEntriesPriorToYear(Integer fiscalYear, String chartOfAccountsCode);
102    }