001    /*
002     * Copyright 2011 The Kuali Foundation.
003     * 
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     * 
008     * http://www.opensource.org/licenses/ecl2.php
009     * 
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.kfs.coa.businessobject;
017    
018    import java.sql.Date;
019    import java.util.HashSet;
020    import java.util.LinkedHashMap;
021    import java.util.Properties;
022    import java.util.Set;
023    
024    import org.apache.commons.lang.StringUtils;
025    import org.apache.log4j.Logger;
026    import org.kuali.kfs.coa.service.OrganizationService;
027    import org.kuali.kfs.sys.KFSConstants;
028    import org.kuali.rice.kns.bo.Country;
029    import org.kuali.rice.kns.bo.PostalCode;
030    import org.kuali.kfs.sys.context.SpringContext;
031    import org.kuali.rice.kns.service.CountryService;
032    import org.kuali.rice.kns.service.KualiModuleService;
033    import org.kuali.rice.kns.service.PostalCodeService;
034    import org.kuali.rice.kns.bo.Campus;
035    import org.kuali.rice.kns.bo.Inactivateable;
036    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
037    import org.kuali.rice.kim.bo.Person;
038    import org.kuali.rice.kns.service.KualiConfigurationService;
039    import org.kuali.rice.kim.service.PersonService;
040    import org.kuali.rice.kns.util.UrlFactory;
041    
042    /**
043     * 
044     */
045    public class Organization extends PersistableBusinessObjectBase implements Inactivateable {
046        private static final Logger LOG = Logger.getLogger(Organization.class);
047    
048        private static final long serialVersionUID = 121873645110037203L;
049    
050        /**
051         * Default no-arg constructor.
052         */
053        public Organization() {
054            organizationInFinancialProcessingIndicator = false;
055        }
056    
057        private String organizationCode;
058        private String organizationName;
059        private String organizationCityName;
060        private String organizationStateCode;
061        private String organizationZipCode;
062        private Date organizationBeginDate;
063        private Date organizationEndDate;
064        private boolean organizationInFinancialProcessingIndicator;
065        private String organizationManagerUniversalId;
066        private String responsibilityCenterCode;
067        private String organizationPhysicalCampusCode;
068        private String organizationTypeCode;
069        private String reportsToChartOfAccountsCode;
070        private String reportsToOrganizationCode;
071        private String organizationPlantAccountNumber;
072        private String campusPlantAccountNumber;
073        private String organizationPlantChartCode;
074        private String campusPlantChartCode;
075        private String organizationCountryCode;
076        private String organizationLine1Address;
077        private String organizationLine2Address;
078    
079        private Chart chartOfAccounts;
080        private Organization hrisOrganization;
081        private Account organizationDefaultAccount;
082        private Person organizationManagerUniversal;
083        private ResponsibilityCenter responsibilityCenter;
084        private Campus organizationPhysicalCampus;
085        private OrganizationType organizationType;
086        private Organization reportsToOrganization;
087        private Chart reportsToChartOfAccounts;
088        private Account organizationPlantAccount;
089        private Account campusPlantAccount;
090        private Chart organizationPlantChart;
091        private Chart campusPlantChart;
092        private PostalCode postalZip;
093        private Country organizationCountry;
094    
095        // HRMS Org fields
096        private OrganizationExtension organizationExtension;
097        private String editHrmsUnitSectionBlank;
098        private String editHrmsUnitSection;
099    
100        // fields for mixed anonymous keys
101        private String organizationDefaultAccountNumber;
102        private String chartOfAccountsCode;
103    
104        // Several kinds of Dummy Attributes for dividing sections on Inquiry page
105        private String editPlantAccountsSectionBlank;
106        private String editPlantAccountsSection;
107    
108        private boolean active;
109    
110        /**
111         * Gets the organizationCode attribute.
112         * 
113         * @return Returns the organizationCode
114         */
115        public String getOrganizationCode() {
116            return organizationCode;
117        }
118    
119        /**
120         * Sets the organizationCode attribute.
121         * 
122         * @param organizationCode The organizationCode to set.
123         */
124        public void setOrganizationCode(String organizationCode) {
125            this.organizationCode = organizationCode;
126        }
127    
128        /**
129         * Gets the organizationName attribute.
130         * 
131         * @return Returns the organizationName
132         */
133        public String getOrganizationName() {
134            return organizationName;
135        }
136    
137        /**
138         * Sets the organizationName attribute.
139         * 
140         * @param organizationName The organizationName to set.
141         */
142        public void setOrganizationName(String organizationName) {
143            this.organizationName = organizationName;
144        }
145    
146        /**
147         * Gets the organizationCityName attribute.
148         * 
149         * @return Returns the organizationCityName
150         */
151        public String getOrganizationCityName() {
152            return organizationCityName;
153        }
154    
155        /**
156         * Sets the organizationCityName attribute.
157         * 
158         * @param organizationCityName The organizationCityName to set.
159         */
160        public void setOrganizationCityName(String organizationCityName) {
161            this.organizationCityName = organizationCityName;
162        }
163    
164        /**
165         * Gets the organizationStateCode attribute.
166         * 
167         * @return Returns the organizationStateCode
168         */
169        public String getOrganizationStateCode() {
170            return organizationStateCode;
171        }
172    
173        /**
174         * Sets the organizationStateCode attribute.
175         * 
176         * @param organizationStateCode The organizationStateCode to set.
177         */
178        public void setOrganizationStateCode(String organizationStateCode) {
179            this.organizationStateCode = organizationStateCode;
180        }
181    
182        /**
183         * Gets the organizationZipCode attribute.
184         * 
185         * @return Returns the organizationZipCode
186         */
187        public String getOrganizationZipCode() {
188            return organizationZipCode;
189        }
190    
191        /**
192         * Sets the organizationZipCode attribute.
193         * 
194         * @param organizationZipCode The organizationZipCode to set.
195         */
196        public void setOrganizationZipCode(String organizationZipCode) {
197            this.organizationZipCode = organizationZipCode;
198        }
199    
200        /**
201         * Gets the organizationBeginDate attribute.
202         * 
203         * @return Returns the organizationBeginDate
204         */
205        public Date getOrganizationBeginDate() {
206            return organizationBeginDate;
207        }
208    
209        /**
210         * Sets the organizationBeginDate attribute.
211         * 
212         * @param organizationBeginDate The organizationBeginDate to set.
213         */
214        public void setOrganizationBeginDate(Date organizationBeginDate) {
215            this.organizationBeginDate = organizationBeginDate;
216        }
217    
218        /**
219         * Gets the organizationEndDate attribute.
220         * 
221         * @return Returns the organizationEndDate
222         */
223        public Date getOrganizationEndDate() {
224            return organizationEndDate;
225        }
226    
227        /**
228         * Sets the organizationEndDate attribute.
229         * 
230         * @param organizationEndDate The organizationEndDate to set.
231         */
232        public void setOrganizationEndDate(Date organizationEndDate) {
233            this.organizationEndDate = organizationEndDate;
234        }
235    
236        /**
237         * Gets the organizationInFinancialProcessingIndicator attribute.
238         * 
239         * @return Returns the organizationInFinancialProcessingIndicator
240         */
241        public boolean isOrganizationInFinancialProcessingIndicator() {
242            return organizationInFinancialProcessingIndicator;
243        }
244    
245        /**
246         * Sets the organizationInFinancialProcessingIndicator attribute.
247         * 
248         * @param organizationInFinancialProcessingIndicator The organizationInFinancialProcessingIndicator to set.
249         */
250        public void setOrganizationInFinancialProcessingIndicator(boolean organizationInFinancialProcessingIndicator) {
251            this.organizationInFinancialProcessingIndicator = organizationInFinancialProcessingIndicator;
252        }
253    
254        /**
255         * Gets the chartOfAccounts attribute.
256         * 
257         * @return Returns the chartOfAccounts
258         */
259        public Chart getChartOfAccounts() {
260            return chartOfAccounts;
261        }
262    
263        /**
264         * Sets the chartOfAccounts attribute.
265         * 
266         * @param chartOfAccounts The chartOfAccounts to set.
267         * @deprecated
268         */
269        public void setChartOfAccounts(Chart chartOfAccounts) {
270            this.chartOfAccounts = chartOfAccounts;
271        }
272    
273        /**
274         * Gets the organizationDefaultAccount attribute.
275         * 
276         * @return Returns the organizationDefaultAccount
277         */
278        public Account getOrganizationDefaultAccount() {
279            return organizationDefaultAccount;
280        }
281    
282        /**
283         * Sets the organizationDefaultAccount attribute.
284         * 
285         * @param organizationDefaultAccount The organizationDefaultAccount to set.
286         * @deprecated
287         */
288        public void setOrganizationDefaultAccount(Account organizationDefaultAccount) {
289            this.organizationDefaultAccount = organizationDefaultAccount;
290        }
291    
292        public Person getOrganizationManagerUniversal() {
293            organizationManagerUniversal = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(organizationManagerUniversalId, organizationManagerUniversal);
294            return organizationManagerUniversal;
295        }
296    
297        /**
298         * Sets the organizationManagerUniversal attribute.
299         * 
300         * @param organizationManagerUniversal The organizationManagerUniversal to set.
301         * @deprecated
302         */
303        public void setOrganizationManagerUniversal(Person organizationManagerUniversal) {
304            this.organizationManagerUniversal = organizationManagerUniversal;
305        }
306    
307        /**
308         * Gets the responsibilityCenter attribute.
309         * 
310         * @return Returns the responsibilityCenter
311         */
312        public ResponsibilityCenter getResponsibilityCenter() {
313            return responsibilityCenter;
314        }
315    
316        /**
317         * Sets the responsibilityCenter attribute.
318         * 
319         * @param responsibilityCenter The responsibilityCenter to set.
320         * @deprecated
321         */
322        public void setResponsibilityCenter(ResponsibilityCenter responsibilityCenter) {
323            this.responsibilityCenter = responsibilityCenter;
324        }
325    
326        /**
327         * Gets the organizationPhysicalCampus attribute.
328         * 
329         * @return Returns the organizationPhysicalCampus
330         */
331        public Campus getOrganizationPhysicalCampus() {
332            return organizationPhysicalCampus = (Campus) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(Campus.class).retrieveExternalizableBusinessObjectIfNecessary(this, organizationPhysicalCampus, "organizationPhysicalCampus");
333        }
334    
335        /**
336         * Sets the organizationPhysicalCampus attribute.
337         * 
338         * @param organizationPhysicalCampus The organizationPhysicalCampus to set.
339         * @deprecated
340         */
341        public void setOrganizationPhysicalCampus(Campus organizationPhysicalCampus) {
342            this.organizationPhysicalCampus = organizationPhysicalCampus;
343        }
344    
345        /**
346         * Gets the organizationType attribute.
347         * 
348         * @return Returns the organizationType
349         */
350        public OrganizationType getOrganizationType() {
351            return organizationType;
352        }
353    
354        /**
355         * Sets the organizationType attribute.
356         * 
357         * @param organizationType The organizationType to set.
358         * @deprecated
359         */
360        public void setOrganizationType(OrganizationType organizationType) {
361            this.organizationType = organizationType;
362        }
363    
364        /**
365         * Gets the reportsToOrganization attribute.
366         * 
367         * @return Returns the reportsToOrganization
368         */
369        public Organization getReportsToOrganization() {
370            return reportsToOrganization;
371        }
372    
373        /**
374         * Sets the reportsToOrganization attribute.
375         * 
376         * @param reportsToOrganization The reportsToOrganization to set.
377         * @deprecated
378         */
379        public void setReportsToOrganization(Organization reportsToOrganization) {
380            this.reportsToOrganization = reportsToOrganization;
381        }
382    
383        /**
384         * Gets the reportsToChartOfAccounts attribute.
385         * 
386         * @return Returns the reportsToChartOfAccounts
387         */
388        public Chart getReportsToChartOfAccounts() {
389            return reportsToChartOfAccounts;
390        }
391    
392        /**
393         * Sets the reportsToChartOfAccounts attribute.
394         * 
395         * @param reportsToChartOfAccounts The reportsToChartOfAccounts to set.
396         * @deprecated
397         */
398        public void setReportsToChartOfAccounts(Chart reportsToChartOfAccounts) {
399            this.reportsToChartOfAccounts = reportsToChartOfAccounts;
400        }
401    
402        /**
403         * Gets the organizationPlantAccount attribute.
404         * 
405         * @return Returns the organizationPlantAccount
406         */
407        public Account getOrganizationPlantAccount() {
408            return organizationPlantAccount;
409        }
410    
411        /**
412         * Sets the organizationPlantAccount attribute.
413         * 
414         * @param organizationPlantAccount The organizationPlantAccount to set.
415         * @deprecated
416         */
417        public void setOrganizationPlantAccount(Account organizationPlantAccount) {
418            this.organizationPlantAccount = organizationPlantAccount;
419        }
420    
421        /**
422         * Gets the campusPlantAccount attribute.
423         * 
424         * @return Returns the campusPlantAccount
425         */
426        public Account getCampusPlantAccount() {
427            return campusPlantAccount;
428        }
429    
430        /**
431         * Sets the campusPlantAccount attribute.
432         * 
433         * @param campusPlantAccount The campusPlantAccount to set.
434         * @deprecated
435         */
436        public void setCampusPlantAccount(Account campusPlantAccount) {
437            this.campusPlantAccount = campusPlantAccount;
438        }
439    
440        /**
441         * Gets the organizationPlantChart attribute.
442         * 
443         * @return Returns the organizationPlantChart
444         */
445        public Chart getOrganizationPlantChart() {
446            return organizationPlantChart;
447        }
448    
449        /**
450         * Sets the organizationPlantChart attribute.
451         * 
452         * @param organizationPlantChart The organizationPlantChart to set.
453         * @deprecated
454         */
455        public void setOrganizationPlantChart(Chart organizationPlantChart) {
456            this.organizationPlantChart = organizationPlantChart;
457        }
458    
459        /**
460         * Gets the campusPlantChart attribute.
461         * 
462         * @return Returns the campusPlantChart
463         */
464        public Chart getCampusPlantChart() {
465            return campusPlantChart;
466        }
467    
468        /**
469         * Sets the campusPlantChart attribute.
470         * 
471         * @param campusPlantChart The campusPlantChart to set.
472         * @deprecated
473         */
474        public void setCampusPlantChart(Chart campusPlantChart) {
475            this.campusPlantChart = campusPlantChart;
476        }
477    
478        /**
479         * Gets the organizationCountry attribute.
480         * 
481         * @return Returns the organizationCountry.
482         */
483        public Country getOrganizationCountry() {
484            organizationCountry = SpringContext.getBean(CountryService.class).getByPrimaryIdIfNecessary(organizationCountryCode, organizationCountry);
485            return organizationCountry;
486        }
487    
488        /**
489         * Sets the organizationCountry attribute value.
490         * 
491         * @param organizationCountry The organizationCountry to set.
492         * @deprecated
493         */
494        public void setOrganizationCountry(Country organizationCountry) {
495            this.organizationCountry = organizationCountry;
496        }
497    
498        /**
499         * Gets the chartOfAccountsCode attribute.
500         * 
501         * @return Returns the chartOfAccountsCode.
502         */
503        public String getChartOfAccountsCode() {
504            return chartOfAccountsCode;
505        }
506    
507        /**
508         * Sets the chartOfAccountsCode attribute value.
509         * 
510         * @param chartOfAccountsCode The chartOfAccountsCode to set.
511         */
512        public void setChartOfAccountsCode(String chartOfAccountsCode) {
513            this.chartOfAccountsCode = chartOfAccountsCode;
514        }
515    
516        /**
517         * Gets the organizationDefaultAccountNumber attribute.
518         * 
519         * @return Returns the organizationDefaultAccountNumber.
520         */
521        public String getOrganizationDefaultAccountNumber() {
522            return organizationDefaultAccountNumber;
523        }
524    
525        /**
526         * Sets the organizationDefaultAccountNumber attribute value.
527         * 
528         * @param organizationDefaultAccountNumber The organizationDefaultAccountNumber to set.
529         */
530        public void setOrganizationDefaultAccountNumber(String organizationDefaultAccountNumber) {
531            this.organizationDefaultAccountNumber = organizationDefaultAccountNumber;
532        }
533    
534        /**
535         * @return Returns the campusPlantAccountNumber.
536         */
537        public String getCampusPlantAccountNumber() {
538            return campusPlantAccountNumber;
539        }
540    
541        /**
542         * @param campusPlantAccountNumber The campusPlantAccountNumber to set.
543         */
544        public void setCampusPlantAccountNumber(String campusPlantAccountNumber) {
545            this.campusPlantAccountNumber = campusPlantAccountNumber;
546        }
547    
548        /**
549         * @return Returns the campusPlantChartCode.
550         */
551        public String getCampusPlantChartCode() {
552            return campusPlantChartCode;
553        }
554    
555        /**
556         * @param campusPlantChartCode The campusPlantChartCode to set.
557         */
558        public void setCampusPlantChartCode(String campusPlantChartCode) {
559            this.campusPlantChartCode = campusPlantChartCode;
560        }
561    
562        /**
563         * @return Returns the organizationManagerUniversalId.
564         */
565        public String getOrganizationManagerUniversalId() {
566            return organizationManagerUniversalId;
567        }
568    
569        /**
570         * @param organizationManagerUniversalId The organizationManagerUniversalId to set.
571         */
572        public void setOrganizationManagerUniversalId(String organizationManagerUniversalId) {
573            this.organizationManagerUniversalId = organizationManagerUniversalId;
574        }
575    
576        /**
577         * @return Returns the organizationPhysicalCampusCode.
578         */
579        public String getOrganizationPhysicalCampusCode() {
580            return organizationPhysicalCampusCode;
581        }
582    
583        /**
584         * @param organizationPhysicalCampusCode The organizationPhysicalCampusCode to set.
585         */
586        public void setOrganizationPhysicalCampusCode(String organizationPhysicalCampusCode) {
587            this.organizationPhysicalCampusCode = organizationPhysicalCampusCode;
588        }
589    
590        /**
591         * @return Returns the organizationPlantAccountNumber.
592         */
593        public String getOrganizationPlantAccountNumber() {
594            return organizationPlantAccountNumber;
595        }
596    
597        /**
598         * @param organizationPlantAccountNumber The organizationPlantAccountNumber to set.
599         */
600        public void setOrganizationPlantAccountNumber(String organizationPlantAccountNumber) {
601            this.organizationPlantAccountNumber = organizationPlantAccountNumber;
602        }
603    
604        /**
605         * @return Returns the organizationPlantChartCode.
606         */
607        public String getOrganizationPlantChartCode() {
608            return organizationPlantChartCode;
609        }
610    
611        /**
612         * @param organizationPlantChartCode The organizationPlantChartCode to set.
613         */
614        public void setOrganizationPlantChartCode(String organizationPlantChartCode) {
615            this.organizationPlantChartCode = organizationPlantChartCode;
616        }
617    
618        /**
619         * @return Returns the organizationTypeCode.
620         */
621        public String getOrganizationTypeCode() {
622            return organizationTypeCode;
623        }
624    
625        /**
626         * @param organizationTypeCode The organizationTypeCode to set.
627         */
628        public void setOrganizationTypeCode(String organizationTypeCode) {
629            this.organizationTypeCode = organizationTypeCode;
630        }
631    
632        /**
633         * @return Returns the reportsToChartOfAccountsCode.
634         */
635        public String getReportsToChartOfAccountsCode() {
636            return reportsToChartOfAccountsCode;
637        }
638    
639        /**
640         * @param reportsToChartOfAccountsCode The reportsToChartOfAccountsCode to set.
641         */
642        public void setReportsToChartOfAccountsCode(String reportsToChartOfAccountsCode) {
643            this.reportsToChartOfAccountsCode = reportsToChartOfAccountsCode;
644        }
645    
646        /**
647         * @return Returns the reportsToOrganizationCode.
648         */
649        public String getReportsToOrganizationCode() {
650            return reportsToOrganizationCode;
651        }
652    
653        /**
654         * @param reportsToOrganizationCode The reportsToOrganizationCode to set.
655         */
656        public void setReportsToOrganizationCode(String reportsToOrganizationCode) {
657            this.reportsToOrganizationCode = reportsToOrganizationCode;
658        }
659    
660        /**
661         * @return Returns the responsibilityCenterCode.
662         */
663        public String getResponsibilityCenterCode() {
664            return responsibilityCenterCode;
665        }
666    
667        /**
668         * @param responsibilityCenterCode The responsibilityCenterCode to set.
669         */
670        public void setResponsibilityCenterCode(String responsibilityCenterCode) {
671            this.responsibilityCenterCode = responsibilityCenterCode;
672        }
673    
674        /**
675         * Gets the postalZip attribute.
676         * 
677         * @return Returns the postalZip.
678         */
679        public PostalCode getPostalZip() {
680            postalZip = SpringContext.getBean(PostalCodeService.class).getByPrimaryIdIfNecessary( organizationCountryCode, organizationZipCode, postalZip);
681            return postalZip;
682        }
683    
684        /**
685         * Sets the postalZip attribute value.
686         * 
687         * @param postalZip The postalZip to set.
688         */
689        public void setPostalZip(PostalCode postalZip) {
690            this.postalZip = postalZip;
691        }
692    
693        /**
694         * Gets the organizationCountryCode attribute.
695         * 
696         * @return Returns the organizationCountryCode.
697         */
698        public String getOrganizationCountryCode() {
699            return organizationCountryCode;
700        }
701    
702        /**
703         * Sets the organizationCountryCode attribute value.
704         * 
705         * @param organizationCountryCode The organizationCountryCode to set.
706         */
707        public void setOrganizationCountryCode(String organizationCountryCode) {
708            this.organizationCountryCode = organizationCountryCode;
709        }
710    
711        /**
712         * Gets the organizationLine1Address attribute.
713         * 
714         * @return Returns the organizationLine1Address.
715         */
716        public String getOrganizationLine1Address() {
717            return organizationLine1Address;
718        }
719    
720        /**
721         * Sets the organizationLine1Address attribute value.
722         * 
723         * @param organizationLine1Address The organizationLine1Address to set.
724         */
725        public void setOrganizationLine1Address(String organizationLine1Address) {
726            this.organizationLine1Address = organizationLine1Address;
727        }
728    
729        /**
730         * Gets the organizationLine2Address attribute.
731         * 
732         * @return Returns the organizationLine2Address.
733         */
734        public String getOrganizationLine2Address() {
735            return organizationLine2Address;
736        }
737    
738        /**
739         * Sets the organizationLine2Address attribute value.
740         * 
741         * @param organizationLine2Address The organizationLine2Address to set.
742         */
743        public void setOrganizationLine2Address(String organizationLine2Address) {
744            this.organizationLine2Address = organizationLine2Address;
745        }
746    
747        /**
748         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
749         */
750        protected LinkedHashMap toStringMapper() {
751            LinkedHashMap m = new LinkedHashMap();
752    
753            m.put("chartOfAccountsCode", this.chartOfAccountsCode);
754            m.put("organizationCode", this.organizationCode);
755    
756            return m;
757        }
758    
759        /**
760         * Gets the editPlantAccountsSection attribute.
761         * 
762         * @return Returns the editPlantAccountsSection.
763         */
764        public String getEditPlantAccountsSection() {
765            return editPlantAccountsSection;
766        }
767    
768        /**
769         * Gets the editPlantAccountsSectionBlank attribute.
770         * 
771         * @return Returns the editPlantAccountsSectionBlank.
772         */
773        public String getEditPlantAccountsSectionBlank() {
774            return editPlantAccountsSectionBlank;
775        }
776    
777        /**
778         * Gets the editHrmsUnitSection attribute.
779         * 
780         * @return Returns the editHrmsUnitSection.
781         */
782        public final String getEditHrmsUnitSection() {
783            return editHrmsUnitSection;
784        }
785    
786        /**
787         * Sets the editHrmsUnitSection attribute value.
788         * 
789         * @param editHrmsUnitSection The editHrmsUnitSection to set.
790         */
791        public final void setEditHrmsUnitSection(String editHrmsUnitSection) {
792            this.editHrmsUnitSection = editHrmsUnitSection;
793        }
794    
795        /**
796         * Gets the editHrmsUnitSectionBlank attribute.
797         * 
798         * @return Returns the editHrmsUnitSectionBlank.
799         */
800        public final String getEditHrmsUnitSectionBlank() {
801            return editHrmsUnitSectionBlank;
802        }
803    
804        /**
805         * Sets the editHrmsUnitSectionBlank attribute value.
806         * 
807         * @param editHrmsUnitSectionBlank The editHrmsUnitSectionBlank to set.
808         */
809        public final void setEditHrmsUnitSectionBlank(String editHrmsUnitSectionBlank) {
810            this.editHrmsUnitSectionBlank = editHrmsUnitSectionBlank;
811        }
812    
813        /**
814         * Gets the organizationExtension attribute.
815         * 
816         * @return Returns the organizationExtension.
817         */
818        public final OrganizationExtension getOrganizationExtension() {
819            return organizationExtension;
820        }
821    
822        /**
823         * Sets the organizationExtension attribute value.
824         * 
825         * @param organizationExtension The organizationExtension to set.
826         */
827        public final void setOrganizationExtension(OrganizationExtension organizationExtension) {
828            this.organizationExtension = organizationExtension;
829        }
830    
831        public String getOrganizationHierarchy() {
832            OrganizationService organizationService = SpringContext.getBean(OrganizationService.class);
833            StringBuffer result = new StringBuffer();
834            Set<Organization> seen = new HashSet<Organization>();
835    
836            Organization org = this;
837    
838            while (org != null && org.getReportsToOrganizationCode() != null && !seen.contains(org)) {
839                String rChart = org.getReportsToChartOfAccountsCode();
840                String rOrg = org.getReportsToOrganizationCode();
841    
842                seen.add(org);
843                org = organizationService.getByPrimaryIdWithCaching(rChart, rOrg);
844    
845                result.append(rChart).append("/").append(rOrg).append(" ");
846                result.append(((org == null) ? "" : org.getOrganizationName()));
847                if ( org != null && org.getReportsToOrganizationCode() != null && !seen.contains(org)) {
848                    result.append(" ==> ");
849                }
850                result.append("\n");
851            }
852    
853            return result.toString();
854        }
855    
856        public String getOrganizationReviewHierarchy() {
857    
858            Properties params = new Properties();
859            params.put("methodToCall", "start");
860            params.put("docFormKey", "");
861            params.put("lookupableImplServiceName", "RuleBaseValuesLookupableImplService");
862            params.put("fin_coa_cd", this.chartOfAccountsCode);
863            params.put("org_cd", this.organizationCode);
864            params.put("conversionFields", "");
865            params.put("returnLocation", "");
866            params.put("active_ind", "true");
867            params.put("ruleTemplateName", "KualiOrgReviewTemplate");
868    
869            return UrlFactory.parameterizeUrl(SpringContext.getBean(KualiConfigurationService.class).getPropertyString(KFSConstants.WORKFLOW_URL_KEY) + "/Lookup.do", params);
870        }
871            
872        /**
873         * Gets the campus code for Endowment Report
874         * 
875         * @return
876         */
877        public String getOrganizationPhysicalCampusCodeForReport() {
878            return organizationPhysicalCampusCode;
879        }
880    
881        /**
882         * Implementing equals so Org will behave reasonably in a hashed datastructure.
883         * 
884         * @see java.lang.Object#equals(java.lang.Object)
885         */
886        public boolean equals(Object obj) {
887            boolean equal = false;
888    
889            if (obj != null) {
890    
891                if (this == obj)
892                    return true;
893    
894                if (this.getClass().isAssignableFrom(obj.getClass())) {
895    
896                    Organization other = (Organization) obj;
897    
898                    if (StringUtils.equals(this.getChartOfAccountsCode(), other.getChartOfAccountsCode())) {
899                        if (StringUtils.equals(this.getOrganizationCode(), other.getOrganizationCode())) {
900                            equal = true;
901                        }
902                    }
903                }
904            }
905    
906            return equal;
907        }
908    
909        /**
910         * @return Returns the code and description in format: xx - xxxxxxxxxxxxxxxx
911         */
912        public String getCodeAndDescription() {
913            String theString = getOrganizationCode() + "-" + getOrganizationName();
914            return theString;
915        }
916    
917        /**
918         * @see java.lang.Object#hashCode()
919         */
920        public int hashCode() {
921            String hashString = getChartOfAccountsCode() + "|" + getOrganizationCode();
922            return hashString.hashCode();
923        }
924    
925        public boolean isActive() {
926            return active;
927        }
928    
929        public void setActive(boolean active) {
930            this.active = active;
931        }
932    
933        /**
934         * Gets the organizationName attribute for report
935         * 
936         * @return Returns the organizationName
937         */
938        public String getOrganizationCodeForReport() {
939            return organizationCode;
940        }
941    }