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.EmployeeFunding;
025    import org.kuali.kfs.module.ld.businessobject.LaborBalanceSummary;
026    import org.kuali.kfs.module.ld.businessobject.LedgerBalance;
027    import org.kuali.kfs.module.ld.businessobject.LedgerBalanceForYearEndBalanceForward;
028    
029    /**
030     * This is the data access object for ledger balance.
031     * 
032     * @see org.kuali.kfs.module.ld.businessobject.LedgerBalance
033     */
034    public interface LaborLedgerBalanceDao {
035    
036        /**
037         * This method finds the records of balance entries according to input fields and values
038         * 
039         * @param fieldValues the input fields and values
040         * @param isConsolidated consolidation option is applied or not
041         * @return the records of balance entries
042         */
043        public Iterator findBalance(Map fieldValues, boolean isConsolidated);
044    
045        /**
046         * This method gets the size collection of balance entry groups according to input fields and values if the entries are required
047         * to be consolidated
048         * 
049         * @param fieldValues the input fields and values
050         * @return the size collection of balance entry groups
051         */
052        public Iterator getConsolidatedBalanceRecordCount(Map fieldValues);
053    
054        /**
055         * @param fiscalYear the given fiscal year
056         * @return an iterator over all balances for a given fiscal year
057         */
058        public Iterator<LedgerBalance> findBalancesForFiscalYear(Integer fiscalYear);
059    
060        /**
061         * retrieve the current funds according to the given field values
062         * 
063         * @param fieldValues the given field values
064         * @return the current funds according to the given field values
065         */
066        public List<LedgerBalance> findCurrentFunds(Map fieldValues);
067    
068        /**
069         * retrieve the encumbrance funds according to the given field values
070         * 
071         * @param fieldValues the given field values
072         * @return the encumbrance funds according to the given field values
073         */
074        public List<LedgerBalance> findEncumbranceFunds(Map fieldValues);
075    
076        /**
077         * retrieve the current funds according to the given field values
078         * 
079         * @param fieldValues the given field values
080         * @return the current funds according to the given field values
081         */
082        public List<EmployeeFunding> findCurrentEmployeeFunds(Map fieldValues);
083    
084        /**
085         * retrieve the encumbrance funds according to the given field values
086         * 
087         * @param fieldValues the given field values
088         * @return the encumbrance funds according to the given field values
089         */
090        public List<EmployeeFunding> findEncumbranceEmployeeFunds(Map fieldValues);
091    
092        /**
093         * find the summary of the ledger balances for the given fiscal year and balance types
094         * 
095         * @param fiscalYear the given fiscal year
096         * @param balanceTypes the given balance type codes
097         * @return the ledger balances for the given fiscal year and balance types
098         */
099        public List<LaborBalanceSummary> findBalanceSummary(Integer fiscalYear, Collection<String> balanceTypes);
100    
101        /**
102         * save the given ledger balance into the underlying data store
103         * 
104         * @param ledgerBalance the given ledger balance
105         */
106        public void save(LedgerBalance ledgerBalance);
107    
108        /**
109         * @param fiscalYear the given fiscal year
110         * @param fieldValues the given field values
111         * @return an iterator over all balances for a given fiscal year
112         */
113        public Iterator<LedgerBalance> findBalancesForFiscalYear(Integer fiscalYear, Map<String, String> fieldValues);
114    
115        /**
116         * @param fiscalYear the given fiscal year
117         * @param fieldValues the input fields and values
118         * @param subFundGroupCodes the given list of qualified sub fund group codes
119         * @param fundGroupCodes the given list of qualified group codes
120         * @return an Iterator over all balances for a given year and search criteria that include the accounts of balances must belong
121         *         to the given sub fund group or fund group
122         */
123        public Iterator<LedgerBalanceForYearEndBalanceForward> findBalancesForFiscalYear(Integer fiscalYear, Map<String, String> fieldValues, List<String> subFundGroupCodes, List<String> fundGroupCodes);
124    
125        /**
126         * find the accounts (chart of accounts code + account number) in the given fund groups
127         * 
128         * @param fiscalYear the given fiscal year
129         * @param fieldValues the input fields and values
130         * @param subFundGroupCodes the given list of qualified sub fund group codes
131         * @param fundGroupCodes the given list of qualified group codes
132         * @return the accounts (chart of accounts code + account number) in the given fund groups
133         */
134        public List<List<String>> findAccountsInFundGroups(Integer fiscalYear, Map<String, String> fieldValues, List<String> subFundGroupCodes, List<String> fundGroupCodes);
135    
136        /**
137         * find all ledger balances matching the given criteria within the given fiscal years
138         * 
139         * @param fieldValues the given field values
140         * @param excludedFieldValues the given field values that must not be matched
141         * @param fiscalYears the given fiscal years
142         * @param balanceTypeList the given balance type code list
143         * @param positionObjectGroupCodes the specified position obejct group codes
144         * @return all ledger balances matching the given criteria within the given fiscal years
145         */
146        public Collection<LedgerBalance> findLedgerBalances(Map<String, List<String>> fieldValues, Map<String, List<String>> excludedFieldValues, Set<Integer> fiscalYears, List<String> balanceTypeList, List<String> positionObjectGroupCodes);
147        
148        /**
149         * delete the ledger balance records that were posted prior to the given fiscal year
150         * 
151         * @param fiscalYear the given fiscal year
152         * @param chartOfAccountsCode the given chart of account code
153         */
154        public void deleteLedgerBalancesPriorToYear(Integer fiscalYear, String chartOfAccountsCode);
155    }