View Javadoc
1   /*
2    * Copyright 2007 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.Collection;
21  import java.util.HashMap;
22  import java.util.LinkedHashMap;
23  import java.util.List;
24  import java.util.Map;
25  
26  import org.kuali.ole.coa.service.ChartService;
27  import org.kuali.ole.sys.OLEPropertyConstants;
28  import org.kuali.ole.sys.businessobject.SystemOptions;
29  import org.kuali.ole.sys.context.SpringContext;
30  import org.kuali.rice.krad.bo.DocumentHeader;
31  import org.kuali.rice.krad.bo.GlobalBusinessObject;
32  import org.kuali.rice.krad.bo.GlobalBusinessObjectDetail;
33  import org.kuali.rice.krad.bo.PersistableBusinessObject;
34  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
35  import org.kuali.rice.krad.service.BusinessObjectService;
36  
37  /**
38   * 
39   */
40  public class ObjectCodeGlobal extends PersistableBusinessObjectBase implements GlobalBusinessObject {
41  
42      private static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(ObjectCodeGlobal.class);
43  
44      private String documentNumber;
45      private Integer universityFiscalYear;
46      private String chartOfAccountsCode;
47      private String financialObjectCode;
48      private String financialObjectCodeName;
49      private String financialObjectCodeShortName;
50      private String financialObjectLevelCode;
51      private String reportsToChartOfAccountsCode;
52      private String reportsToFinancialObjectCode;
53      private String financialObjectTypeCode;
54      private String financialObjectSubTypeCode;
55      private String historicalFinancialObjectCode;
56      private boolean financialObjectActiveIndicator;
57      private String financialBudgetAggregationCd;
58      private String finObjMandatoryTrnfrOrElimCd;
59      private String financialFederalFundedCode;
60      private String nextYearFinancialObjectCode;
61  
62      private DocumentHeader financialDocument;
63      private ObjectCode financialObject;
64      private ObjectCode reportsToFinancialObject;
65      private SystemOptions universityFiscal;
66      private Chart chartOfAccounts;
67      private Chart reportsToChartOfAccounts;
68      private ObjectType financialObjectType;
69      private ObjectSubType financialObjectSubType;
70      private ObjectLevel financialObjectLevel;
71      private BudgetAggregationCode financialBudgetAggregation;
72      private MandatoryTransferEliminationCode finObjMandatoryTrnfrelim;
73      private FederalFundedCode financialFederalFunded;
74  
75      private List<ObjectCodeGlobalDetail> objectCodeGlobalDetails;
76  
77      /**
78       * Default constructor.
79       */
80      public ObjectCodeGlobal() {
81          objectCodeGlobalDetails = new ArrayList<ObjectCodeGlobalDetail>();
82      }
83  
84      /**
85       * Gets the documentNumber attribute.
86       * 
87       * @return Returns the documentNumber
88       */
89      @Override
90      public String getDocumentNumber() {
91          return documentNumber;
92      }
93  
94      /**
95       * Sets the documentNumber attribute.
96       * 
97       * @param documentNumber The documentNumber to set.
98       */
99      @Override
100     public void setDocumentNumber(String documentNumber) {
101         this.documentNumber = documentNumber;
102     }
103 
104 
105     /**
106      * Gets the universityFiscalYear attribute.
107      * 
108      * @return Returns the universityFiscalYear
109      */
110     public Integer getUniversityFiscalYear() {
111         return universityFiscalYear;
112     }
113 
114     /**
115      * Sets the universityFiscalYear attribute.
116      * 
117      * @param universityFiscalYear The universityFiscalYear to set.
118      */
119     public void setUniversityFiscalYear(Integer universityFiscalYear) {
120         this.universityFiscalYear = universityFiscalYear;
121     }
122 
123 
124     /**
125      * Gets the chartOfAccountsCode attribute.
126      * 
127      * @return Returns the chartOfAccountsCode
128      */
129     public String getChartOfAccountsCode() {
130         return chartOfAccountsCode;
131     }
132 
133     /**
134      * Sets the chartOfAccountsCode attribute.
135      * 
136      * @param chartOfAccountsCode The chartOfAccountsCode to set.
137      */
138     public void setChartOfAccountsCode(String chartOfAccountsCode) {
139         this.chartOfAccountsCode = chartOfAccountsCode;
140     }
141 
142 
143     /**
144      * Gets the financialObjectCode attribute.
145      * 
146      * @return Returns the financialObjectCode
147      */
148     public String getFinancialObjectCode() {
149         return financialObjectCode;
150     }
151 
152     /**
153      * Sets the financialObjectCode attribute.
154      * 
155      * @param financialObjectCode The financialObjectCode to set.
156      */
157     public void setFinancialObjectCode(String financialObjectCode) {
158         this.financialObjectCode = financialObjectCode;
159     }
160 
161 
162     /**
163      * Gets the financialObjectCodeName attribute.
164      * 
165      * @return Returns the financialObjectCodeName
166      */
167     public String getFinancialObjectCodeName() {
168         return financialObjectCodeName;
169     }
170 
171     /**
172      * Sets the financialObjectCodeName attribute.
173      * 
174      * @param financialObjectCodeName The financialObjectCodeName to set.
175      */
176     public void setFinancialObjectCodeName(String financialObjectCodeName) {
177         this.financialObjectCodeName = financialObjectCodeName;
178     }
179 
180 
181     /**
182      * Gets the financialObjectCodeShortName attribute.
183      * 
184      * @return Returns the financialObjectCodeShortName
185      */
186     public String getFinancialObjectCodeShortName() {
187         return financialObjectCodeShortName;
188     }
189 
190     /**
191      * Sets the financialObjectCodeShortName attribute.
192      * 
193      * @param financialObjectCodeShortName The financialObjectCodeShortName to set.
194      */
195     public void setFinancialObjectCodeShortName(String financialObjectCodeShortName) {
196         this.financialObjectCodeShortName = financialObjectCodeShortName;
197     }
198 
199 
200     /**
201      * Gets the financialObjectLevelCode attribute.
202      * 
203      * @return Returns the financialObjectLevelCode
204      */
205     public String getFinancialObjectLevelCode() {
206         return financialObjectLevelCode;
207     }
208 
209     /**
210      * Sets the financialObjectLevelCode attribute.
211      * 
212      * @param financialObjectLevelCode The financialObjectLevelCode to set.
213      */
214     public void setFinancialObjectLevelCode(String financialObjectLevelCode) {
215         this.financialObjectLevelCode = financialObjectLevelCode;
216     }
217 
218 
219     /**
220      * Gets the reportsToChartOfAccountsCode attribute.
221      * 
222      * @return Returns the reportsToChartOfAccountsCode
223      */
224     public String getReportsToChartOfAccountsCode() {
225         return reportsToChartOfAccountsCode;
226     }
227 
228     /**
229      * Sets the reportsToChartOfAccountsCode attribute.
230      * 
231      * @param reportsToChartOfAccountsCode The reportsToChartOfAccountsCode to set.
232      */
233     public void setReportsToChartOfAccountsCode(String reportsToChartOfAccountsCode) {
234         this.reportsToChartOfAccountsCode = reportsToChartOfAccountsCode;
235     }
236 
237 
238     /**
239      * Gets the reportsToFinancialObjectCode attribute.
240      * 
241      * @return Returns the reportsToFinancialObjectCode
242      */
243     public String getReportsToFinancialObjectCode() {
244         return reportsToFinancialObjectCode;
245     }
246 
247     /**
248      * Sets the reportsToFinancialObjectCode attribute.
249      * 
250      * @param reportsToFinancialObjectCode The reportsToFinancialObjectCode to set.
251      */
252     public void setReportsToFinancialObjectCode(String reportsToFinancialObjectCode) {
253         this.reportsToFinancialObjectCode = reportsToFinancialObjectCode;
254     }
255 
256 
257     /**
258      * Gets the financialObjectTypeCode attribute.
259      * 
260      * @return Returns the financialObjectTypeCode
261      */
262     public String getFinancialObjectTypeCode() {
263         return financialObjectTypeCode;
264     }
265 
266     /**
267      * Sets the financialObjectTypeCode attribute.
268      * 
269      * @param financialObjectTypeCode The financialObjectTypeCode to set.
270      */
271     public void setFinancialObjectTypeCode(String financialObjectTypeCode) {
272         this.financialObjectTypeCode = financialObjectTypeCode;
273     }
274 
275 
276     /**
277      * Gets the financialObjectSubTypeCode attribute.
278      * 
279      * @return Returns the financialObjectSubTypeCode
280      */
281     public String getFinancialObjectSubTypeCode() {
282         return financialObjectSubTypeCode;
283     }
284 
285     /**
286      * Sets the financialObjectSubTypeCode attribute.
287      * 
288      * @param financialObjectSubTypeCode The financialObjectSubTypeCode to set.
289      */
290     public void setFinancialObjectSubTypeCode(String financialObjectSubTypeCode) {
291         this.financialObjectSubTypeCode = financialObjectSubTypeCode;
292     }
293 
294 
295     /**
296      * Gets the historicalFinancialObjectCode attribute.
297      * 
298      * @return Returns the historicalFinancialObjectCode
299      */
300     public String getHistoricalFinancialObjectCode() {
301         return historicalFinancialObjectCode;
302     }
303 
304     /**
305      * Sets the historicalFinancialObjectCode attribute.
306      * 
307      * @param historicalFinancialObjectCode The historicalFinancialObjectCode to set.
308      */
309     public void setHistoricalFinancialObjectCode(String historicalFinancialObjectCode) {
310         this.historicalFinancialObjectCode = historicalFinancialObjectCode;
311     }
312 
313 
314     /**
315      * Gets the financialObjectActiveIndicator attribute.
316      * 
317      * @return Returns the financialObjectActiveIndicator
318      */
319     public boolean isFinancialObjectActiveIndicator() {
320         return financialObjectActiveIndicator;
321     }
322 
323 
324     /**
325      * Sets the financialObjectActiveIndicator attribute.
326      * 
327      * @param financialObjectActiveIndicator The financialObjectActiveIndicator to set.
328      */
329     public void setFinancialObjectActiveIndicator(boolean financialObjectActiveIndicator) {
330         this.financialObjectActiveIndicator = financialObjectActiveIndicator;
331     }
332 
333 
334     /**
335      * Gets the financialBudgetAggregationCd attribute.
336      * 
337      * @return Returns the financialBudgetAggregationCd
338      */
339     public String getFinancialBudgetAggregationCd() {
340         return financialBudgetAggregationCd;
341     }
342 
343     /**
344      * Sets the financialBudgetAggregationCd attribute.
345      * 
346      * @param financialBudgetAggregationCd The financialBudgetAggregationCd to set.
347      */
348     public void setFinancialBudgetAggregationCd(String financialBudgetAggregationCd) {
349         this.financialBudgetAggregationCd = financialBudgetAggregationCd;
350     }
351 
352 
353     /**
354      * Gets the finObjMandatoryTrnfrOrElimCd attribute.
355      * 
356      * @return Returns the finObjMandatoryTrnfrOrElimCd
357      */
358     public String getFinObjMandatoryTrnfrOrElimCd() {
359         return finObjMandatoryTrnfrOrElimCd;
360     }
361 
362     /**
363      * Sets the finObjMandatoryTrnfrOrElimCd attribute.
364      * 
365      * @param finObjMandatoryTrnfrOrElimCd The finObjMandatoryTrnfrOrElimCd to set.
366      */
367     public void setFinObjMandatoryTrnfrOrElimCd(String finObjMandatoryTrnfrOrElimCd) {
368         this.finObjMandatoryTrnfrOrElimCd = finObjMandatoryTrnfrOrElimCd;
369     }
370 
371 
372     /**
373      * Gets the financialFederalFundedCode attribute.
374      * 
375      * @return Returns the financialFederalFundedCode
376      */
377     public String getFinancialFederalFundedCode() {
378         return financialFederalFundedCode;
379     }
380 
381     /**
382      * Sets the financialFederalFundedCode attribute.
383      * 
384      * @param financialFederalFundedCode The financialFederalFundedCode to set.
385      */
386     public void setFinancialFederalFundedCode(String financialFederalFundedCode) {
387         this.financialFederalFundedCode = financialFederalFundedCode;
388     }
389 
390 
391     /**
392      * Gets the nextYearFinancialObjectCode attribute.
393      * 
394      * @return Returns the nextYearFinancialObjectCode
395      */
396     public String getNextYearFinancialObjectCode() {
397         return nextYearFinancialObjectCode;
398     }
399 
400     /**
401      * Sets the nextYearFinancialObjectCode attribute.
402      * 
403      * @param nextYearFinancialObjectCode The nextYearFinancialObjectCode to set.
404      */
405     public void setNextYearFinancialObjectCode(String nextYearFinancialObjectCode) {
406         this.nextYearFinancialObjectCode = nextYearFinancialObjectCode;
407     }
408 
409 
410     /**
411      * Gets the financialDocument attribute.
412      * 
413      * @return Returns the financialDocument
414      */
415     public DocumentHeader getFinancialDocument() {
416         return financialDocument;
417     }
418 
419     /**
420      * Sets the financialDocument attribute.
421      * 
422      * @param financialDocument The financialDocument to set.
423      * @deprecated
424      */
425     @Deprecated
426     public void setFinancialDocument(DocumentHeader financialDocument) {
427         this.financialDocument = financialDocument;
428     }
429 
430     /**
431      * Gets the financialObject attribute.
432      * 
433      * @return Returns the financialObject
434      */
435     public ObjectCode getFinancialObject() {
436         return financialObject;
437     }
438 
439     /**
440      * Sets the financialObject attribute.
441      * 
442      * @param financialObject The financialObject to set.
443      * @deprecated
444      */
445     @Deprecated
446     public void setFinancialObject(ObjectCode financialObject) {
447         this.financialObject = financialObject;
448     }
449 
450     /**
451      * Gets the reportsToFinancialObject attribute.
452      * 
453      * @return Returns the reportsToFinancialObject
454      */
455     public ObjectCode getReportsToFinancialObject() {
456         return reportsToFinancialObject;
457     }
458 
459     /**
460      * Sets the reportsToFinancialObject attribute.
461      * 
462      * @param reportsToFinancialObject The reportsToFinancialObject to set.
463      * @deprecated
464      */
465     @Deprecated
466     public void setReportsToFinancialObject(ObjectCode reportsToFinancialObject) {
467         this.reportsToFinancialObject = reportsToFinancialObject;
468     }
469 
470     /**
471      * Gets the universityFiscal attribute.
472      * 
473      * @return Returns the universityFiscal
474      */
475     public SystemOptions getUniversityFiscal() {
476         return universityFiscal;
477     }
478 
479     /**
480      * Sets the universityFiscal attribute.
481      * 
482      * @param universityFiscal The universityFiscal to set.
483      * @deprecated
484      */
485     @Deprecated
486     public void setUniversityFiscal(SystemOptions universityFiscal) {
487         this.universityFiscal = universityFiscal;
488     }
489 
490     /**
491      * Gets the chartOfAccounts attribute.
492      * 
493      * @return Returns the chartOfAccounts
494      */
495     public Chart getChartOfAccounts() {
496         return chartOfAccounts;
497     }
498 
499     /**
500      * Sets the chartOfAccounts attribute.
501      * 
502      * @param chartOfAccounts The chartOfAccounts to set.
503      * @deprecated
504      */
505     @Deprecated
506     public void setChartOfAccounts(Chart chartOfAccounts) {
507         this.chartOfAccounts = chartOfAccounts;
508     }
509 
510     /**
511      * Gets the reportsToChartOfAccounts attribute.
512      * 
513      * @return Returns the reportsToChartOfAccounts
514      */
515     public Chart getReportsToChartOfAccounts() {
516         return reportsToChartOfAccounts;
517     }
518 
519     /**
520      * Sets the reportsToChartOfAccounts attribute.
521      * 
522      * @param reportsToChartOfAccounts The reportsToChartOfAccounts to set.
523      * @deprecated
524      */
525     @Deprecated
526     public void setReportsToChartOfAccounts(Chart reportsToChartOfAccounts) {
527         this.reportsToChartOfAccounts = reportsToChartOfAccounts;
528     }
529 
530     /**
531      * This method returns the FinancialObjectSubType attribute.
532      * 
533      * @return Returns FinancialObjectSubType attribute.
534      */
535     public ObjectSubType getFinancialObjectSubType() {
536         return financialObjectSubType;
537     }
538 
539     /**
540      * This method sets the FinancialObjectSubType attribute.
541      * 
542      * @param financialObjectSubType The financialObjectSubType to set.
543      * @deprecated
544      */
545     @Deprecated
546     public void setFinancialObjectSubType(ObjectSubType financialObjectSubType) {
547         this.financialObjectSubType = financialObjectSubType;
548     }
549 
550     /**
551      * This method returns the FinancialObjectType
552      * 
553      * @return an ObjectType for this ObjectCodeGlobal.
554      */
555     public ObjectType getFinancialObjectType() {
556         return financialObjectType;
557     }
558 
559     /**
560      * This method sets a FinancialObjectType
561      * 
562      * @param financialObjectType the ObjectType to set.
563      * @deprecated
564      */
565     @Deprecated
566     public void setFinancialObjectType(ObjectType financialObjectType) {
567         this.financialObjectType = financialObjectType;
568     }
569 
570     /**
571      * This method returns the FinancialBudgetAggregation
572      * 
573      * @return the FinancialBudgetAggregation
574      */
575     public BudgetAggregationCode getFinancialBudgetAggregation() {
576         return financialBudgetAggregation;
577     }
578 
579     /**
580      * This method sets a FinancialBudgetAggregation
581      * 
582      * @param financialBudgetAggregation the BudgetAggregationCode to set
583      * @deprecated
584      */
585     @Deprecated
586     public void setFinancialBudgetAggregation(BudgetAggregationCode financialBudgetAggregation) {
587         this.financialBudgetAggregation = financialBudgetAggregation;
588     }
589 
590     /**
591      * This method the financial federal funded code for this ObjectCodeGlobal
592      * 
593      * @return the Federal Funded Code
594      */
595     public FederalFundedCode getFinancialFederalFunded() {
596         return financialFederalFunded;
597     }
598 
599     /**
600      * This method sets FinancialFederalFunded
601      * 
602      * @param financialFederalFunded the FederalFundedCode to set
603      * @deprecated
604      */
605     @Deprecated
606     public void setFinancialFederalFunded(FederalFundedCode financialFederalFunded) {
607         this.financialFederalFunded = financialFederalFunded;
608     }
609 
610     /**
611      * This method returns the Object Level
612      * 
613      * @return ObjectLevel
614      */
615     public ObjectLevel getFinancialObjectLevel() {
616         return financialObjectLevel;
617     }
618 
619     /**
620      * This method sets the FinancialObjectLevel
621      * 
622      * @param financialObjectLevel the ObjLevel to set
623      * @deprecated
624      */
625     @Deprecated
626     public void setFinancialObjectLevel(ObjectLevel financialObjectLevel) {
627         this.financialObjectLevel = financialObjectLevel;
628     }
629 
630     /**
631      * This method returns the Mandatory Transfer or Elimination Code
632      * 
633      * @return the MandatoryTransferEliminationCode
634      */
635     public MandatoryTransferEliminationCode getFinObjMandatoryTrnfrelim() {
636         return finObjMandatoryTrnfrelim;
637     }
638 
639     /**
640      * This method pretty much sets the FinObjMandatoryTrnfrelm (the Mandatory Transfer or Elimination Code)
641      * 
642      * @param finObjMandatoryTrnfrelim the MandatoryTransferEliminationCode to set
643      * @deprecated
644      */
645     @Deprecated
646     public void setFinObjMandatoryTrnfrelim(MandatoryTransferEliminationCode finObjMandatoryTrnfrelim) {
647         this.finObjMandatoryTrnfrelim = finObjMandatoryTrnfrelim;
648     }
649 
650     /**
651      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
652      */
653     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
654         LinkedHashMap<String,String> m = new LinkedHashMap<String,String>();
655         m.put(OLEPropertyConstants.DOCUMENT_NUMBER, this.documentNumber);
656         return m;
657     }
658 
659     public List<ObjectCodeGlobalDetail> getObjectCodeGlobalDetails() {
660         return objectCodeGlobalDetails;
661     }
662 
663     public void setObjectCodeGlobalDetails(List<ObjectCodeGlobalDetail> objectCodeGlobalDetails) {
664         this.objectCodeGlobalDetails = objectCodeGlobalDetails;
665     }
666 
667     /**
668      * @see org.kuali.rice.krad.document.GlobalBusinessObject#getGlobalChangesToDelete()
669      */
670     @Override
671     public List<PersistableBusinessObject> generateDeactivationsToPersist() {
672         return null;
673     }
674 
675     /**
676      * This returns a list of Object Codes to Update and/or Add
677      * 
678      * @see org.kuali.rice.krad.document.GlobalBusinessObject#applyGlobalChanges()
679      */
680     @Override
681     public List<PersistableBusinessObject> generateGlobalChangesToPersist() {
682         LOG.debug("applyGlobalChanges");
683         List<PersistableBusinessObject> persistables = new ArrayList<PersistableBusinessObject>();
684 
685         // Iterate through Object Codes; create new or update as necessary
686         // Set reports-to Chart to appropriate value
687 
688         for (ObjectCodeGlobalDetail detail : objectCodeGlobalDetails) {
689 
690             Map pk = new HashMap();
691 
692             Integer fiscalYear = detail.getUniversityFiscalYear();
693             String chart = detail.getChartOfAccountsCode();
694 
695             if (fiscalYear != null && chart != null && chart.length() > 0) {
696                 pk.put("UNIV_FISCAL_YR", fiscalYear);
697                 pk.put("FIN_COA_CD", chart);
698                 pk.put("FIN_OBJECT_CD", financialObjectCode);
699 
700                 ObjectCode objectCode = SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(ObjectCode.class, pk);
701                 if (objectCode == null) {
702                     objectCode = new ObjectCode(fiscalYear, chart, financialObjectCode);
703                     objectCode.setFinancialObjectActiveCode(true);
704                 }
705                 populate(objectCode, detail);
706                 Map<String, String> hierarchy = SpringContext.getBean(ChartService.class).getReportsToHierarchy();
707                 objectCode.setReportsToChartOfAccountsCode(hierarchy.get(chart));
708 
709                 persistables.add(objectCode);
710             }
711         }
712 
713         return persistables;
714     }
715 
716     public void populate(ObjectCode old, ObjectCodeGlobalDetail detail) {
717 
718         old.setFinancialObjectCodeName(update(financialObjectCodeName, old.getFinancialObjectCodeName()));
719         old.setFinancialObjectCodeShortName(update(financialObjectCodeShortName, old.getFinancialObjectCodeShortName()));
720 
721         old.setFinancialObjectLevelCode(update(financialObjectLevelCode, old.getFinancialObjectLevelCode()));
722         old.setFinancialObjectTypeCode(update(financialObjectTypeCode, old.getFinancialObjectTypeCode()));
723         old.setFinancialObjectSubTypeCode(update(financialObjectSubTypeCode, old.getFinancialObjectSubTypeCode()));
724         old.setHistoricalFinancialObjectCode(update(historicalFinancialObjectCode, old.getHistoricalFinancialObjectCode()));
725         old.setFinancialObjectActiveCode(update(financialObjectActiveIndicator, old.isFinancialObjectActiveCode()));
726         old.setFinancialBudgetAggregationCd(update(financialBudgetAggregationCd, old.getFinancialBudgetAggregationCd()));
727         old.setFinObjMandatoryTrnfrelimCd(update(finObjMandatoryTrnfrOrElimCd, old.getFinObjMandatoryTrnfrelimCd()));
728         old.setFinancialFederalFundedCode(update(financialFederalFundedCode, old.getFinancialFederalFundedCode()));
729         old.setNextYearFinancialObjectCode(update(nextYearFinancialObjectCode, old.getNextYearFinancialObjectCode()));
730         old.setReportsToFinancialObjectCode(update(reportsToFinancialObjectCode, old.getReportsToFinancialObjectCode()));
731     }
732 
733 
734     /**
735      * This method returns newvalue iff it is not empty
736      * 
737      * @param oldValue
738      * @param newValue
739      * @return
740      */
741     private String update(String newValue, String oldValue) {
742         if (newValue == null || newValue.length() == 0) {
743             return oldValue;
744         }
745         return newValue;
746     }
747 
748     private boolean update(boolean newValue, boolean oldValue) {
749         return newValue;
750     }
751 
752 
753     @Override
754     public boolean isPersistable() {
755         return true;
756     }
757 
758     @Override
759     public List<? extends GlobalBusinessObjectDetail> getAllDetailObjects() {
760         return getObjectCodeGlobalDetails();
761     }
762 
763     /**
764      * @see org.kuali.rice.krad.bo.PersistableBusinessObjectBase#buildListOfDeletionAwareLists()
765      */
766     @Override
767     public List<Collection<PersistableBusinessObject>> buildListOfDeletionAwareLists() {
768         List<Collection<PersistableBusinessObject>> managedLists = super.buildListOfDeletionAwareLists();
769 
770         managedLists.add( new ArrayList<PersistableBusinessObject>( getObjectCodeGlobalDetails() ) );
771 
772         return managedLists;
773     }
774 }