001/*
002 * Copyright 2005 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 */
016package org.kuali.ole.gl.dataaccess;
017
018import java.util.Collection;
019import java.util.Iterator;
020import java.util.List;
021import java.util.Map;
022
023import org.kuali.ole.coa.businessobject.Account;
024import org.kuali.ole.gl.businessobject.Balance;
025import org.kuali.ole.gl.businessobject.Transaction;
026import org.kuali.ole.sys.businessobject.SystemOptions;
027import org.kuali.rice.core.api.parameter.ParameterEvaluator;
028
029/**
030 * The DAO interface that declares methods needed to query the database about balances
031 */
032public interface BalanceDao {
033
034    /**
035     * Get the GL Summary data
036     * 
037     * @param universityFiscalYear the fiscal year of balances to search for
038     * @param balanceTypeCodes a list of balance type codes of balances to search for
039     * @return iterator of reported on java.lang.Object arrays with the report data
040     */
041    public Iterator<Object[]> getGlSummary(int universityFiscalYear, Collection<String> balanceTypeCodes);
042
043    /**
044     * Given a transaction, finds the balance record it would affect
045     * 
046     * @param t a transaction
047     * @return the balance record it would affect
048     */
049    public Balance getBalanceByTransaction(Transaction t);
050
051    /**
052     * Based on specific query types, return an Iterator of balance records
053     * 
054     * @param account the account of balances to find
055     * @param fiscalYear the fiscal year of balances to find
056     * @param includedObjectCodes a Collection of object codes found balances should have one of
057     * @param excludedObjectCodes a Collection of object codes found balances should not have one of
058     * @param objectTypeCodes a Collection of object type codes found balances should have one of
059     * @param balanceTypeCodes a Collection of balance type codes found balances should have one of
060     * @return an Iterator of Balances
061     */
062    public Iterator findBalances(Account account, Integer fiscalYear, Collection includedObjectCodes, Collection excludedObjectCodes, Collection objectTypeCodes, Collection balanceTypeCodes);
063
064    /**
065     * This method finds the cash balance entries according to input fields and values. The results will be limited to the system
066     * lookup results limit.
067     * 
068     * @param fieldValues the input fields and values
069     * @param isConsolidated consolidation option is applied or not
070     * @param encumbranceBalanceTypes a list of encumbrance Balance Types
071     * @return the records of cash balance entries
072     */
073    public Iterator<Balance> lookupCashBalance(Map fieldValues, boolean isConsolidated, Collection<String> encumbranceBalanceTypes);
074
075    /**
076     * This method gets the size collection of cash balance entries or entry groups according to input fields and values
077     * 
078     * @param fieldValues the input fields and values
079     * @param isConsolidated consolidation option is applied or not
080     * @param encumbranceBalanceTypes a list of encumbrance balance types
081     * @return the size collection of cash balance entry groups
082     */
083    public Integer getDetailedCashBalanceRecordCount(Map fieldValues, Collection<String> encumbranceBalanceTypes);
084
085    /**
086     * This method gets the size collection of cash balance entry groups according to input fields and values if the entries are
087     * required to be consolidated
088     * 
089     * @param fieldValues the input fields and values
090     * @param encumbranceBalanceTypes a list of encumbrance balance types
091     * @return the size collection of cash balance entry groups
092     */
093    public int getConsolidatedCashBalanceRecordCount(Map fieldValues, Collection<String> encumbranceBalanceTypes);
094
095    /**
096     * This method finds the records of balance entries according to input fields and values
097     * 
098     * @param fieldValues the input fields and values
099     * @param isConsolidated consolidation option is applied or not
100     * @param encumbranceBalanceTypes a list of encumbrance balance types
101     * @return the records of balance entries
102     */
103    public Iterator findBalance(Map fieldValues, boolean isConsolidated, Collection<String> encumbranceBalanceTypes);
104
105    /**
106     * This method gets the size collection of balance entry groups according to input fields and values if the entries are required
107     * to be consolidated
108     * 
109     * @param fieldValues the input fields and values
110     * @param encumbranceBalanceTypes a list of encumbrance balance types
111     * @return the size collection of balance entry groups
112     */
113    public Iterator getConsolidatedBalanceRecordCount(Map fieldValues, Collection<String> encumbranceBalanceTypes);
114
115    /**
116     * Returns the balance entries for the given year, chart, and account.
117     * 
118     * @param universityFiscalYear the unversity fiscal year of balances to return
119     * @param chartOfAccountsCode the chart of accounts code of balances to return
120     * @param accountNumber the account number of balances to return
121     * @param sfCode Sufficient Funds Code (used to determine sorting)
122     * @return balance entries matching above
123     */
124    public Iterator<Balance> findAccountBalances(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, String sfCode);
125
126    /**
127     * Returns the balance entries for the given year, chart, and account.
128     * 
129     * @param universityFiscalYear the fiscal year of balances to return
130     * @param chartOfAccountsCode the chart of accounts code of balances to return
131     * @param accountNumber the account number of balances to return
132     * @return balance entries matching above sorted by object code
133     */
134    public Iterator<Balance> findAccountBalances(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber);
135
136    /**
137     * Returns the CB (current budget) record for the given year, chart, account, and object code if one is found.
138     * 
139     * @param universityFiscalYear the fiscal year of the CB balance to return
140     * @param chartOfAccountsCode the chart of the accounts code of the CB balanes to return
141     * @param accountNumber the account number of the CB balance to return
142     * @param objectCode the object code of the CB balance to return
143     * @return the CB Balance record
144     */
145    public Balance getCurrentBudgetForObjectCode(Integer universityFiscalYear, String chartOfAccountsCode, String accountNumber, String objectCode);
146
147    /**
148     * Purge the sufficient funds balance table by year/chart
149     * 
150     * @param chart the chart of balances to purge
151     * @param year the university fiscal year of balances to purge
152     */
153    public void purgeYearByChart(String chart, int year);
154
155    /**
156     * Returns all of the balances of a given fiscal year
157     * 
158     * @param year the university fiscal year of balances to return
159     * @return an iterator over all balances for a given fiscal year
160     */
161    public Iterator<Balance> findBalancesForFiscalYear(Integer year);
162
163    /**
164     * This method returns the total count of balances for a fiscal year
165     * 
166     * @param year fiscal year to check
167     * @return the count of balances
168     */
169    public int countBalancesForFiscalYear(Integer year);
170
171    /**
172     * This method returns all of the balances specifically for the nominal activity closing job
173     * 
174     * @param year year to find balances for
175     * @param nominalActivityObjectTypeCodes a List of nominal activity object type codes
176     * @param currentYearOptions current year options
177     * @return an Iterator of nominal activity balances
178     */
179    public Iterator<Balance> findNominalActivityBalancesForFiscalYear(Integer year, Collection<String> nominalActivityObjectTypeCodes, SystemOptions currentYearOptions);
180
181    /**
182     * Returns the balances specifically to be forwarded to the next fiscal year, based on the "general" rule
183     * 
184     * @param year the fiscal year to find balances for
185     * @param generalForwardBalanceObjectTypes a List of general Forward Balance Object Types
186     * @param generalBalanceForwardBalanceTypesArray an array of general Balance Forward Balance Types
187     * @return an Iterator full of Balances
188     */
189    public Iterator<Balance> findGeneralBalancesToForwardForFiscalYear(Integer year, Collection<String> generalForwardBalanceObjectTypes, Collection<String> generalBalanceForwardBalanceTypesArray);
190
191    /**
192     * Returns the C&G balances specifically to be forwarded to the next fiscal year, based on the "cumulative" rule
193     * 
194     * @param year the fiscal year to find balances for
195     * @param cumulativeForwardBalanceObjectTypes a List of cumulative Forward Balance Object Types
196     * @param contractsAndGrantsDenotingValues a List of contracts And Grants Denoting Values
197     * @param subFundGroupsForCumulativeBalanceForwardingArray an array of sub Fund Groups For Cumulative Balance Forwarding
198     * @param cumulativeBalanceForwardBalanceTypesArray an array of cumulative Balance Forward Balance Types
199     * @return and Iterator chuck full of Balances
200     */
201    public Iterator<Balance> findCumulativeBalancesToForwardForFiscalYear(Integer year, Collection<String> cumulativeForwardBalanceObjectTypes, Collection<String> contractsAndGrantsDenotingValues, Collection<String> subFundGroupsForCumulativeBalanceForwardingArray, Collection<String> cumulativeBalanceForwardBalanceTypesArray, boolean fundGroupDenotesCGInd);
202
203    /**
204     * Returns the balances that would specifically be picked up by the Organization Reversion year end process
205     * 
206     * @param year the year to find balances for
207     * @param endOfYear
208     * @param options
209     * @param parameterEvaluators a list of parameter evaluators
210     * @return an iterator of the balances to process
211     */
212    public Iterator<Balance> findOrganizationReversionBalancesForFiscalYear(Integer year, boolean endOfYear, SystemOptions options, List<ParameterEvaluator> parameterEvaluators);
213}