View Javadoc
1   /*
2    * The Kuali Financial System, a comprehensive financial management system for higher education.
3    * 
4    * Copyright 2005-2014 The Kuali Foundation
5    * 
6    * This program is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU Affero General Public License as
8    * published by the Free Software Foundation, either version 3 of the
9    * License, or (at your option) any later version.
10   * 
11   * This program is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU Affero General Public License for more details.
15   * 
16   * You should have received a copy of the GNU Affero General Public License
17   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package org.kuali.kfs.coa.businessobject;
21  
22  import java.util.ArrayList;
23  import java.util.LinkedHashMap;
24  import java.util.List;
25  
26  import org.kuali.kfs.sys.businessobject.FiscalYearBasedBusinessObject;
27  import org.kuali.kfs.sys.businessobject.SystemOptions;
28  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
29  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
30  import org.kuali.rice.krad.util.ObjectUtils;
31  
32  /**
33   * 
34   */
35  public class OrganizationReversion extends PersistableBusinessObjectBase implements MutableInactivatable, CarryForwardReversionProcessOrganizationInfo, FiscalYearBasedBusinessObject {
36  
37      private Integer universityFiscalYear;
38      private String chartOfAccountsCode;
39      private String organizationCode;
40      private String budgetReversionChartOfAccountsCode;
41      private String budgetReversionAccountNumber;
42      private boolean carryForwardByObjectCodeIndicator;
43      private String cashReversionFinancialChartOfAccountsCode;
44      private String cashReversionAccountNumber;
45      private Chart chartOfAccounts;
46      private Account cashReversionAccount;
47      private Account budgetReversionAccount;
48      private Chart budgetReversionChartOfAccounts;
49      private Chart cashReversionFinancialChartOfAccounts;
50      private SystemOptions universityFiscal;
51      private Organization organization;
52      private List<Organization> organizations; // This is only used by the "global" document
53      private List<OrganizationReversionDetail> organizationReversionDetail;
54      private boolean active;
55  
56      /**
57       * Default constructor.
58       */
59      public OrganizationReversion() {
60          organizations = new ArrayList<Organization>();
61          organizationReversionDetail = new ArrayList<OrganizationReversionDetail>();
62      }   
63  
64      public List<OrganizationReversionDetail> getOrganizationReversionDetail() {
65          return organizationReversionDetail;
66      }
67  
68      public void addOrganizationReversionDetail(OrganizationReversionDetail ord) {
69          organizationReversionDetail.add(ord);
70      }
71  
72      public void setOrganizationReversionDetail(List<OrganizationReversionDetail> organizationReversionDetail) {
73          this.organizationReversionDetail = organizationReversionDetail;
74      }
75  
76      public OrganizationReversionCategoryInfo getOrganizationReversionDetail(String categoryCode) {
77          for (OrganizationReversionDetail element : organizationReversionDetail) {
78              if (element.getOrganizationReversionCategoryCode().equals(categoryCode)) {
79                  if (!element.isActive()) {
80                      return null; // don't send back inactive details
81                  } else {
82                      return element;
83                  }
84              }
85          }
86          return null;
87      }
88  
89      /**
90       * Gets the universityFiscalYear attribute.
91       * 
92       * @return Returns the universityFiscalYear
93       */
94      public Integer getUniversityFiscalYear() {
95          return universityFiscalYear;
96      }
97  
98      /**
99       * Sets the universityFiscalYear attribute.
100      * 
101      * @param universityFiscalYear The universityFiscalYear to set.
102      */
103     public void setUniversityFiscalYear(Integer universityFiscalYear) {
104         this.universityFiscalYear = universityFiscalYear;
105     }
106 
107 
108     /**
109      * Gets the chartOfAccountsCode attribute.
110      * 
111      * @return Returns the chartOfAccountsCode
112      */
113     public String getChartOfAccountsCode() {
114         return chartOfAccountsCode;
115     }
116 
117     /**
118      * Sets the chartOfAccountsCode attribute.
119      * 
120      * @param chartOfAccountsCode The chartOfAccountsCode to set.
121      */
122     public void setChartOfAccountsCode(String chartOfAccountsCode) {
123         this.chartOfAccountsCode = chartOfAccountsCode;
124     }
125 
126 
127     /**
128      * Gets the organizationCode attribute.
129      * 
130      * @return Returns the organizationCode
131      */
132     public String getOrganizationCode() {
133         return organizationCode;
134     }
135 
136     /**
137      * Sets the organizationCode attribute.
138      * 
139      * @param organizationCode The organizationCode to set.
140      */
141     public void setOrganizationCode(String organizationCode) {
142         this.organizationCode = organizationCode;
143     }
144 
145 
146     /**
147      * Gets the budgetReversionChartOfAccountsCode attribute.
148      * 
149      * @return Returns the budgetReversionChartOfAccountsCode
150      */
151     public String getBudgetReversionChartOfAccountsCode() {
152         return budgetReversionChartOfAccountsCode;
153     }
154 
155     /**
156      * Sets the budgetReversionChartOfAccountsCode attribute.
157      * 
158      * @param budgetReversionChartOfAccountsCode The budgetReversionChartOfAccountsCode to set.
159      */
160     public void setBudgetReversionChartOfAccountsCode(String budgetReversionChartOfAccountsCode) {
161         this.budgetReversionChartOfAccountsCode = budgetReversionChartOfAccountsCode;
162     }
163 
164 
165     /**
166      * Gets the budgetReversionAccountNumber attribute.
167      * 
168      * @return Returns the budgetReversionAccountNumber
169      */
170     public String getBudgetReversionAccountNumber() {
171         return budgetReversionAccountNumber;
172     }
173 
174     /**
175      * Sets the budgetReversionAccountNumber attribute.
176      * 
177      * @param budgetReversionAccountNumber The budgetReversionAccountNumber to set.
178      */
179     public void setBudgetReversionAccountNumber(String budgetReversionAccountNumber) {
180         this.budgetReversionAccountNumber = budgetReversionAccountNumber;
181     }
182 
183 
184     /**
185      * Gets the carryForwardByObjectCodeIndicator attribute.
186      * 
187      * @return Returns the carryForwardByObjectCodeIndicator
188      */
189     public boolean isCarryForwardByObjectCodeIndicator() {
190         return carryForwardByObjectCodeIndicator;
191     }
192 
193 
194     /**
195      * Sets the carryForwardByObjectCodeIndicator attribute.
196      * 
197      * @param carryForwardByObjectCodeIndicator The carryForwardByObjectCodeIndicator to set.
198      */
199     public void setCarryForwardByObjectCodeIndicator(boolean carryForwardByObjectCodeIndicator) {
200         this.carryForwardByObjectCodeIndicator = carryForwardByObjectCodeIndicator;
201     }
202 
203 
204     /**
205      * Gets the cashReversionFinancialChartOfAccountsCode attribute.
206      * 
207      * @return Returns the cashReversionFinancialChartOfAccountsCode
208      */
209     public String getCashReversionFinancialChartOfAccountsCode() {
210         return cashReversionFinancialChartOfAccountsCode;
211     }
212 
213     /**
214      * Sets the cashReversionFinancialChartOfAccountsCode attribute.
215      * 
216      * @param cashReversionFinancialChartOfAccountsCode The cashReversionFinancialChartOfAccountsCode to set.
217      */
218     public void setCashReversionFinancialChartOfAccountsCode(String cashReversionFinancialChartOfAccountsCode) {
219         this.cashReversionFinancialChartOfAccountsCode = cashReversionFinancialChartOfAccountsCode;
220     }
221 
222 
223     /**
224      * Gets the cashReversionAccountNumber attribute.
225      * 
226      * @return Returns the cashReversionAccountNumber
227      */
228     public String getCashReversionAccountNumber() {
229         return cashReversionAccountNumber;
230     }
231 
232     /**
233      * Sets the cashReversionAccountNumber attribute.
234      * 
235      * @param cashReversionAccountNumber The cashReversionAccountNumber to set.
236      */
237     public void setCashReversionAccountNumber(String cashReversionAccountNumber) {
238         this.cashReversionAccountNumber = cashReversionAccountNumber;
239     }
240 
241 
242     /**
243      * Gets the chartOfAccounts attribute.
244      * 
245      * @return Returns the chartOfAccounts
246      */
247     public Chart getChartOfAccounts() {
248         return chartOfAccounts;
249     }
250 
251     /**
252      * Sets the chartOfAccounts attribute.
253      * 
254      * @param chartOfAccounts The chartOfAccounts to set.
255      * @deprecated
256      */
257     public void setChartOfAccounts(Chart chartOfAccounts) {
258         this.chartOfAccounts = chartOfAccounts;
259     }
260 
261     /**
262      * Gets the organization attribute.
263      * 
264      * @return Returns the organization
265      */
266     public List<Organization> getOrganizations() {
267         return organizations;
268     }
269 
270     /**
271      * Sets the organization attribute.
272      * 
273      * @param organization The organization to set.
274      * @deprecated
275      */
276     public void setOrganizations(List<Organization> organization) {
277         this.organizations = organization;
278     }
279 
280     /**
281      * Gets the cashReversionAccount attribute.
282      * 
283      * @return Returns the cashReversionAccount
284      */
285     public Account getCashReversionAccount() {
286         return cashReversionAccount;
287     }
288 
289     /**
290      * Sets the cashReversionAccount attribute.
291      * 
292      * @param cashReversionAccount The cashReversionAccount to set.
293      * @deprecated
294      */
295     public void setCashReversionAccount(Account cashReversionAccount) {
296         this.cashReversionAccount = cashReversionAccount;
297     }
298 
299     /**
300      * Gets the budgetReversionAccount attribute.
301      * 
302      * @return Returns the budgetReversionAccount
303      */
304     public Account getBudgetReversionAccount() {
305         return budgetReversionAccount;
306     }
307 
308     /**
309      * Sets the budgetReversionAccount attribute.
310      * 
311      * @param budgetReversionAccount The budgetReversionAccount to set.
312      * @deprecated
313      */
314     public void setBudgetReversionAccount(Account budgetReversionAccount) {
315         this.budgetReversionAccount = budgetReversionAccount;
316     }
317 
318     /**
319      * Gets the budgetReversionChartOfAccounts attribute.
320      * 
321      * @return Returns the budgetReversionChartOfAccounts
322      */
323     public Chart getBudgetReversionChartOfAccounts() {
324         return budgetReversionChartOfAccounts;
325     }
326 
327     /**
328      * Sets the budgetReversionChartOfAccounts attribute.
329      * 
330      * @param budgetReversionChartOfAccounts The budgetReversionChartOfAccounts to set.
331      * @deprecated
332      */
333     public void setBudgetReversionChartOfAccounts(Chart budgetReversionChartOfAccounts) {
334         this.budgetReversionChartOfAccounts = budgetReversionChartOfAccounts;
335     }
336 
337     /**
338      * Gets the cashReversionFinancialChartOfAccounts attribute.
339      * 
340      * @return Returns the cashReversionFinancialChartOfAccounts
341      */
342     public Chart getCashReversionFinancialChartOfAccounts() {
343         return cashReversionFinancialChartOfAccounts;
344     }
345 
346     /**
347      * Sets the cashReversionFinancialChartOfAccounts attribute.
348      * 
349      * @param cashReversionFinancialChartOfAccounts The cashReversionFinancialChartOfAccounts to set.
350      * @deprecated
351      */
352     public void setCashReversionFinancialChartOfAccounts(Chart cashReversionFinancialChartOfAccounts) {
353         this.cashReversionFinancialChartOfAccounts = cashReversionFinancialChartOfAccounts;
354     }
355 
356 
357     /**
358      * Gets the universityFiscal attribute.
359      * 
360      * @return Returns the universityFiscal.
361      */
362     public SystemOptions getUniversityFiscal() {
363         return universityFiscal;
364     }
365 
366     /**
367      * Sets the universityFiscal attribute value.
368      * 
369      * @param universityFiscal The universityFiscal to set.
370      */
371     public void setUniversityFiscal(SystemOptions universityFiscal) {
372         this.universityFiscal = universityFiscal;
373     }
374 
375     /**
376      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
377      */
378     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
379         LinkedHashMap m = new LinkedHashMap();
380         if (this.universityFiscalYear != null) {
381             m.put("universityFiscalYear", this.universityFiscalYear.toString());
382         }
383         m.put("chartOfAccountsCode", this.chartOfAccountsCode);
384         m.put("organizationCode", this.organizationCode);
385         return m;
386     }
387 
388     public Organization getOrganization() {
389         return organization;
390     }
391 
392     public void setOrganization(Organization organization) {
393         this.organization = organization;
394     }
395 
396     /**
397      * This method (a hack by any other name...) returns a string so that an organization reversion can have a link to view its own
398      * inquiry page after a look up
399      * 
400      * @return the String "View Organization Reversion"
401      */
402     public String getOrganizationReversionViewer() {
403         return "View Organization Reversion";
404     }
405 
406     /**
407      * Gets the active attribute. 
408      * @return Returns the active.
409      */
410     public boolean isActive() {
411         return active;
412     }
413 
414     /**
415      * Sets the active attribute value.
416      * @param active The active to set.
417      */
418     public void setActive(boolean active) {
419         this.active = active;
420     }
421 
422     /**
423      * @see org.kuali.kfs.coa.businessobject.CarryForwardReversionProcessOrganizationInfo#getCashReversionChartCashObjectCode()
424      */
425     public String getCashReversionChartCashObjectCode() {
426         if (ObjectUtils.isNull(getCashReversionFinancialChartOfAccounts())) {
427             this.refreshReferenceObject("cashReversionFinancialChartOfAccounts");
428         }
429         if (!ObjectUtils.isNull(getCashReversionFinancialChartOfAccounts())) {
430             return getCashReversionFinancialChartOfAccounts().getFinancialCashObjectCode();
431         } else {
432             return null;
433         }
434     }
435 
436     /**
437      * @see org.kuali.kfs.coa.businessobject.CarryForwardReversionProcessOrganizationInfo#getOrganizationChartCashObjectCode()
438      */
439     public String getOrganizationChartCashObjectCode() {
440         if (ObjectUtils.isNull(getChartOfAccounts())) {
441             this.refreshReferenceObject("chartOfAccounts");
442         }
443         if (!ObjectUtils.isNull(getChartOfAccounts())) {
444             return getChartOfAccounts().getFinancialCashObjectCode();
445         } else {
446             return null;
447         }
448     }
449 }