View Javadoc
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  
17  package org.kuali.ole.coa.businessobject;
18  
19  import java.util.ArrayList;
20  import java.util.LinkedHashMap;
21  import java.util.List;
22  
23  import org.kuali.ole.sys.businessobject.FiscalYearBasedBusinessObject;
24  import org.kuali.ole.sys.businessobject.SystemOptions;
25  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
26  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
27  import org.kuali.rice.krad.util.ObjectUtils;
28  
29  /**
30   * 
31   */
32  public class OrganizationReversion extends PersistableBusinessObjectBase implements MutableInactivatable, CarryForwardReversionProcessOrganizationInfo, FiscalYearBasedBusinessObject {
33  
34      private Integer universityFiscalYear;
35      private String chartOfAccountsCode;
36      private String organizationCode;
37      private String budgetReversionChartOfAccountsCode;
38      private String budgetReversionAccountNumber;
39      private boolean carryForwardByObjectCodeIndicator;
40      private String cashReversionFinancialChartOfAccountsCode;
41      private String cashReversionAccountNumber;
42      private Chart chartOfAccounts;
43      private Account cashReversionAccount;
44      private Account budgetReversionAccount;
45      private Chart budgetReversionChartOfAccounts;
46      private Chart cashReversionFinancialChartOfAccounts;
47      private SystemOptions universityFiscal;
48      private Organization organization;
49      private List<Organization> organizations; // This is only used by the "global" document
50      private List<OrganizationReversionDetail> organizationReversionDetail;
51      private boolean active;
52  
53      /**
54       * Default constructor.
55       */
56      public OrganizationReversion() {
57          organizations = new ArrayList<Organization>();
58          organizationReversionDetail = new ArrayList<OrganizationReversionDetail>();
59      }   
60  
61      public List<OrganizationReversionDetail> getOrganizationReversionDetail() {
62          return organizationReversionDetail;
63      }
64  
65      public void addOrganizationReversionDetail(OrganizationReversionDetail ord) {
66          organizationReversionDetail.add(ord);
67      }
68  
69      public void setOrganizationReversionDetail(List<OrganizationReversionDetail> organizationReversionDetail) {
70          this.organizationReversionDetail = organizationReversionDetail;
71      }
72  
73      public OrganizationReversionCategoryInfo getOrganizationReversionDetail(String categoryCode) {
74          for (OrganizationReversionDetail element : organizationReversionDetail) {
75              if (element.getOrganizationReversionCategoryCode().equals(categoryCode)) {
76                  if (!element.isActive()) {
77                      return null; // don't send back inactive details
78                  } else {
79                      return element;
80                  }
81              }
82          }
83          return null;
84      }
85  
86      /**
87       * Gets the universityFiscalYear attribute.
88       * 
89       * @return Returns the universityFiscalYear
90       */
91      public Integer getUniversityFiscalYear() {
92          return universityFiscalYear;
93      }
94  
95      /**
96       * Sets the universityFiscalYear attribute.
97       * 
98       * @param universityFiscalYear The universityFiscalYear to set.
99       */
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.krad.bo.BusinessObjectBase#toStringMapper()
374      */
375     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
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.ole.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.ole.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 }