001: /*
002: * Copyright 2005-2007 The Kuali Foundation.
003: *
004: * Licensed under the Educational Community License, Version 1.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/ecl1.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.module.gl.dao;
017:
018: import java.util.Collection;
019: import java.util.Iterator;
020: import java.util.List;
021: import java.util.Map;
022:
023: import org.kuali.module.chart.bo.Account;
024: import org.kuali.module.gl.bo.Balance;
025: import org.kuali.module.gl.bo.Transaction;
026:
027: /**
028: * The DAO interface that declares methods needed to query the database about balances
029: */
030: public interface BalanceDao {
031:
032: /**
033: * Get the GL Summary data
034: *
035: * @param universityFiscalYear the fiscal year of balances to search for
036: * @param balanceTypeCodes a list of balance type codes of balances to search for
037: * @return iterator of reported on java.lang.Object arrays with the report data
038: */
039: public Iterator getGlSummary(int universityFiscalYear,
040: List<String> balanceTypeCodes);
041:
042: /**
043: * Given a transaction, finds the balance record it would affect
044: *
045: * @param t a transaction
046: * @return the balance record it would affect
047: */
048: public Balance getBalanceByTransaction(Transaction t);
049:
050: /**
051: * Given the primary keys of a balance, finds the balance in the database. Although not all of the
052: * primary keys are sent into this method...
053: *
054: * Programmers are seriously advised not to use this method; the default implementation does not work
055: *
056: * @param universityFiscalYear the university fiscal year of the balance to find
057: * @param chartOfAccountsCode the chart of accounts code of the balance to find
058: * @param accountNumber the account number of the balance to find
059: * @return the balance that is specified by those...er...partially defined primary keys.
060: */
061: public Balance getBalanceByPrimaryId(Integer universityFiscalYear,
062: String chartOfAccountsCode, String accountNumber);
063:
064: /**
065: * Based on specific query types, return an Iterator of balance records
066: *
067: * @param account the account of balances to find
068: * @param fiscalYear the fiscal year of balances to find
069: * @param includedObjectCodes a Collection of object codes found balances should have one of
070: * @param excludedObjectCodes a Collection of object codes found balances should not have one of
071: * @param objectTypeCodes a Collection of object type codes found balances should have one of
072: * @param balanceTypeCodes a Collection of balance type codes found balances should have one of
073: * @return an Iterator of Balances
074: */
075: public Iterator findBalances(Account account, Integer fiscalYear,
076: Collection includedObjectCodes,
077: Collection excludedObjectCodes, Collection objectTypeCodes,
078: Collection balanceTypeCodes);
079:
080: /**
081: * Saves a balance to the database
082: *
083: * @param b a balance to save
084: */
085: public void save(Balance b);
086:
087: /**
088: * This method finds the cash balance entries according to input fields and values
089: *
090: * @param fieldValues the input fields and values
091: * @param isConsolidated consolidation option is applied or not
092: * @return the records of cash balance entries
093: */
094: public Iterator<Balance> findCashBalance(Map fieldValues,
095: boolean isConsolidated);
096:
097: /**
098: * This method gets the size collection of cash balance entries or entry groups according to input fields and values
099: *
100: * @param fieldValues the input fields and values
101: * @param isConsolidated consolidation option is applied or not
102: * @return the size collection of cash balance entry groups
103: */
104: public Integer getDetailedCashBalanceRecordCount(Map fieldValues);
105:
106: /**
107: * This method gets the size collection of cash balance entry groups according to input fields and values if the entries are
108: * required to be consolidated
109: *
110: * @param fieldValues the input fields and values
111: * @return the size collection of cash balance entry groups
112: */
113: public Iterator getConsolidatedCashBalanceRecordCount(
114: Map fieldValues);
115:
116: /**
117: * This method finds the records of balance entries according to input fields and values
118: *
119: * @param fieldValues the input fields and values
120: * @param isConsolidated consolidation option is applied or not
121: * @return the records of balance entries
122: */
123: public Iterator findBalance(Map fieldValues, boolean isConsolidated);
124:
125: /**
126: * This method gets the size collection of balance entry groups according to input fields and values if the entries are required
127: * to be consolidated
128: *
129: * @param fieldValues the input fields and values
130: * @return the size collection of balance entry groups
131: */
132: public Iterator getConsolidatedBalanceRecordCount(Map fieldValues);
133:
134: /**
135: * Returns the balance entries for the given year, chart, and account.
136: *
137: * @param universityFiscalYear the unversity fiscal year of balances to return
138: * @param chartOfAccountsCode the chart of accounts code of balances to return
139: * @param accountNumber the account number of balances to return
140: * @param sfCode Sufficient Funds Code (used to determine sorting)
141: * @return balance entries matching above
142: */
143: public Iterator<Balance> findAccountBalances(
144: Integer universityFiscalYear, String chartOfAccountsCode,
145: String accountNumber, String sfCode);
146:
147: /**
148: * Returns the balance entries for the given year, chart, and account.
149: *
150: * @param universityFiscalYear the fiscal year of balances to return
151: * @param chartOfAccountsCode the chart of accounts code of balances to return
152: * @param accountNumber the account number of balances to return
153: * @return balance entries matching above sorted by object code
154: */
155: public Iterator<Balance> findAccountBalances(
156: Integer universityFiscalYear, String chartOfAccountsCode,
157: String accountNumber);
158:
159: /**
160: * Returns the CB (current budget) record for the given year, chart, account, and object code if one is found.
161: *
162: * @param universityFiscalYear the fiscal year of the CB balance to return
163: * @param chartOfAccountsCode the chart of the accounts code of the CB balanes to return
164: * @param accountNumber the account number of the CB balance to return
165: * @param objectCode the object code of the CB balance to return
166: * @return the CB Balance record
167: */
168: public Balance getCurrentBudgetForObjectCode(
169: Integer universityFiscalYear, String chartOfAccountsCode,
170: String accountNumber, String objectCode);
171:
172: /**
173: * Purge the sufficient funds balance table by year/chart
174: *
175: * @param chart the chart of balances to purge
176: * @param year the university fiscal year of balances to purge
177: */
178: public void purgeYearByChart(String chart, int year);
179:
180: /**
181: * Returns all of the balances of a given fiscal year
182: *
183: * @param year the university fiscal year of balances to return
184: * @return an iterator over all balances for a given fiscal year
185: */
186: public Iterator<Balance> findBalancesForFiscalYear(Integer year);
187:
188: /**
189: * This method returns the total count of balances for a fiscal year
190: *
191: * @param year fiscal year to check
192: * @return the count of balances
193: */
194: public int countBalancesForFiscalYear(Integer year);
195:
196: /**
197: * This method returns all of the balances specifically for the nominal activity closing job
198: *
199: * @param year year to find balances for
200: * @return an Iterator of nominal activity balances
201: */
202: public Iterator<Balance> findNominalActivityBalancesForFiscalYear(
203: Integer year);
204:
205: /**
206: * Returns the balances specifically to be forwarded to the next fiscal year, based on the "general" rule
207: *
208: * @param year the fiscal year to find balances for
209: * @return an Iterator full of Balances
210: */
211: public Iterator<Balance> findGeneralBalancesToForwardForFiscalYear(
212: Integer year);
213:
214: /**
215: * Returns the C&G balances specifically to be forwarded to the next fiscal year, based on the "cumulative" rule
216: *
217: * @param year the fiscal year to find balances for
218: * @return and Iterator chuck full of Balances
219: */
220: public Iterator<Balance> findCumulativeBalancesToForwardForFiscalYear(
221: Integer year);
222:
223: /**
224: * Returns the balances that would specifically be picked up by the Organization Reversion year end process
225: *
226: * @param year the year to find balances for
227: * @return an iterator of the balances to process
228: */
229: public Iterator<Balance> findOrganizationReversionBalancesForFiscalYear(
230: Integer year, boolean endOfYear);
231: }
|