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
017 package org.kuali.kfs.coa.businessobject;
018
019 import java.util.Iterator;
020 import java.util.LinkedHashMap;
021 import java.util.List;
022
023 import org.kuali.kfs.sys.businessobject.SystemOptions;
024 import org.kuali.rice.kns.bo.Inactivateable;
025 import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
026 import org.kuali.rice.kns.util.ObjectUtils;
027 import org.kuali.rice.kns.util.TypedArrayList;
028
029 /**
030 *
031 */
032 public class OrganizationReversion extends PersistableBusinessObjectBase implements Inactivateable, CarryForwardReversionProcessOrganizationInfo {
033
034 private Integer universityFiscalYear;
035 private String chartOfAccountsCode;
036 private String organizationCode;
037 private String budgetReversionChartOfAccountsCode;
038 private String budgetReversionAccountNumber;
039 private boolean carryForwardByObjectCodeIndicator;
040 private String cashReversionFinancialChartOfAccountsCode;
041 private String cashReversionAccountNumber;
042 private Chart chartOfAccounts;
043 private Account cashReversionAccount;
044 private Account budgetReversionAccount;
045 private Chart budgetReversionChartOfAccounts;
046 private Chart cashReversionFinancialChartOfAccounts;
047 private SystemOptions universityFiscal;
048 private Organization organization;
049 private List<Organization> organizations; // This is only used by the "global" document
050 private List<OrganizationReversionDetail> organizationReversionDetail;
051 private boolean active;
052
053 /**
054 * Default constructor.
055 */
056 public OrganizationReversion() {
057 organizations = new TypedArrayList(Organization.class);
058 organizationReversionDetail = new TypedArrayList(OrganizationReversionDetail.class);
059 }
060
061 public List<OrganizationReversionDetail> getOrganizationReversionDetail() {
062 return organizationReversionDetail;
063 }
064
065 public void addOrganizationReversionDetail(OrganizationReversionDetail ord) {
066 organizationReversionDetail.add(ord);
067 }
068
069 public void setOrganizationReversionDetail(List<OrganizationReversionDetail> organizationReversionDetail) {
070 this.organizationReversionDetail = organizationReversionDetail;
071 }
072
073 public OrganizationReversionCategoryInfo getOrganizationReversionDetail(String categoryCode) {
074 for (OrganizationReversionDetail element : organizationReversionDetail) {
075 if (element.getOrganizationReversionCategoryCode().equals(categoryCode)) {
076 if (!element.isActive()) {
077 return null; // don't send back inactive details
078 } else {
079 return element;
080 }
081 }
082 }
083 return null;
084 }
085
086 /**
087 * Gets the universityFiscalYear attribute.
088 *
089 * @return Returns the universityFiscalYear
090 */
091 public Integer getUniversityFiscalYear() {
092 return universityFiscalYear;
093 }
094
095 /**
096 * Sets the universityFiscalYear attribute.
097 *
098 * @param universityFiscalYear The universityFiscalYear to set.
099 */
100 public void setUniversityFiscalYear(Integer universityFiscalYear) {
101 this.universityFiscalYear = universityFiscalYear;
102 }
103
104
105 /**
106 * Gets the chartOfAccountsCode attribute.
107 *
108 * @return Returns the chartOfAccountsCode
109 */
110 public String getChartOfAccountsCode() {
111 return chartOfAccountsCode;
112 }
113
114 /**
115 * Sets the chartOfAccountsCode attribute.
116 *
117 * @param chartOfAccountsCode The chartOfAccountsCode to set.
118 */
119 public void setChartOfAccountsCode(String chartOfAccountsCode) {
120 this.chartOfAccountsCode = chartOfAccountsCode;
121 }
122
123
124 /**
125 * Gets the organizationCode attribute.
126 *
127 * @return Returns the organizationCode
128 */
129 public String getOrganizationCode() {
130 return organizationCode;
131 }
132
133 /**
134 * Sets the organizationCode attribute.
135 *
136 * @param organizationCode The organizationCode to set.
137 */
138 public void setOrganizationCode(String organizationCode) {
139 this.organizationCode = organizationCode;
140 }
141
142
143 /**
144 * Gets the budgetReversionChartOfAccountsCode attribute.
145 *
146 * @return Returns the budgetReversionChartOfAccountsCode
147 */
148 public String getBudgetReversionChartOfAccountsCode() {
149 return budgetReversionChartOfAccountsCode;
150 }
151
152 /**
153 * Sets the budgetReversionChartOfAccountsCode attribute.
154 *
155 * @param budgetReversionChartOfAccountsCode The budgetReversionChartOfAccountsCode to set.
156 */
157 public void setBudgetReversionChartOfAccountsCode(String budgetReversionChartOfAccountsCode) {
158 this.budgetReversionChartOfAccountsCode = budgetReversionChartOfAccountsCode;
159 }
160
161
162 /**
163 * Gets the budgetReversionAccountNumber attribute.
164 *
165 * @return Returns the budgetReversionAccountNumber
166 */
167 public String getBudgetReversionAccountNumber() {
168 return budgetReversionAccountNumber;
169 }
170
171 /**
172 * Sets the budgetReversionAccountNumber attribute.
173 *
174 * @param budgetReversionAccountNumber The budgetReversionAccountNumber to set.
175 */
176 public void setBudgetReversionAccountNumber(String budgetReversionAccountNumber) {
177 this.budgetReversionAccountNumber = budgetReversionAccountNumber;
178 }
179
180
181 /**
182 * Gets the carryForwardByObjectCodeIndicator attribute.
183 *
184 * @return Returns the carryForwardByObjectCodeIndicator
185 */
186 public boolean isCarryForwardByObjectCodeIndicator() {
187 return carryForwardByObjectCodeIndicator;
188 }
189
190
191 /**
192 * Sets the carryForwardByObjectCodeIndicator attribute.
193 *
194 * @param carryForwardByObjectCodeIndicator The carryForwardByObjectCodeIndicator to set.
195 */
196 public void setCarryForwardByObjectCodeIndicator(boolean carryForwardByObjectCodeIndicator) {
197 this.carryForwardByObjectCodeIndicator = carryForwardByObjectCodeIndicator;
198 }
199
200
201 /**
202 * Gets the cashReversionFinancialChartOfAccountsCode attribute.
203 *
204 * @return Returns the cashReversionFinancialChartOfAccountsCode
205 */
206 public String getCashReversionFinancialChartOfAccountsCode() {
207 return cashReversionFinancialChartOfAccountsCode;
208 }
209
210 /**
211 * Sets the cashReversionFinancialChartOfAccountsCode attribute.
212 *
213 * @param cashReversionFinancialChartOfAccountsCode The cashReversionFinancialChartOfAccountsCode to set.
214 */
215 public void setCashReversionFinancialChartOfAccountsCode(String cashReversionFinancialChartOfAccountsCode) {
216 this.cashReversionFinancialChartOfAccountsCode = cashReversionFinancialChartOfAccountsCode;
217 }
218
219
220 /**
221 * Gets the cashReversionAccountNumber attribute.
222 *
223 * @return Returns the cashReversionAccountNumber
224 */
225 public String getCashReversionAccountNumber() {
226 return cashReversionAccountNumber;
227 }
228
229 /**
230 * Sets the cashReversionAccountNumber attribute.
231 *
232 * @param cashReversionAccountNumber The cashReversionAccountNumber to set.
233 */
234 public void setCashReversionAccountNumber(String cashReversionAccountNumber) {
235 this.cashReversionAccountNumber = cashReversionAccountNumber;
236 }
237
238
239 /**
240 * Gets the chartOfAccounts attribute.
241 *
242 * @return Returns the chartOfAccounts
243 */
244 public Chart getChartOfAccounts() {
245 return chartOfAccounts;
246 }
247
248 /**
249 * Sets the chartOfAccounts attribute.
250 *
251 * @param chartOfAccounts The chartOfAccounts to set.
252 * @deprecated
253 */
254 public void setChartOfAccounts(Chart chartOfAccounts) {
255 this.chartOfAccounts = chartOfAccounts;
256 }
257
258 /**
259 * Gets the organization attribute.
260 *
261 * @return Returns the organization
262 */
263 public List<Organization> getOrganizations() {
264 return organizations;
265 }
266
267 /**
268 * Sets the organization attribute.
269 *
270 * @param organization The organization to set.
271 * @deprecated
272 */
273 public void setOrganizations(List<Organization> organization) {
274 this.organizations = organization;
275 }
276
277 /**
278 * Gets the cashReversionAccount attribute.
279 *
280 * @return Returns the cashReversionAccount
281 */
282 public Account getCashReversionAccount() {
283 return cashReversionAccount;
284 }
285
286 /**
287 * Sets the cashReversionAccount attribute.
288 *
289 * @param cashReversionAccount The cashReversionAccount to set.
290 * @deprecated
291 */
292 public void setCashReversionAccount(Account cashReversionAccount) {
293 this.cashReversionAccount = cashReversionAccount;
294 }
295
296 /**
297 * Gets the budgetReversionAccount attribute.
298 *
299 * @return Returns the budgetReversionAccount
300 */
301 public Account getBudgetReversionAccount() {
302 return budgetReversionAccount;
303 }
304
305 /**
306 * Sets the budgetReversionAccount attribute.
307 *
308 * @param budgetReversionAccount The budgetReversionAccount to set.
309 * @deprecated
310 */
311 public void setBudgetReversionAccount(Account budgetReversionAccount) {
312 this.budgetReversionAccount = budgetReversionAccount;
313 }
314
315 /**
316 * Gets the budgetReversionChartOfAccounts attribute.
317 *
318 * @return Returns the budgetReversionChartOfAccounts
319 */
320 public Chart getBudgetReversionChartOfAccounts() {
321 return budgetReversionChartOfAccounts;
322 }
323
324 /**
325 * Sets the budgetReversionChartOfAccounts attribute.
326 *
327 * @param budgetReversionChartOfAccounts The budgetReversionChartOfAccounts to set.
328 * @deprecated
329 */
330 public void setBudgetReversionChartOfAccounts(Chart budgetReversionChartOfAccounts) {
331 this.budgetReversionChartOfAccounts = budgetReversionChartOfAccounts;
332 }
333
334 /**
335 * Gets the cashReversionFinancialChartOfAccounts attribute.
336 *
337 * @return Returns the cashReversionFinancialChartOfAccounts
338 */
339 public Chart getCashReversionFinancialChartOfAccounts() {
340 return cashReversionFinancialChartOfAccounts;
341 }
342
343 /**
344 * Sets the cashReversionFinancialChartOfAccounts attribute.
345 *
346 * @param cashReversionFinancialChartOfAccounts The cashReversionFinancialChartOfAccounts to set.
347 * @deprecated
348 */
349 public void setCashReversionFinancialChartOfAccounts(Chart cashReversionFinancialChartOfAccounts) {
350 this.cashReversionFinancialChartOfAccounts = cashReversionFinancialChartOfAccounts;
351 }
352
353
354 /**
355 * Gets the universityFiscal attribute.
356 *
357 * @return Returns the universityFiscal.
358 */
359 public SystemOptions getUniversityFiscal() {
360 return universityFiscal;
361 }
362
363 /**
364 * Sets the universityFiscal attribute value.
365 *
366 * @param universityFiscal The universityFiscal to set.
367 */
368 public void setUniversityFiscal(SystemOptions universityFiscal) {
369 this.universityFiscal = universityFiscal;
370 }
371
372 /**
373 * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
374 */
375 protected LinkedHashMap toStringMapper() {
376 LinkedHashMap m = new LinkedHashMap();
377 if (this.universityFiscalYear != null) {
378 m.put("universityFiscalYear", this.universityFiscalYear.toString());
379 }
380 m.put("chartOfAccountsCode", this.chartOfAccountsCode);
381 m.put("organizationCode", this.organizationCode);
382 return m;
383 }
384
385 public Organization getOrganization() {
386 return organization;
387 }
388
389 public void setOrganization(Organization organization) {
390 this.organization = organization;
391 }
392
393 /**
394 * This method (a hack by any other name...) returns a string so that an organization reversion can have a link to view its own
395 * inquiry page after a look up
396 *
397 * @return the String "View Organization Reversion"
398 */
399 public String getOrganizationReversionViewer() {
400 return "View Organization Reversion";
401 }
402
403 /**
404 * Gets the active attribute.
405 * @return Returns the active.
406 */
407 public boolean isActive() {
408 return active;
409 }
410
411 /**
412 * Sets the active attribute value.
413 * @param active The active to set.
414 */
415 public void setActive(boolean active) {
416 this.active = active;
417 }
418
419 /**
420 * @see org.kuali.kfs.coa.businessobject.CarryForwardReversionProcessOrganizationInfo#getCashReversionChartCashObjectCode()
421 */
422 public String getCashReversionChartCashObjectCode() {
423 if (ObjectUtils.isNull(getCashReversionFinancialChartOfAccounts())) {
424 this.refreshReferenceObject("cashReversionFinancialChartOfAccounts");
425 }
426 if (!ObjectUtils.isNull(getCashReversionFinancialChartOfAccounts())) {
427 return getCashReversionFinancialChartOfAccounts().getFinancialCashObjectCode();
428 } else {
429 return null;
430 }
431 }
432
433 /**
434 * @see org.kuali.kfs.coa.businessobject.CarryForwardReversionProcessOrganizationInfo#getOrganizationChartCashObjectCode()
435 */
436 public String getOrganizationChartCashObjectCode() {
437 if (ObjectUtils.isNull(getChartOfAccounts())) {
438 this.refreshReferenceObject("chartOfAccounts");
439 }
440 if (!ObjectUtils.isNull(getChartOfAccounts())) {
441 return getChartOfAccounts().getFinancialCashObjectCode();
442 } else {
443 return null;
444 }
445 }
446 }