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  package org.kuali.ole.coa.businessobject;
17  
18  import java.sql.Date;
19  import java.util.HashMap;
20  import java.util.HashSet;
21  import java.util.Map;
22  import java.util.Properties;
23  import java.util.Set;
24  
25  import org.apache.commons.lang.StringUtils;
26  import org.apache.log4j.Logger;
27  import org.kuali.ole.coa.service.OrganizationService;
28  import org.kuali.ole.sys.OLEConstants;
29  import org.kuali.ole.sys.context.SpringContext;
30  import org.kuali.rice.core.api.config.property.ConfigurationService;
31  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
32  import org.kuali.rice.kim.api.identity.Person;
33  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
34  import org.kuali.rice.krad.service.KualiModuleService;
35  import org.kuali.rice.krad.service.ModuleService;
36  import org.kuali.rice.krad.util.UrlFactory;
37  import org.kuali.rice.location.api.LocationConstants;
38  import org.kuali.rice.location.framework.campus.CampusEbo;
39  import org.kuali.rice.location.framework.country.CountryEbo;
40  import org.kuali.rice.location.framework.postalcode.PostalCodeEbo;
41  
42  /**
43   *
44   */
45  public class Organization extends PersistableBusinessObjectBase implements MutableInactivatable {
46      private static final Logger LOG = Logger.getLogger(Organization.class);
47  
48      private static final long serialVersionUID = 121873645110037203L;
49  
50      public static final String CACHE_NAME = OLEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Organization";
51  
52      protected String organizationCode;
53      protected String organizationName;
54      protected String organizationCityName;
55      protected String organizationStateCode;
56      protected String organizationZipCode;
57      protected Date organizationBeginDate;
58      protected Date organizationEndDate;
59      protected boolean organizationInFinancialProcessingIndicator = false;
60      protected String organizationManagerUniversalId;
61      protected String responsibilityCenterCode;
62      protected String organizationPhysicalCampusCode;
63      protected String organizationTypeCode;
64      protected String reportsToChartOfAccountsCode;
65      protected String reportsToOrganizationCode;
66      protected String organizationPlantAccountNumber;
67      protected String campusPlantAccountNumber;
68      protected String organizationPlantChartCode;
69      protected String campusPlantChartCode;
70      protected String organizationCountryCode;
71      protected String organizationLine1Address;
72      protected String organizationLine2Address;
73  
74      protected Chart chartOfAccounts;
75      protected Organization hrisOrganization;
76      protected Account organizationDefaultAccount;
77      protected Person organizationManagerUniversal;
78      protected ResponsibilityCenter responsibilityCenter;
79      protected CampusEbo organizationPhysicalCampus;
80      protected OrganizationType organizationType;
81      protected Organization reportsToOrganization;
82      protected Chart reportsToChartOfAccounts;
83      protected Account organizationPlantAccount;
84      protected Account campusPlantAccount;
85      protected Chart organizationPlantChart;
86      protected Chart campusPlantChart;
87      protected PostalCodeEbo postalZip;
88      protected CountryEbo organizationCountry;
89  
90      // HRMS Org fields
91      protected OrganizationExtension organizationExtension;
92      protected String editHrmsUnitSectionBlank;
93      protected String editHrmsUnitSection;
94  
95      // fields for mixed anonymous keys
96      protected String organizationDefaultAccountNumber;
97      protected String chartOfAccountsCode;
98  
99      // Several kinds of Dummy Attributes for dividing sections on Inquiry page
100     protected String editPlantAccountsSectionBlank;
101     protected String editPlantAccountsSection;
102 
103     protected boolean active = true;
104 
105     /**
106      * Gets the organizationCode attribute.
107      *
108      * @return Returns the organizationCode
109      */
110     public String getOrganizationCode() {
111         return organizationCode;
112     }
113 
114     /**
115      * Sets the organizationCode attribute.
116      *
117      * @param organizationCode The organizationCode to set.
118      */
119     public void setOrganizationCode(String organizationCode) {
120         this.organizationCode = organizationCode;
121     }
122 
123     /**
124      * Gets the organizationName attribute.
125      *
126      * @return Returns the organizationName
127      */
128     public String getOrganizationName() {
129         return organizationName;
130     }
131 
132     /**
133      * Sets the organizationName attribute.
134      *
135      * @param organizationName The organizationName to set.
136      */
137     public void setOrganizationName(String organizationName) {
138         this.organizationName = organizationName;
139     }
140 
141     /**
142      * Gets the organizationCityName attribute.
143      *
144      * @return Returns the organizationCityName
145      */
146     public String getOrganizationCityName() {
147         return organizationCityName;
148     }
149 
150     /**
151      * Sets the organizationCityName attribute.
152      *
153      * @param organizationCityName The organizationCityName to set.
154      */
155     public void setOrganizationCityName(String organizationCityName) {
156         this.organizationCityName = organizationCityName;
157     }
158 
159     /**
160      * Gets the organizationStateCode attribute.
161      *
162      * @return Returns the organizationStateCode
163      */
164     public String getOrganizationStateCode() {
165         return organizationStateCode;
166     }
167 
168     /**
169      * Sets the organizationStateCode attribute.
170      *
171      * @param organizationStateCode The organizationStateCode to set.
172      */
173     public void setOrganizationStateCode(String organizationStateCode) {
174         this.organizationStateCode = organizationStateCode;
175     }
176 
177     /**
178      * Gets the organizationZipCode attribute.
179      *
180      * @return Returns the organizationZipCode
181      */
182     public String getOrganizationZipCode() {
183         return organizationZipCode;
184     }
185 
186     /**
187      * Sets the organizationZipCode attribute.
188      *
189      * @param organizationZipCode The organizationZipCode to set.
190      */
191     public void setOrganizationZipCode(String organizationZipCode) {
192         this.organizationZipCode = organizationZipCode;
193     }
194 
195     /**
196      * Gets the organizationBeginDate attribute.
197      *
198      * @return Returns the organizationBeginDate
199      */
200     public Date getOrganizationBeginDate() {
201         return organizationBeginDate;
202     }
203 
204     /**
205      * Sets the organizationBeginDate attribute.
206      *
207      * @param organizationBeginDate The organizationBeginDate to set.
208      */
209     public void setOrganizationBeginDate(Date organizationBeginDate) {
210         this.organizationBeginDate = organizationBeginDate;
211     }
212 
213     /**
214      * Gets the organizationEndDate attribute.
215      *
216      * @return Returns the organizationEndDate
217      */
218     public Date getOrganizationEndDate() {
219         return organizationEndDate;
220     }
221 
222     /**
223      * Sets the organizationEndDate attribute.
224      *
225      * @param organizationEndDate The organizationEndDate to set.
226      */
227     public void setOrganizationEndDate(Date organizationEndDate) {
228         this.organizationEndDate = organizationEndDate;
229     }
230 
231     /**
232      * Gets the organizationInFinancialProcessingIndicator attribute.
233      *
234      * @return Returns the organizationInFinancialProcessingIndicator
235      */
236     public boolean isOrganizationInFinancialProcessingIndicator() {
237         return organizationInFinancialProcessingIndicator;
238     }
239 
240     /**
241      * Sets the organizationInFinancialProcessingIndicator attribute.
242      *
243      * @param organizationInFinancialProcessingIndicator The organizationInFinancialProcessingIndicator to set.
244      */
245     public void setOrganizationInFinancialProcessingIndicator(boolean organizationInFinancialProcessingIndicator) {
246         this.organizationInFinancialProcessingIndicator = organizationInFinancialProcessingIndicator;
247     }
248 
249     /**
250      * Gets the chartOfAccounts attribute.
251      *
252      * @return Returns the chartOfAccounts
253      */
254     public Chart getChartOfAccounts() {
255         return chartOfAccounts;
256     }
257 
258     /**
259      * Sets the chartOfAccounts attribute.
260      *
261      * @param chartOfAccounts The chartOfAccounts to set.
262      * @deprecated
263      */
264     @Deprecated
265     public void setChartOfAccounts(Chart chartOfAccounts) {
266         this.chartOfAccounts = chartOfAccounts;
267     }
268 
269     /**
270      * Gets the organizationDefaultAccount attribute.
271      *
272      * @return Returns the organizationDefaultAccount
273      */
274     public Account getOrganizationDefaultAccount() {
275         return organizationDefaultAccount;
276     }
277 
278     /**
279      * Sets the organizationDefaultAccount attribute.
280      *
281      * @param organizationDefaultAccount The organizationDefaultAccount to set.
282      * @deprecated
283      */
284     @Deprecated
285     public void setOrganizationDefaultAccount(Account organizationDefaultAccount) {
286         this.organizationDefaultAccount = organizationDefaultAccount;
287     }
288 
289     public Person getOrganizationManagerUniversal() {
290         organizationManagerUniversal = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(organizationManagerUniversalId, organizationManagerUniversal);
291         return organizationManagerUniversal;
292     }
293 
294     /**
295      * Sets the organizationManagerUniversal attribute.
296      *
297      * @param organizationManagerUniversal The organizationManagerUniversal to set.
298      * @deprecated
299      */
300     @Deprecated
301     public void setOrganizationManagerUniversal(Person organizationManagerUniversal) {
302         this.organizationManagerUniversal = organizationManagerUniversal;
303     }
304 
305     /**
306      * Gets the responsibilityCenter attribute.
307      *
308      * @return Returns the responsibilityCenter
309      */
310     public ResponsibilityCenter getResponsibilityCenter() {
311         return responsibilityCenter;
312     }
313 
314     /**
315      * Sets the responsibilityCenter attribute.
316      *
317      * @param responsibilityCenter The responsibilityCenter to set.
318      * @deprecated
319      */
320     @Deprecated
321     public void setResponsibilityCenter(ResponsibilityCenter responsibilityCenter) {
322         this.responsibilityCenter = responsibilityCenter;
323     }
324 
325     /**
326      * Gets the organizationPhysicalCampus attribute.
327      *
328      * @return Returns the organizationPhysicalCampus
329      */
330     public CampusEbo getOrganizationPhysicalCampus() {
331         if ( StringUtils.isBlank(organizationPhysicalCampusCode) ) {
332             organizationPhysicalCampus = null;
333         } else {
334             if ( organizationPhysicalCampus == null || !StringUtils.equals( organizationPhysicalCampus.getCode(),organizationPhysicalCampusCode) ) {
335                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CampusEbo.class);
336                 if ( moduleService != null ) {
337                     Map<String,Object> keys = new HashMap<String, Object>(1);
338                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, organizationPhysicalCampusCode);
339                     organizationPhysicalCampus = moduleService.getExternalizableBusinessObject(CampusEbo.class, keys);
340                 } else {
341                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
342                 }
343             }
344         }
345         return organizationPhysicalCampus;
346     }
347 
348     /**
349      * Sets the organizationPhysicalCampus attribute.
350      *
351      * @param organizationPhysicalCampus The organizationPhysicalCampus to set.
352      * @deprecated
353      */
354     @Deprecated
355     public void setOrganizationPhysicalCampus(CampusEbo organizationPhysicalCampus) {
356         this.organizationPhysicalCampus = organizationPhysicalCampus;
357     }
358 
359     /**
360      * Gets the organizationType attribute.
361      *
362      * @return Returns the organizationType
363      */
364     public OrganizationType getOrganizationType() {
365         return organizationType;
366     }
367 
368     /**
369      * Sets the organizationType attribute.
370      *
371      * @param organizationType The organizationType to set.
372      * @deprecated
373      */
374     @Deprecated
375     public void setOrganizationType(OrganizationType organizationType) {
376         this.organizationType = organizationType;
377     }
378 
379     /**
380      * Gets the reportsToOrganization attribute.
381      *
382      * @return Returns the reportsToOrganization
383      */
384     public Organization getReportsToOrganization() {
385         return reportsToOrganization;
386     }
387 
388     /**
389      * Sets the reportsToOrganization attribute.
390      *
391      * @param reportsToOrganization The reportsToOrganization to set.
392      * @deprecated
393      */
394     @Deprecated
395     public void setReportsToOrganization(Organization reportsToOrganization) {
396         this.reportsToOrganization = reportsToOrganization;
397     }
398 
399     /**
400      * Gets the reportsToChartOfAccounts attribute.
401      *
402      * @return Returns the reportsToChartOfAccounts
403      */
404     public Chart getReportsToChartOfAccounts() {
405         return reportsToChartOfAccounts;
406     }
407 
408     /**
409      * Sets the reportsToChartOfAccounts attribute.
410      *
411      * @param reportsToChartOfAccounts The reportsToChartOfAccounts to set.
412      * @deprecated
413      */
414     @Deprecated
415     public void setReportsToChartOfAccounts(Chart reportsToChartOfAccounts) {
416         this.reportsToChartOfAccounts = reportsToChartOfAccounts;
417     }
418 
419     /**
420      * Gets the organizationPlantAccount attribute.
421      *
422      * @return Returns the organizationPlantAccount
423      */
424     public Account getOrganizationPlantAccount() {
425         return organizationPlantAccount;
426     }
427 
428     /**
429      * Sets the organizationPlantAccount attribute.
430      *
431      * @param organizationPlantAccount The organizationPlantAccount to set.
432      * @deprecated
433      */
434     @Deprecated
435     public void setOrganizationPlantAccount(Account organizationPlantAccount) {
436         this.organizationPlantAccount = organizationPlantAccount;
437     }
438 
439     /**
440      * Gets the campusPlantAccount attribute.
441      *
442      * @return Returns the campusPlantAccount
443      */
444     public Account getCampusPlantAccount() {
445         return campusPlantAccount;
446     }
447 
448     /**
449      * Sets the campusPlantAccount attribute.
450      *
451      * @param campusPlantAccount The campusPlantAccount to set.
452      * @deprecated
453      */
454     @Deprecated
455     public void setCampusPlantAccount(Account campusPlantAccount) {
456         this.campusPlantAccount = campusPlantAccount;
457     }
458 
459     /**
460      * Gets the organizationPlantChart attribute.
461      *
462      * @return Returns the organizationPlantChart
463      */
464     public Chart getOrganizationPlantChart() {
465         return organizationPlantChart;
466     }
467 
468     /**
469      * Sets the organizationPlantChart attribute.
470      *
471      * @param organizationPlantChart The organizationPlantChart to set.
472      * @deprecated
473      */
474     @Deprecated
475     public void setOrganizationPlantChart(Chart organizationPlantChart) {
476         this.organizationPlantChart = organizationPlantChart;
477     }
478 
479     /**
480      * Gets the campusPlantChart attribute.
481      *
482      * @return Returns the campusPlantChart
483      */
484     public Chart getCampusPlantChart() {
485         return campusPlantChart;
486     }
487 
488     /**
489      * Sets the campusPlantChart attribute.
490      *
491      * @param campusPlantChart The campusPlantChart to set.
492      * @deprecated
493      */
494     @Deprecated
495     public void setCampusPlantChart(Chart campusPlantChart) {
496         this.campusPlantChart = campusPlantChart;
497     }
498 
499     /**
500      * Gets the organizationCountry attribute.
501      *
502      * @return Returns the organizationCountry.
503      */
504     public CountryEbo getOrganizationCountry() {
505         if ( StringUtils.isBlank(organizationCountryCode) ) {
506             organizationCountry = null;
507         } else {
508             if ( organizationCountry == null || !StringUtils.equals( organizationCountry.getCode(),organizationCountryCode) ) {
509                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CountryEbo.class);
510                 if ( moduleService != null ) {
511                     Map<String,Object> keys = new HashMap<String, Object>(1);
512                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, organizationCountryCode);
513                     organizationCountry = moduleService.getExternalizableBusinessObject(CountryEbo.class, keys);
514                 } else {
515                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
516                 }
517             }
518         }
519         return organizationCountry;
520     }
521 
522     /**
523      * Sets the organizationCountry attribute value.
524      *
525      * @param organizationCountry The organizationCountry to set.
526      * @deprecated
527      */
528     @Deprecated
529     public void setOrganizationCountry(CountryEbo organizationCountry) {
530         this.organizationCountry = organizationCountry;
531     }
532 
533     /**
534      * Gets the chartOfAccountsCode attribute.
535      *
536      * @return Returns the chartOfAccountsCode.
537      */
538     public String getChartOfAccountsCode() {
539         return chartOfAccountsCode;
540     }
541 
542     /**
543      * Sets the chartOfAccountsCode attribute value.
544      *
545      * @param chartOfAccountsCode The chartOfAccountsCode to set.
546      */
547     public void setChartOfAccountsCode(String chartOfAccountsCode) {
548         this.chartOfAccountsCode = chartOfAccountsCode;
549     }
550 
551     /**
552      * Gets the organizationDefaultAccountNumber attribute.
553      *
554      * @return Returns the organizationDefaultAccountNumber.
555      */
556     public String getOrganizationDefaultAccountNumber() {
557         return organizationDefaultAccountNumber;
558     }
559 
560     /**
561      * Sets the organizationDefaultAccountNumber attribute value.
562      *
563      * @param organizationDefaultAccountNumber The organizationDefaultAccountNumber to set.
564      */
565     public void setOrganizationDefaultAccountNumber(String organizationDefaultAccountNumber) {
566         this.organizationDefaultAccountNumber = organizationDefaultAccountNumber;
567     }
568 
569     /**
570      * @return Returns the campusPlantAccountNumber.
571      */
572     public String getCampusPlantAccountNumber() {
573         return campusPlantAccountNumber;
574     }
575 
576     /**
577      * @param campusPlantAccountNumber The campusPlantAccountNumber to set.
578      */
579     public void setCampusPlantAccountNumber(String campusPlantAccountNumber) {
580         this.campusPlantAccountNumber = campusPlantAccountNumber;
581     }
582 
583     /**
584      * @return Returns the campusPlantChartCode.
585      */
586     public String getCampusPlantChartCode() {
587         return campusPlantChartCode;
588     }
589 
590     /**
591      * @param campusPlantChartCode The campusPlantChartCode to set.
592      */
593     public void setCampusPlantChartCode(String campusPlantChartCode) {
594         this.campusPlantChartCode = campusPlantChartCode;
595     }
596 
597     /**
598      * @return Returns the organizationManagerUniversalId.
599      */
600     public String getOrganizationManagerUniversalId() {
601         return organizationManagerUniversalId;
602     }
603 
604     /**
605      * @param organizationManagerUniversalId The organizationManagerUniversalId to set.
606      */
607     public void setOrganizationManagerUniversalId(String organizationManagerUniversalId) {
608         this.organizationManagerUniversalId = organizationManagerUniversalId;
609     }
610 
611     /**
612      * @return Returns the organizationPhysicalCampusCode.
613      */
614     public String getOrganizationPhysicalCampusCode() {
615         return organizationPhysicalCampusCode;
616     }
617 
618     /**
619      * @param organizationPhysicalCampusCode The organizationPhysicalCampusCode to set.
620      */
621     public void setOrganizationPhysicalCampusCode(String organizationPhysicalCampusCode) {
622         this.organizationPhysicalCampusCode = organizationPhysicalCampusCode;
623     }
624 
625     /**
626      * @return Returns the organizationPlantAccountNumber.
627      */
628     public String getOrganizationPlantAccountNumber() {
629         return organizationPlantAccountNumber;
630     }
631 
632     /**
633      * @param organizationPlantAccountNumber The organizationPlantAccountNumber to set.
634      */
635     public void setOrganizationPlantAccountNumber(String organizationPlantAccountNumber) {
636         this.organizationPlantAccountNumber = organizationPlantAccountNumber;
637     }
638 
639     /**
640      * @return Returns the organizationPlantChartCode.
641      */
642     public String getOrganizationPlantChartCode() {
643         return organizationPlantChartCode;
644     }
645 
646     /**
647      * @param organizationPlantChartCode The organizationPlantChartCode to set.
648      */
649     public void setOrganizationPlantChartCode(String organizationPlantChartCode) {
650         this.organizationPlantChartCode = organizationPlantChartCode;
651     }
652 
653     /**
654      * @return Returns the organizationTypeCode.
655      */
656     public String getOrganizationTypeCode() {
657         return organizationTypeCode;
658     }
659 
660     /**
661      * @param organizationTypeCode The organizationTypeCode to set.
662      */
663     public void setOrganizationTypeCode(String organizationTypeCode) {
664         this.organizationTypeCode = organizationTypeCode;
665     }
666 
667     /**
668      * @return Returns the reportsToChartOfAccountsCode.
669      */
670     public String getReportsToChartOfAccountsCode() {
671         return reportsToChartOfAccountsCode;
672     }
673 
674     /**
675      * @param reportsToChartOfAccountsCode The reportsToChartOfAccountsCode to set.
676      */
677     public void setReportsToChartOfAccountsCode(String reportsToChartOfAccountsCode) {
678         this.reportsToChartOfAccountsCode = reportsToChartOfAccountsCode;
679     }
680 
681     /**
682      * @return Returns the reportsToOrganizationCode.
683      */
684     public String getReportsToOrganizationCode() {
685         return reportsToOrganizationCode;
686     }
687 
688     /**
689      * @param reportsToOrganizationCode The reportsToOrganizationCode to set.
690      */
691     public void setReportsToOrganizationCode(String reportsToOrganizationCode) {
692         this.reportsToOrganizationCode = reportsToOrganizationCode;
693     }
694 
695     /**
696      * @return Returns the responsibilityCenterCode.
697      */
698     public String getResponsibilityCenterCode() {
699         return responsibilityCenterCode;
700     }
701 
702     /**
703      * @param responsibilityCenterCode The responsibilityCenterCode to set.
704      */
705     public void setResponsibilityCenterCode(String responsibilityCenterCode) {
706         this.responsibilityCenterCode = responsibilityCenterCode;
707     }
708 
709     /**
710      * Gets the postalZip attribute.
711      *
712      * @return Returns the postalZip.
713      */
714     public PostalCodeEbo getPostalZip() {
715         if ( StringUtils.isBlank(organizationZipCode) || StringUtils.isBlank(organizationCountryCode) ) {
716             postalZip = null;
717         } else {
718             if ( postalZip == null || !StringUtils.equals( postalZip.getCode(),organizationZipCode) || !StringUtils.equals(postalZip.getCountryCode(), organizationCountryCode ) ) {
719                 ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(PostalCodeEbo.class);
720                 if ( moduleService != null ) {
721                     Map<String,Object> keys = new HashMap<String, Object>(2);
722                     keys.put(LocationConstants.PrimaryKeyConstants.COUNTRY_CODE, organizationCountryCode);
723                     keys.put(LocationConstants.PrimaryKeyConstants.CODE, organizationZipCode);
724                     postalZip = moduleService.getExternalizableBusinessObject(PostalCodeEbo.class, keys);
725                 } else {
726                     throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
727                 }
728             }
729         }
730         return postalZip;
731     }
732 
733     /**
734      * Sets the postalZip attribute value.
735      *
736      * @param postalZip The postalZip to set.
737      */
738     public void setPostalZip(PostalCodeEbo postalZip) {
739         this.postalZip = postalZip;
740     }
741 
742     /**
743      * Gets the organizationCountryCode attribute.
744      *
745      * @return Returns the organizationCountryCode.
746      */
747     public String getOrganizationCountryCode() {
748         return organizationCountryCode;
749     }
750 
751     /**
752      * Sets the organizationCountryCode attribute value.
753      *
754      * @param organizationCountryCode The organizationCountryCode to set.
755      */
756     public void setOrganizationCountryCode(String organizationCountryCode) {
757         this.organizationCountryCode = organizationCountryCode;
758     }
759 
760     /**
761      * Gets the organizationLine1Address attribute.
762      *
763      * @return Returns the organizationLine1Address.
764      */
765     public String getOrganizationLine1Address() {
766         return organizationLine1Address;
767     }
768 
769     /**
770      * Sets the organizationLine1Address attribute value.
771      *
772      * @param organizationLine1Address The organizationLine1Address to set.
773      */
774     public void setOrganizationLine1Address(String organizationLine1Address) {
775         this.organizationLine1Address = organizationLine1Address;
776     }
777 
778     /**
779      * Gets the organizationLine2Address attribute.
780      *
781      * @return Returns the organizationLine2Address.
782      */
783     public String getOrganizationLine2Address() {
784         return organizationLine2Address;
785     }
786 
787     /**
788      * Sets the organizationLine2Address attribute value.
789      *
790      * @param organizationLine2Address The organizationLine2Address to set.
791      */
792     public void setOrganizationLine2Address(String organizationLine2Address) {
793         this.organizationLine2Address = organizationLine2Address;
794     }
795 
796     /**
797      * Gets the editPlantAccountsSection attribute.
798      *
799      * @return Returns the editPlantAccountsSection.
800      */
801     public String getEditPlantAccountsSection() {
802         return editPlantAccountsSection;
803     }
804 
805     /**
806      * Gets the editPlantAccountsSectionBlank attribute.
807      *
808      * @return Returns the editPlantAccountsSectionBlank.
809      */
810     public String getEditPlantAccountsSectionBlank() {
811         return editPlantAccountsSectionBlank;
812     }
813 
814     /**
815      * Gets the editHrmsUnitSection attribute.
816      *
817      * @return Returns the editHrmsUnitSection.
818      */
819     public final String getEditHrmsUnitSection() {
820         return editHrmsUnitSection;
821     }
822 
823     /**
824      * Sets the editHrmsUnitSection attribute value.
825      *
826      * @param editHrmsUnitSection The editHrmsUnitSection to set.
827      */
828     public final void setEditHrmsUnitSection(String editHrmsUnitSection) {
829         this.editHrmsUnitSection = editHrmsUnitSection;
830     }
831 
832     /**
833      * Gets the editHrmsUnitSectionBlank attribute.
834      *
835      * @return Returns the editHrmsUnitSectionBlank.
836      */
837     public final String getEditHrmsUnitSectionBlank() {
838         return editHrmsUnitSectionBlank;
839     }
840 
841     /**
842      * Sets the editHrmsUnitSectionBlank attribute value.
843      *
844      * @param editHrmsUnitSectionBlank The editHrmsUnitSectionBlank to set.
845      */
846     public final void setEditHrmsUnitSectionBlank(String editHrmsUnitSectionBlank) {
847         this.editHrmsUnitSectionBlank = editHrmsUnitSectionBlank;
848     }
849 
850     /**
851      * Gets the organizationExtension attribute.
852      *
853      * @return Returns the organizationExtension.
854      */
855     public final OrganizationExtension getOrganizationExtension() {
856         return organizationExtension;
857     }
858 
859     /**
860      * Sets the organizationExtension attribute value.
861      *
862      * @param organizationExtension The organizationExtension to set.
863      */
864     public final void setOrganizationExtension(OrganizationExtension organizationExtension) {
865         this.organizationExtension = organizationExtension;
866     }
867 
868     public String getOrganizationHierarchy() {
869         OrganizationService organizationService = SpringContext.getBean(OrganizationService.class);
870         StringBuffer result = new StringBuffer();
871         Set<Organization> seen = new HashSet<Organization>();
872 
873         Organization org = this;
874 
875         while (org != null && org.getReportsToOrganizationCode() != null && !seen.contains(org)) {
876             String rChart = org.getReportsToChartOfAccountsCode();
877             String rOrg = org.getReportsToOrganizationCode();
878 
879             seen.add(org);
880             org = organizationService.getByPrimaryIdWithCaching(rChart, rOrg);
881 
882             result.append(rChart).append("/").append(rOrg).append(" ");
883             result.append(((org == null) ? "" : org.getOrganizationName()));
884             if (org != null && org.getReportsToOrganizationCode() != null && !seen.contains(org)) {
885                 result.append(" ==> ");
886             }
887             result.append("\n");
888         }
889 
890         return result.toString();
891     }
892 
893     public String getOrganizationReviewHierarchy() {
894 
895         Properties params = new Properties();
896         params.put("methodToCall", "start");
897         params.put("docFormKey", "");
898         params.put("lookupableImplServiceName", "RuleBaseValuesLookupableImplService");
899         params.put("fin_coa_cd", this.chartOfAccountsCode);
900         params.put("org_cd", this.organizationCode);
901         params.put("conversionFields", "");
902         params.put("returnLocation", "");
903         params.put("active_ind", "true");
904         params.put("ruleTemplateName", "KualiOrgReviewTemplate");
905 
906         return UrlFactory.parameterizeUrl(SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(OLEConstants.WORKFLOW_URL_KEY) + "/Lookup.do", params);
907     }
908 
909     /**
910      * Gets the campus code for Endowment Report
911      *
912      * @return
913      */
914     public String getOrganizationPhysicalCampusCodeForReport() {
915         return organizationPhysicalCampusCode;
916     }
917 
918     /**
919      * Implementing equals so Org will behave reasonably in a hashed datastructure.
920      *
921      * @see java.lang.Object#equals(java.lang.Object)
922      */
923     @Override
924     public boolean equals(Object obj) {
925         boolean equal = false;
926 
927         if (obj != null) {
928 
929             if (this == obj) {
930                 return true;
931             }
932 
933             if (this.getClass().isAssignableFrom(obj.getClass())) {
934 
935                 Organization other = (Organization) obj;
936 
937                 if (StringUtils.equals(this.getChartOfAccountsCode(), other.getChartOfAccountsCode())) {
938                     if (StringUtils.equals(this.getOrganizationCode(), other.getOrganizationCode())) {
939                         equal = true;
940                     }
941                 }
942             }
943         }
944 
945         return equal;
946     }
947 
948     /**
949      * @return Returns the code and description in format: xx - xxxxxxxxxxxxxxxx
950      */
951     public String getCodeAndDescription() {
952         String theString = getOrganizationCode() + "-" + getOrganizationName();
953         return theString;
954     }
955 
956     /**
957      * @see java.lang.Object#hashCode()
958      */
959     @Override
960     public int hashCode() {
961         String hashString = getChartOfAccountsCode() + "|" + getOrganizationCode();
962         return hashString.hashCode();
963     }
964 
965     @Override
966     public boolean isActive() {
967         return active;
968     }
969 
970     @Override
971     public void setActive(boolean active) {
972         this.active = active;
973     }
974 
975     /**
976      * Gets the organizationName attribute for report
977      *
978      * @return Returns the organizationName
979      */
980     public String getOrganizationCodeForReport() {
981         return organizationCode;
982     }
983 
984     /**
985      * @see org.kuali.rice.krad.bo.PersistableBusinessObjectBase#refreshReferenceObject(java.lang.String)
986      */
987     @Override
988     public void refreshReferenceObject(String referenceObjectName) {
989         if (referenceObjectName.equals("organizationManagerUniversal")) {
990             getOrganizationManagerUniversal();
991         }
992         else {
993             super.refreshReferenceObject(referenceObjectName);
994         }
995     }
996 }