1 /*
2 * Copyright 2005 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.ole.gl.dataaccess;
17
18 import java.util.Collection;
19 import java.util.Iterator;
20 import java.util.List;
21 import java.util.Map;
22
23 import org.kuali.ole.coa.businessobject.Account;
24 import org.kuali.ole.gl.businessobject.Balance;
25 import org.kuali.ole.gl.businessobject.Transaction;
26 import org.kuali.ole.sys.businessobject.SystemOptions;
27 import org.kuali.rice.core.api.parameter.ParameterEvaluator;
28
29 /**
30 * The DAO interface that declares methods needed to query the database about balances
31 */
32 public interface BalanceDao {
33
34 /**
35 * Get the GL Summary data
36 *
37 * @param universityFiscalYear the fiscal year of balances to search for
38 * @param balanceTypeCodes a list of balance type codes of balances to search for
39 * @return iterator of reported on java.lang.Object arrays with the report data
40 */
41 public Iterator<Object[]> getGlSummary(int universityFiscalYear, Collection<String> balanceTypeCodes);
42
43 /**
44 * Given a transaction, finds the balance record it would affect
45 *
46 * @param t a transaction
47 * @return the balance record it would affect
48 */
49 public Balance getBalanceByTransaction(Transaction t);
50
51 /**
52 * Based on specific query types, return an Iterator of balance records
53 *
54 * @param account the account of balances to find
55 * @param fiscalYear the fiscal year of balances to find
56 * @param includedObjectCodes a Collection of object codes found balances should have one of
57 * @param excludedObjectCodes a Collection of object codes found balances should not have one of
58 * @param objectTypeCodes a Collection of object type codes found balances should have one of
59 * @param balanceTypeCodes a Collection of balance type codes found balances should have one of
60 * @return an Iterator of Balances
61 */
62 public Iterator findBalances(Account account, Integer fiscalYear, Collection includedObjectCodes, Collection excludedObjectCodes, Collection objectTypeCodes, Collection balanceTypeCodes);
63
64 /**
65 * This method finds the cash balance entries according to input fields and values. The results will be limited to the system
66 * lookup results limit.
67 *
68 * @param fieldValues the input fields and values
69 * @param isConsolidated consolidation option is applied or not
70 * @param encumbranceBalanceTypes a list of encumbrance Balance Types
71 * @return the records of cash balance entries
72 */
73 public Iterator<Balance> lookupCashBalance(Map fieldValues, boolean isConsolidated, Collection<String> encumbranceBalanceTypes);
74
75 /**
76 * This method gets the size collection of cash balance entries or entry groups according to input fields and values
77 *
78 * @param fieldValues the input fields and values
79 * @param isConsolidated consolidation option is applied or not
80 * @param encumbranceBalanceTypes a list of encumbrance balance types
81 * @return the size collection of cash balance entry groups
82 */
83 public Integer getDetailedCashBalanceRecordCount(Map fieldValues, Collection<String> encumbranceBalanceTypes);
84
85 /**
86 * This method gets the size collection of cash balance entry groups according to input fields and values if the entries are
87 * required to be consolidated
88 *
89 * @param fieldValues the input fields and values
90 * @param encumbranceBalanceTypes a list of encumbrance balance types
91 * @return the size collection of cash balance entry groups
92 */
93 public int getConsolidatedCashBalanceRecordCount(Map fieldValues, Collection<String> encumbranceBalanceTypes);
94
95 /**
96 * This method finds the records of balance entries according to input fields and values
97 *
98 * @param fieldValues the input fields and values
99 * @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 }