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.gl.service;
017
018 import java.util.Iterator;
019 import java.util.List;
020 import java.util.Map;
021
022 import org.kuali.kfs.coa.businessobject.Account;
023 import org.kuali.kfs.gl.businessobject.Balance;
024 import org.kuali.kfs.gl.businessobject.GlSummary;
025
026 /**
027 * An interface which declares methods needed for using Balance
028 */
029 public interface BalanceService {
030 /**
031 * Save. Like. OK. You know. Save a balance? You know? That's what this method should do. Yeah. It should save a balance. In the DB and stuff.
032 *
033 * @param b the balance to, like, totally save
034 */
035 public void save(Balance b);
036
037 /**
038 *
039 * This method...
040 * @param account
041 * @return
042 */
043 public boolean hasAssetLiabilityFundBalanceBalances(Account account);
044
045 /**
046 *
047 * This method...
048 * @param account
049 * @return
050 */
051 public boolean fundBalanceWillNetToZero(Account account);
052
053 /**
054 *
055 * This method...
056 * @param account
057 * @return
058 */
059 public boolean hasEncumbrancesOrBaseBudgets(Account account);
060
061 /**
062 *
063 * This method...
064 * @param account
065 * @return
066 */
067 public boolean beginningBalanceLoaded(Account account);
068
069 /**
070 *
071 * This method...
072 * @param account
073 * @return
074 */
075 public boolean hasAssetLiabilityOrFundBalance(Account account);
076
077 /**
078 * Returns all of the balances for a given fiscal year.
079 *
080 * @param fiscalYear the fiscal year to find balances for
081 * @return an Iterator over all balances for a given year
082 */
083 public Iterator<Balance> findBalancesForFiscalYear(Integer fiscalYear);
084
085 /**
086 * This method finds the summary records of balance entries according to input fields an values
087 *
088 * @param fieldValues the input fields an values
089 * @param isConsolidated consolidation option is applied or not
090 * @return the summary records of balance entries
091 */
092 public Iterator findCashBalance(Map fieldValues, boolean isConsolidated);
093
094 /**
095 * This method gets the size of cash balance entries according to input fields and values
096 *
097 * @param fieldValues the input fields and values
098 * @param isConsolidated consolidation option is applied or not
099 * @return the count of cash balance entries
100 */
101 public Integer getCashBalanceRecordCount(Map fieldValues, boolean isConsolidated);
102
103 /**
104 * This method gets the size of balance entries according to input fields and values
105 *
106 * @param fieldValues the input fields and values
107 * @param isConsolidated consolidation option is applied or not
108 * @return the size of balance entries
109 */
110 public Iterator findBalance(Map fieldValues, boolean isConsolidated);
111
112 /**
113 * This method finds the summary records of balance entries according to input fields and values
114 *
115 * @param fieldValues the input fields and values
116 * @param isConsolidated consolidation option is applied or not
117 * @return the summary records of balance entries
118 */
119 public Integer getBalanceRecordCount(Map fieldValues, boolean isConsolidated);
120
121 /**
122 * Purge the sufficient funds balance table by year/chart
123 *
124 * @param chart the chart purged balances should have
125 * @param year the fiscal year purged balances should have
126 */
127 public void purgeYearByChart(String chart, int year);
128
129 /**
130 * Get the GL Balance summary for the GL Summary report
131 *
132 * @param universityFiscalYear
133 * @param balanceTypeCodes
134 * @return a list of summarized GL balances
135 */
136 public List<GlSummary> getGlSummary(int universityFiscalYear, List<String> balanceTypeCodes);
137
138 /**
139 * This method returns the total count of balances for a fiscal year
140 *
141 * @param year fiscal year to check
142 * @return the count of balances
143 */
144 public int countBalancesForFiscalYear(Integer year);
145
146 /**
147 * This method returns all of the balances specifically for the nominal activity closing job
148 *
149 * @param year year to find balances for
150 * @return an Iterator of nominal activity balances
151 */
152 public Iterator<Balance> findNominalActivityBalancesForFiscalYear(Integer year);
153
154 /**
155 * Returns all the balances specifically to be processed by the balance forwards job for the "general" rule
156 * @param year the fiscal year to find balances for
157 * @return an Iterator of balances to process for the general balance forward process
158 */
159 public Iterator<Balance> findGeneralBalancesToForwardForFiscalYear(Integer year);
160
161 /**
162 * Returns all the balances to be forwarded for the "cumulative" rule
163 * @param year the fiscal year to find balances for
164 * @return an Iterator of balances to process for the cumulative/active balance forward process
165 */
166 public Iterator<Balance> findCumulativeBalancesToForwardForFiscalYear(Integer year);
167
168 /**
169 * Returns all of the balances to be forwarded for the organization reversion process
170 *
171 * @param year the year of balances to find
172 * @param endOfYear whether the organization reversion process is running end of year (before the fiscal year change over) or
173 * beginning of year (after the fiscal year change over)
174 * @return an iterator of balances to put through the strenuous organization reversion process
175 */
176 public Iterator<Balance> findOrganizationReversionBalancesForFiscalYear(Integer year, boolean endOfYear);
177 }