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    
017    package org.kuali.kfs.coa.businessobject;
018    
019    import java.sql.Date;
020    import java.util.ArrayList;
021    import java.util.Calendar;
022    import java.util.Collection;
023    import java.util.HashMap;
024    import java.util.LinkedHashMap;
025    import java.util.List;
026    import java.util.Map;
027    
028    import org.apache.commons.lang.StringUtils;
029    import org.apache.commons.lang.time.DateUtils;
030    import org.apache.ojb.broker.PersistenceBroker;
031    import org.apache.ojb.broker.PersistenceBrokerException;
032    import org.kuali.kfs.coa.service.SubFundGroupService;
033    import org.kuali.kfs.gl.businessobject.SufficientFundRebuild;
034    import org.kuali.kfs.integration.cg.ContractsAndGrantsAccountAwardInformation;
035    import org.kuali.kfs.integration.cg.ContractsAndGrantsCfda;
036    import org.kuali.kfs.integration.cg.ContractsAndGrantsModuleService;
037    import org.kuali.kfs.sys.context.SpringContext;
038    import org.kuali.rice.kim.bo.Person;
039    import org.kuali.rice.kim.service.KIMServiceLocator;
040    import org.kuali.rice.kim.service.PersonService;
041    import org.kuali.rice.kns.bo.Campus;
042    import org.kuali.rice.kns.bo.Inactivateable;
043    import org.kuali.rice.kns.bo.PersistableBusinessObject;
044    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
045    import org.kuali.rice.kns.bo.PostalCode;
046    import org.kuali.rice.kns.bo.State;
047    import org.kuali.rice.kns.service.BusinessObjectService;
048    import org.kuali.rice.kns.service.DateTimeService;
049    import org.kuali.rice.kns.service.KualiModuleService;
050    import org.kuali.rice.kns.service.PostalCodeService;
051    import org.kuali.rice.kns.service.StateService;
052    
053    /**
054     * 
055     */
056    public class Account extends PersistableBusinessObjectBase implements AccountIntf, Inactivateable {
057        protected static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Account.class);
058    
059        private String chartOfAccountsCode;
060        private String accountNumber;
061        private String accountName;
062        private boolean accountsFringesBnftIndicator;
063        private Date accountRestrictedStatusDate;
064        private String accountCityName;
065        private String accountStateCode;
066        private String accountStreetAddress;
067        private String accountZipCode;
068        private Date accountCreateDate;
069        private Date accountEffectiveDate;
070        private Date accountExpirationDate;
071        private String acctIndirectCostRcvyTypeCd;
072        private String acctCustomIndCstRcvyExclCd;
073        private String financialIcrSeriesIdentifier;
074        private boolean accountInFinancialProcessingIndicator;
075        private String budgetRecordingLevelCode;
076        private String accountSufficientFundsCode;
077        private boolean pendingAcctSufficientFundsIndicator;
078        private boolean extrnlFinEncumSufficntFndIndicator;
079        private boolean intrnlFinEncumSufficntFndIndicator;
080        private boolean finPreencumSufficientFundIndicator;
081        private boolean financialObjectivePrsctrlIndicator;
082        private String accountCfdaNumber;
083        private boolean accountOffCampusIndicator;
084        private boolean active;
085    
086        private String accountFiscalOfficerSystemIdentifier;
087        private String accountsSupervisorySystemsIdentifier;
088        private String accountManagerSystemIdentifier;
089        private String organizationCode;
090        private String accountTypeCode;
091        private String accountPhysicalCampusCode;
092        private String subFundGroupCode;
093        private String financialHigherEdFunctionCd;
094        private String accountRestrictedStatusCode;
095        private String reportsToChartOfAccountsCode;
096        private String reportsToAccountNumber;
097        private String continuationFinChrtOfAcctCd;
098        private String continuationAccountNumber;
099        private String endowmentIncomeAcctFinCoaCd;
100        private String endowmentIncomeAccountNumber;
101        private String contractControlFinCoaCode;
102        private String contractControlAccountNumber;
103        private String incomeStreamFinancialCoaCode;
104        private String incomeStreamAccountNumber;
105        private String indirectCostRcvyFinCoaCode;
106        private String indirectCostRecoveryAcctNbr;
107        private Integer contractsAndGrantsAccountResponsibilityId;
108    
109        private Chart chartOfAccounts;
110        private Chart endowmentIncomeChartOfAccounts;
111        private Organization organization;
112        private AccountType accountType;
113        private Campus accountPhysicalCampus;
114        private State accountState;
115        private SubFundGroup subFundGroup;
116        private HigherEducationFunction financialHigherEdFunction;
117        private RestrictedStatus accountRestrictedStatus;
118        private Account reportsToAccount;
119        private Account continuationAccount;
120        private Account endowmentIncomeAccount;
121        private Account contractControlAccount;
122        private Account incomeStreamAccount;
123        private Account indirectCostRecoveryAcct;
124        private IndirectCostRecoveryType acctIndirectCostRcvyType;
125        private Person accountFiscalOfficerUser;
126        private Person accountSupervisoryUser;
127        private Person accountManagerUser;
128        private PostalCode postalZipCode;
129        private BudgetRecordingLevel budgetRecordingLevel;
130        private SufficientFundsCode sufficientFundsCode;
131        private ContractsAndGrantsCfda cfda;
132    
133        protected Chart fringeBenefitsChartOfAccount;
134        protected Chart continuationChartOfAccount;
135        protected Chart incomeStreamChartOfAccounts;
136        protected Chart contractControlChartOfAccounts;
137        protected Chart indirectCostRcvyChartOfAccounts;
138        
139        // Several kinds of Dummy Attributes for dividing sections on Inquiry page
140        private String accountResponsibilitySectionBlank;
141        private String accountResponsibilitySection;
142        private String contractsAndGrantsSectionBlank;
143        private String contractsAndGrantsSection;
144        private String guidelinesAndPurposeSectionBlank;
145        private String guidelinesAndPurposeSection;
146        private String accountDescriptionSectionBlank;
147        private String accountDescriptionSection;
148    
149        private Boolean forContractsAndGrants;
150    
151        private AccountGuideline accountGuideline;
152        private AccountDescription accountDescription;
153    
154        private List subAccounts;
155        private List<ContractsAndGrantsAccountAwardInformation> awards;
156    
157        /**
158         * Default no-arg constructor.
159         */
160        public Account() {
161            active = true; // assume active is true until set otherwise
162        }
163        
164        /**
165         * This method gathers all SubAccounts related to this account if the account is marked as closed to deactivate
166         */
167        public List<PersistableBusinessObject> generateDeactivationsToPersist() {
168            BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
169    
170            // retreive all the existing sub accounts for this
171            List<SubAccount> bosToDeactivate = new ArrayList();
172            Map<String, Object> fieldValues;
173            Collection existingSubAccounts;
174            if (!isActive()) {
175                fieldValues = new HashMap();
176                fieldValues.put("chartOfAccountsCode", this.getChartOfAccountsCode());
177                fieldValues.put("accountNumber", this.getAccountNumber());
178                fieldValues.put("active", true);
179                existingSubAccounts = boService.findMatching(SubAccount.class, fieldValues);
180                bosToDeactivate.addAll(existingSubAccounts);
181            }
182    
183    
184            // mark all the sub accounts as inactive
185            for (SubAccount subAccount : bosToDeactivate) {
186                subAccount.setActive(false);
187            }
188            return new ArrayList<PersistableBusinessObject>(bosToDeactivate);
189        }
190    
191        /**
192         * Gets the accountNumber attribute.
193         * 
194         * @return Returns the accountNumber
195         */
196        public String getAccountNumber() {
197            return accountNumber;
198        }
199    
200        /**
201         * Sets the accountNumber attribute.
202         * 
203         * @param accountNumber The accountNumber to set.
204         */
205        public void setAccountNumber(String accountNumber) {
206            this.accountNumber = accountNumber;
207        }
208    
209        /**
210         * Gets the accountName attribute.
211         * 
212         * @return Returns the accountName
213         */
214        public String getAccountName() {
215            return accountName;
216        }
217    
218        /**
219         * Sets the accountName attribute.
220         * 
221         * @param accountName The accountName to set.
222         */
223        public void setAccountName(String accountName) {
224            this.accountName = accountName;
225        }
226    
227        /**
228         * Gets the _AccountsFringesBnftIndicator_ attribute.
229         * 
230         * @return Returns the _AccountsFringesBnftIndicator_
231         */
232        public boolean isAccountsFringesBnftIndicator() {
233            return accountsFringesBnftIndicator;
234        }
235    
236        /**
237         * Sets the _AccountsFringesBnftIndicator_ attribute.
238         * 
239         * @param _AccountsFringesBnftIndicator_ The _AccountsFringesBnftIndicator_ to set.
240         */
241        public void setAccountsFringesBnftIndicator(boolean _AccountsFringesBnftIndicator_) {
242            this.accountsFringesBnftIndicator = _AccountsFringesBnftIndicator_;
243        }
244    
245        /**
246         * Gets the accountRestrictedStatusDate attribute.
247         * 
248         * @return Returns the accountRestrictedStatusDate
249         */
250        public Date getAccountRestrictedStatusDate() {
251            return accountRestrictedStatusDate;
252        }
253    
254        /**
255         * Sets the accountRestrictedStatusDate attribute.
256         * 
257         * @param accountRestrictedStatusDate The accountRestrictedStatusDate to set.
258         */
259        public void setAccountRestrictedStatusDate(Date accountRestrictedStatusDate) {
260            this.accountRestrictedStatusDate = accountRestrictedStatusDate;
261        }
262    
263        /**
264         * Gets the accountCityName attribute.
265         * 
266         * @return Returns the accountCityName
267         */
268        public String getAccountCityName() {
269            return accountCityName;
270        }
271    
272        /**
273         * Sets the accountCityName attribute.
274         * 
275         * @param accountCityName The accountCityName to set.
276         */
277        public void setAccountCityName(String accountCityName) {
278            this.accountCityName = accountCityName;
279        }
280    
281        /**
282         * Gets the accountStateCode attribute.
283         * 
284         * @return Returns the accountStateCode
285         */
286        public String getAccountStateCode() {
287            return accountStateCode;
288        }
289    
290        /**
291         * Sets the accountStateCode attribute.
292         * 
293         * @param accountStateCode The accountStateCode to set.
294         */
295        public void setAccountStateCode(String accountStateCode) {
296            this.accountStateCode = accountStateCode;
297        }
298    
299        /**
300         * Gets the accountStreetAddress attribute.
301         * 
302         * @return Returns the accountStreetAddress
303         */
304        public String getAccountStreetAddress() {
305            return accountStreetAddress;
306        }
307    
308        /**
309         * Sets the accountStreetAddress attribute.
310         * 
311         * @param accountStreetAddress The accountStreetAddress to set.
312         */
313        public void setAccountStreetAddress(String accountStreetAddress) {
314            this.accountStreetAddress = accountStreetAddress;
315        }
316    
317        /**
318         * Gets the accountZipCode attribute.
319         * 
320         * @return Returns the accountZipCode
321         */
322        public String getAccountZipCode() {
323            return accountZipCode;
324        }
325    
326        /**
327         * Sets the accountZipCode attribute.
328         * 
329         * @param accountZipCode The accountZipCode to set.
330         */
331        public void setAccountZipCode(String accountZipCode) {
332            this.accountZipCode = accountZipCode;
333        }
334    
335        /**
336         * Gets the accountCreateDate attribute.
337         * 
338         * @return Returns the accountCreateDate
339         */
340        public Date getAccountCreateDate() {
341            return accountCreateDate;
342        }
343    
344        /**
345         * Sets the accountCreateDate attribute.
346         * 
347         * @param accountCreateDate The accountCreateDate to set.
348         */
349        public void setAccountCreateDate(Date accountCreateDate) {
350            this.accountCreateDate = accountCreateDate;
351        }
352    
353        /**
354         * Gets the accountEffectiveDate attribute.
355         * 
356         * @return Returns the accountEffectiveDate
357         */
358        public Date getAccountEffectiveDate() {
359            return accountEffectiveDate;
360        }
361    
362        /**
363         * Sets the accountEffectiveDate attribute.
364         * 
365         * @param accountEffectiveDate The accountEffectiveDate to set.
366         */
367        public void setAccountEffectiveDate(Date accountEffectiveDate) {
368            this.accountEffectiveDate = accountEffectiveDate;
369        }
370    
371        /**
372         * Gets the accountExpirationDate attribute.
373         * 
374         * @return Returns the accountExpirationDate
375         */
376        public Date getAccountExpirationDate() {
377            return accountExpirationDate;
378        }
379    
380        /**
381         * Sets the accountExpirationDate attribute.
382         * 
383         * @param accountExpirationDate The accountExpirationDate to set.
384         */
385        public void setAccountExpirationDate(Date accountExpirationDate) {
386            this.accountExpirationDate = accountExpirationDate;
387        }
388    
389        /**
390         * This method determines whether the account is expired or not. Note that if Expiration Date is the same as today, then this
391         * will return false. It will only return true if the account expiration date is one day earlier than today or earlier. Note
392         * that this logic ignores all time components when doing the comparison. It only does the before/after comparison based on date
393         * values, not time-values.
394         * 
395         * @return true or false based on the logic outlined above
396         */
397        public boolean isExpired() {
398            LOG.debug("entering isExpired()");
399            // dont even bother trying to test if the accountExpirationDate is null
400            if (this.accountExpirationDate == null) {
401                return false;
402            }
403    
404            return this.isExpired(SpringContext.getBean(DateTimeService.class).getCurrentCalendar());
405        }
406    
407        /**
408         * This method determines whether the account is expired or not. Note that if Expiration Date is the same date as testDate, then
409         * this will return false. It will only return true if the account expiration date is one day earlier than testDate or earlier.
410         * Note that this logic ignores all time components when doing the comparison. It only does the before/after comparison based on
411         * date values, not time-values.
412         * 
413         * @param testDate - Calendar instance with the date to test the Account's Expiration Date against. This is most commonly set to
414         *        today's date.
415         * @return true or false based on the logic outlined above
416         */
417        public boolean isExpired(Calendar testDate) {
418            if (LOG.isDebugEnabled()) {
419                LOG.debug("entering isExpired(" + testDate + ")");
420            }
421    
422            // dont even bother trying to test if the accountExpirationDate is null
423            if (this.accountExpirationDate == null) {
424                return false;
425            }
426    
427            // remove any time-components from the testDate
428            testDate = DateUtils.truncate(testDate, Calendar.DAY_OF_MONTH);
429    
430            // get a calendar reference to the Account Expiration
431            // date, and remove any time components
432            Calendar acctDate = Calendar.getInstance();
433            acctDate.setTime(this.accountExpirationDate);
434            acctDate = DateUtils.truncate(acctDate, Calendar.DAY_OF_MONTH);
435    
436            // if the Account Expiration Date is before the testDate
437            if (acctDate.before(testDate)) {
438                return true;
439            }
440            else {
441                return false;
442            }
443        }
444    
445        /**
446         * This method determines whether the account is expired or not. Note that if Expiration Date is the same date as testDate, then
447         * this will return false. It will only return true if the account expiration date is one day earlier than testDate or earlier.
448         * Note that this logic ignores all time components when doing the comparison. It only does the before/after comparison based on
449         * date values, not time-values.
450         * 
451         * @param testDate - java.util.Date instance with the date to test the Account's Expiration Date against. This is most commonly
452         *        set to today's date.
453         * @return true or false based on the logic outlined above
454         */
455        public boolean isExpired(Date testDate) {
456    
457            // dont even bother trying to test if the accountExpirationDate is null
458            if (this.accountExpirationDate == null) {
459                return false;
460            }
461    
462            Calendar acctDate = Calendar.getInstance();
463            acctDate.setTime(testDate);
464            return isExpired(acctDate);
465        }
466    
467        /**
468         * Gets the acctIndirectCostRcvyTypeCd attribute.
469         * 
470         * @return Returns the acctIndirectCostRcvyTypeCd
471         */
472        public String getAcctIndirectCostRcvyTypeCd() {
473            return acctIndirectCostRcvyTypeCd;
474        }
475    
476        /**
477         * Sets the acctIndirectCostRcvyTypeCd attribute.
478         * 
479         * @param acctIndirectCostRcvyTypeCd The acctIndirectCostRcvyTypeCd to set.
480         */
481        public void setAcctIndirectCostRcvyTypeCd(String acctIndirectCostRcvyTypeCd) {
482            this.acctIndirectCostRcvyTypeCd = acctIndirectCostRcvyTypeCd;
483        }
484    
485        /**
486         * Gets the acctCustomIndCstRcvyExclCd attribute.
487         * 
488         * @return Returns the acctCustomIndCstRcvyExclCd
489         */
490        public String getAcctCustomIndCstRcvyExclCd() {
491            return acctCustomIndCstRcvyExclCd;
492        }
493    
494        /**
495         * Sets the acctCustomIndCstRcvyExclCd attribute.
496         * 
497         * @param acctCustomIndCstRcvyExclCd The acctCustomIndCstRcvyExclCd to set.
498         */
499        public void setAcctCustomIndCstRcvyExclCd(String acctCustomIndCstRcvyExclCd) {
500            this.acctCustomIndCstRcvyExclCd = acctCustomIndCstRcvyExclCd;
501        }
502    
503        /**
504         * Gets the financialIcrSeriesIdentifier attribute.
505         * 
506         * @return Returns the financialIcrSeriesIdentifier
507         */
508        public String getFinancialIcrSeriesIdentifier() {
509            return financialIcrSeriesIdentifier;
510        }
511    
512        /**
513         * Sets the financialIcrSeriesIdentifier attribute.
514         * 
515         * @param financialIcrSeriesIdentifier The financialIcrSeriesIdentifier to set.
516         */
517        public void setFinancialIcrSeriesIdentifier(String financialIcrSeriesIdentifier) {
518            this.financialIcrSeriesIdentifier = financialIcrSeriesIdentifier;
519        }
520    
521        /**
522         * Gets the accountInFinancialProcessingIndicator attribute.
523         * 
524         * @return Returns the accountInFinancialProcessingIndicator
525         */
526        public boolean getAccountInFinancialProcessingIndicator() {
527            return accountInFinancialProcessingIndicator;
528        }
529    
530        /**
531         * Sets the accountInFinancialProcessingIndicator attribute.
532         * 
533         * @param accountInFinancialProcessingIndicator The accountInFinancialProcessingIndicator to set.
534         */
535        public void setAccountInFinancialProcessingIndicator(boolean accountInFinancialProcessingIndicator) {
536            this.accountInFinancialProcessingIndicator = accountInFinancialProcessingIndicator;
537        }
538    
539        /**
540         * Gets the budgetRecordingLevelCode attribute.
541         * 
542         * @return Returns the budgetRecordingLevelCode
543         */
544        public String getBudgetRecordingLevelCode() {
545            return budgetRecordingLevelCode;
546        }
547    
548        /**
549         * Sets the budgetRecordingLevelCode attribute.
550         * 
551         * @param budgetRecordingLevelCode The budgetRecordingLevelCode to set.
552         */
553        public void setBudgetRecordingLevelCode(String budgetRecordingLevelCode) {
554            this.budgetRecordingLevelCode = budgetRecordingLevelCode;
555        }
556    
557        /**
558         * Gets the accountSufficientFundsCode attribute.
559         * 
560         * @return Returns the accountSufficientFundsCode
561         */
562        public String getAccountSufficientFundsCode() {
563            return accountSufficientFundsCode;
564        }
565    
566        /**
567         * Sets the accountSufficientFundsCode attribute.
568         * 
569         * @param accountSufficientFundsCode The accountSufficientFundsCode to set.
570         */
571        public void setAccountSufficientFundsCode(String accountSufficientFundsCode) {
572            this.accountSufficientFundsCode = accountSufficientFundsCode;
573        }
574    
575        /**
576         * Gets the pendingAcctSufficientFundsIndicator attribute.
577         * 
578         * @return Returns the pendingAcctSufficientFundsIndicator
579         */
580        public boolean isPendingAcctSufficientFundsIndicator() {
581            return pendingAcctSufficientFundsIndicator;
582        }
583    
584        /**
585         * Sets the pendingAcctSufficientFundsIndicator attribute.
586         * 
587         * @param pendingAcctSufficientFundsIndicator The pendingAcctSufficientFundsIndicator to set.
588         */
589        public void setPendingAcctSufficientFundsIndicator(boolean pendingAcctSufficientFundsIndicator) {
590            this.pendingAcctSufficientFundsIndicator = pendingAcctSufficientFundsIndicator;
591        }
592    
593        /**
594         * Gets the extrnlFinEncumSufficntFndIndicator attribute.
595         * 
596         * @return Returns the extrnlFinEncumSufficntFndIndicator
597         */
598        public boolean isExtrnlFinEncumSufficntFndIndicator() {
599            return extrnlFinEncumSufficntFndIndicator;
600        }
601    
602        /**
603         * Sets the extrnlFinEncumSufficntFndIndicator attribute.
604         * 
605         * @param extrnlFinEncumSufficntFndIndicator The extrnlFinEncumSufficntFndIndicator to set.
606         */
607        public void setExtrnlFinEncumSufficntFndIndicator(boolean extrnlFinEncumSufficntFndIndicator) {
608            this.extrnlFinEncumSufficntFndIndicator = extrnlFinEncumSufficntFndIndicator;
609        }
610    
611        /**
612         * Gets the intrnlFinEncumSufficntFndIndicator attribute.
613         * 
614         * @return Returns the intrnlFinEncumSufficntFndIndicator
615         */
616        public boolean isIntrnlFinEncumSufficntFndIndicator() {
617            return intrnlFinEncumSufficntFndIndicator;
618        }
619    
620        /**
621         * Sets the intrnlFinEncumSufficntFndIndicator attribute.
622         * 
623         * @param intrnlFinEncumSufficntFndIndicator The intrnlFinEncumSufficntFndIndicator to set.
624         */
625        public void setIntrnlFinEncumSufficntFndIndicator(boolean intrnlFinEncumSufficntFndIndicator) {
626            this.intrnlFinEncumSufficntFndIndicator = intrnlFinEncumSufficntFndIndicator;
627        }
628    
629        /**
630         * Gets the finPreencumSufficientFundIndicator attribute.
631         * 
632         * @return Returns the finPreencumSufficientFundIndicator
633         */
634        public boolean isFinPreencumSufficientFundIndicator() {
635            return finPreencumSufficientFundIndicator;
636        }
637    
638        /**
639         * Sets the finPreencumSufficientFundIndicator attribute.
640         * 
641         * @param finPreencumSufficientFundIndicator The finPreencumSufficientFundIndicator to set.
642         */
643        public void setFinPreencumSufficientFundIndicator(boolean finPreencumSufficientFundIndicator) {
644            this.finPreencumSufficientFundIndicator = finPreencumSufficientFundIndicator;
645        }
646    
647        /**
648         * Gets the _FinancialObjectivePrsctrlIndicator_ attribute.
649         * 
650         * @return Returns the _FinancialObjectivePrsctrlIndicator_
651         */
652        public boolean isFinancialObjectivePrsctrlIndicator() {
653            return financialObjectivePrsctrlIndicator;
654        }
655    
656        /**
657         * Sets the _FinancialObjectivePrsctrlIndicator_ attribute.
658         * 
659         * @param _FinancialObjectivePrsctrlIndicator_ The _FinancialObjectivePrsctrlIndicator_ to set.
660         */
661        public void setFinancialObjectivePrsctrlIndicator(boolean _FinancialObjectivePrsctrlIndicator_) {
662            this.financialObjectivePrsctrlIndicator = _FinancialObjectivePrsctrlIndicator_;
663        }
664    
665        /**
666         * Gets the accountCfdaNumber attribute.
667         * 
668         * @return Returns the accountCfdaNumber
669         */
670        public String getAccountCfdaNumber() {
671            return accountCfdaNumber;
672        }
673    
674        /**
675         * Sets the accountCfdaNumber attribute.
676         * 
677         * @param accountCfdaNumber The accountCfdaNumber to set.
678         */
679        public void setAccountCfdaNumber(String accountCfdaNumber) {
680            this.accountCfdaNumber = accountCfdaNumber;
681        }
682    
683        /**
684         * Gets the related CFDA record for this account
685         * 
686         * @return a CFDA record
687         */
688        public ContractsAndGrantsCfda getCfda() {
689            return cfda = (ContractsAndGrantsCfda) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(ContractsAndGrantsCfda.class).retrieveExternalizableBusinessObjectIfNecessary(this, cfda, "cfda");
690        }
691        
692        public List<ContractsAndGrantsAccountAwardInformation> getAwards() {
693            // TODO this code totally breaks modularization but can't be fixed until data dictionary modularization plans come down the
694            // pike
695            awards = (List) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(ContractsAndGrantsAccountAwardInformation.class).retrieveExternalizableBusinessObjectsList(this, "awards", ContractsAndGrantsAccountAwardInformation.class);
696            return awards;
697        }
698        
699        public void setAwards(List awards) {
700            this.awards = awards;
701        }
702    
703        /**
704         * Gets the accountOffCampusIndicator attribute.
705         * 
706         * @return Returns the accountOffCampusIndicator
707         */
708        public boolean isAccountOffCampusIndicator() {
709            return accountOffCampusIndicator;
710        }
711    
712        /**
713         * Sets the accountOffCampusIndicator attribute.
714         * 
715         * @param accountOffCampusIndicator The accountOffCampusIndicator to set.
716         */
717        public void setAccountOffCampusIndicator(boolean accountOffCampusIndicator) {
718            this.accountOffCampusIndicator = accountOffCampusIndicator;
719        }
720    
721        /**
722         * Gets the active attribute.
723         * 
724         * @return Returns the active
725         */
726        public boolean isActive() {
727            return active;
728        }
729    
730        /**
731         * Sets the active attribute.
732         * 
733         * @param active The active to set.
734         */
735        public void setActive(boolean active) {
736            this.active = active;
737        }
738    
739        /**
740         * Returns whether this account is not active or not
741         * 
742         * @return the opposite of isActive()
743         */
744        public boolean isClosed() {
745            return !active;
746        }
747        
748        /**
749         * Sets the closed attribute.
750         * 
751         * @param closed The closed to set.
752         */
753        public void setClosed(boolean closed) {
754            this.active = !closed;
755        }
756    
757        /**
758         * Gets the chartOfAccounts attribute.
759         * 
760         * @return Returns the chartOfAccounts
761         */
762        public Chart getChartOfAccounts() {
763            return chartOfAccounts;
764        }
765    
766        /**
767         * Sets the chartOfAccounts attribute.
768         * 
769         * @param chartOfAccounts The chartOfAccounts to set.
770         * @deprecated
771         */
772        public void setChartOfAccounts(Chart chartOfAccounts) {
773            this.chartOfAccounts = chartOfAccounts;
774        }
775    
776        /**
777         * Gets the organization attribute.
778         * 
779         * @return Returns the organization
780         */
781        public Organization getOrganization() {
782            return organization;
783        }
784    
785        /**
786         * Sets the organization attribute.
787         * 
788         * @param organization The organization to set.
789         * @deprecated
790         */
791        public void setOrganization(Organization organization) {
792            this.organization = organization;
793        }
794    
795        /**
796         * Gets the accountType attribute.
797         * 
798         * @return Returns the accountType
799         */
800        public AccountType getAccountType() {
801            return accountType;
802        }
803    
804        /**
805         * Sets the accountType attribute.
806         * 
807         * @param accountType The accountType to set.
808         * @deprecated
809         */
810        public void setAccountType(AccountType accountType) {
811            this.accountType = accountType;
812        }
813    
814        /**
815         * Gets the accountPhysicalCampus attribute.
816         * 
817         * @return Returns the accountPhysicalCampus
818         */
819        public Campus getAccountPhysicalCampus() {
820            return accountPhysicalCampus = (Campus) SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(Campus.class).retrieveExternalizableBusinessObjectIfNecessary(this, accountPhysicalCampus, "accountPhysicalCampus");
821        }
822    
823        /**
824         * Sets the accountPhysicalCampus attribute.
825         * 
826         * @param accountPhysicalCampus The accountPhysicalCampus to set.
827         * @deprecated
828         */
829        public void setAccountPhysicalCampus(Campus accountPhysicalCampus) {
830            this.accountPhysicalCampus = accountPhysicalCampus;
831        }
832    
833        /**
834         * Gets the accountState attribute
835         * 
836         * @return Returns the accountState
837         */
838        public State getAccountState() {
839            accountState = SpringContext.getBean(StateService.class).getByPrimaryIdIfNecessary(accountStateCode, accountState);
840            return accountState;
841        }
842    
843        /**
844         * Sets the accountState attribute
845         * 
846         * @param state
847         * @deprecated
848         */
849        public void setAccountState(State state) {
850            this.accountState = state;
851        }
852    
853        /**
854         * Gets the subFundGroup attribute.
855         * 
856         * @return Returns the subFundGroup
857         */
858        public SubFundGroup getSubFundGroup() {
859            return subFundGroup;
860        }
861    
862        /**
863         * Sets the subFundGroup attribute.
864         * 
865         * @param subFundGroup The subFundGroup to set.
866         * @deprecated
867         */
868        public void setSubFundGroup(SubFundGroup subFundGroup) {
869            this.subFundGroup = subFundGroup;
870        }
871    
872        /**
873         * Gets the financialHigherEdFunction attribute.
874         * 
875         * @return Returns the financialHigherEdFunction
876         */
877        public HigherEducationFunction getFinancialHigherEdFunction() {
878            return financialHigherEdFunction;
879        }
880    
881        /**
882         * Sets the financialHigherEdFunction attribute.
883         * 
884         * @param financialHigherEdFunction The financialHigherEdFunction to set.
885         * @deprecated
886         */
887        public void setFinancialHigherEdFunction(HigherEducationFunction financialHigherEdFunction) {
888            this.financialHigherEdFunction = financialHigherEdFunction;
889        }
890    
891        /**
892         * Gets the accountRestrictedStatus attribute.
893         * 
894         * @return Returns the accountRestrictedStatus
895         */
896        public RestrictedStatus getAccountRestrictedStatus() {
897            return accountRestrictedStatus;
898        }
899    
900        /**
901         * Sets the accountRestrictedStatus attribute.
902         * 
903         * @param accountRestrictedStatus The accountRestrictedStatus to set.
904         * @deprecated
905         */
906        public void setAccountRestrictedStatus(RestrictedStatus accountRestrictedStatus) {
907            this.accountRestrictedStatus = accountRestrictedStatus;
908        }
909    
910        /**
911         * Gets the reportsToAccount attribute.
912         * 
913         * @return Returns the reportsToAccount
914         */
915        public Account getReportsToAccount() {
916            return reportsToAccount;
917        }
918    
919        /**
920         * Sets the reportsToAccount attribute.
921         * 
922         * @param reportsToAccount The reportsToAccount to set.
923         * @deprecated
924         */
925        public void setReportsToAccount(Account reportsToAccount) {
926            this.reportsToAccount = reportsToAccount;
927        }
928    
929        /**
930         * Gets the endowmentIncomeAccount attribute.
931         * 
932         * @return Returns the endowmentIncomeAccount
933         */
934        public Account getEndowmentIncomeAccount() {
935            return endowmentIncomeAccount;
936        }
937    
938        /**
939         * Sets the endowmentIncomeAccount attribute.
940         * 
941         * @param endowmentIncomeAccount The endowmentIncomeAccount to set.
942         * @deprecated
943         */
944        public void setEndowmentIncomeAccount(Account endowmentIncomeAccount) {
945            this.endowmentIncomeAccount = endowmentIncomeAccount;
946        }
947    
948        /**
949         * Gets the contractControlAccount attribute.
950         * 
951         * @return Returns the contractControlAccount
952         */
953        public Account getContractControlAccount() {
954            return contractControlAccount;
955        }
956    
957        /**
958         * Sets the contractControlAccount attribute.
959         * 
960         * @param contractControlAccount The contractControlAccount to set.
961         * @deprecated
962         */
963        public void setContractControlAccount(Account contractControlAccount) {
964            this.contractControlAccount = contractControlAccount;
965        }
966    
967    
968        /**
969         * Gets the incomeStreamAccount attribute.
970         * 
971         * @return Returns the incomeStreamAccount
972         */
973        public Account getIncomeStreamAccount() {
974            return incomeStreamAccount;
975        }
976    
977        /**
978         * Sets the incomeStreamAccount attribute.
979         * 
980         * @param incomeStreamAccount The incomeStreamAccount to set.
981         * @deprecated
982         */
983        public void setIncomeStreamAccount(Account incomeStreamAccount) {
984            this.incomeStreamAccount = incomeStreamAccount;
985        }
986    
987        /**
988         * Gets the indirectCostRecoveryAcct attribute.
989         * 
990         * @return Returns the indirectCostRecoveryAcct
991         */
992        public Account getIndirectCostRecoveryAcct() {
993            return indirectCostRecoveryAcct;
994        }
995    
996        /**
997         * Sets the indirectCostRecoveryAcct attribute.
998         * 
999         * @param indirectCostRecoveryAcct The indirectCostRecoveryAcct to set.
1000         * @deprecated
1001         */
1002        public void setIndirectCostRecoveryAcct(Account indirectCostRecoveryAcct) {
1003            this.indirectCostRecoveryAcct = indirectCostRecoveryAcct;
1004        }
1005    
1006    
1007        public Person getAccountFiscalOfficerUser() {
1008            // **** This fix is temporary until Jonathan's fix is reflected to Rice
1009            //accountFiscalOfficerUser = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(accountFiscalOfficerSystemIdentifier, accountFiscalOfficerUser);
1010            //return accountFiscalOfficerUser;
1011            PersonService<Person> personService = KIMServiceLocator.getPersonService();
1012            accountFiscalOfficerUser = personService.getPerson(accountFiscalOfficerSystemIdentifier);
1013            return accountFiscalOfficerUser;
1014        }
1015        
1016        /**
1017         * This fix is temporary until Jonathan's fix is reflected to Rice
1018         * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#refreshReferenceObject(java.lang.String)
1019         */
1020        public void refreshReferenceObject(String referenceObjectName) {
1021            if (referenceObjectName.equals("accountFiscalOfficerUser") ||
1022                referenceObjectName.equals("accountSupervisoryUser") ||
1023                referenceObjectName.equals("accountManagerUser")) {
1024                getAccountFiscalOfficerUser();
1025            } else {
1026                super.refreshReferenceObject(referenceObjectName);
1027            }
1028        }
1029    
1030       /**
1031         * @param accountFiscalOfficerUser The accountFiscalOfficerUser to set.
1032         * @deprecated
1033         */
1034        public void setAccountFiscalOfficerUser(Person accountFiscalOfficerUser) {
1035            this.accountFiscalOfficerUser = accountFiscalOfficerUser;
1036        }
1037    
1038        public Person getAccountManagerUser() {
1039            accountManagerUser = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(accountManagerSystemIdentifier, accountManagerUser);
1040            return accountManagerUser;
1041        }
1042    
1043        /**
1044         * @param accountManagerUser The accountManagerUser to set.
1045         * @deprecated
1046         */
1047        public void setAccountManagerUser(Person accountManagerUser) {
1048            this.accountManagerUser = accountManagerUser;
1049        }
1050    
1051    
1052        public Person getAccountSupervisoryUser() {
1053            accountSupervisoryUser = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(accountsSupervisorySystemsIdentifier, accountSupervisoryUser);
1054            return accountSupervisoryUser;
1055        }
1056    
1057        /**
1058         * @param accountSupervisoryUser The accountSupervisoryUser to set.
1059         * @deprecated
1060         */
1061        public void setAccountSupervisoryUser(Person accountSupervisoryUser) {
1062            this.accountSupervisoryUser = accountSupervisoryUser;
1063        }
1064    
1065    
1066        /**
1067         * @return Returns the continuationAccount.
1068         */
1069        public Account getContinuationAccount() {
1070            return continuationAccount;
1071        }
1072    
1073    
1074        /**
1075         * @param continuationAccount The continuationAccount to set.
1076         * @deprecated
1077         */
1078        public void setContinuationAccount(Account continuationAccount) {
1079            this.continuationAccount = continuationAccount;
1080        }
1081    
1082        /**
1083         * @return Returns the accountGuideline.
1084         */
1085        public AccountGuideline getAccountGuideline() {
1086            return accountGuideline;
1087        }
1088    
1089    
1090        /**
1091         * @param accountGuideline The accountGuideline to set.
1092         */
1093        public void setAccountGuideline(AccountGuideline accountGuideline) {
1094            this.accountGuideline = accountGuideline;
1095        }
1096    
1097    
1098        /**
1099         * Gets the accountDescription attribute.
1100         * 
1101         * @return Returns the accountDescription.
1102         */
1103        public AccountDescription getAccountDescription() {
1104            return accountDescription;
1105        }
1106    
1107        /**
1108         * Sets the accountDescription attribute value.
1109         * 
1110         * @param accountDescription The accountDescription to set.
1111         */
1112        public void setAccountDescription(AccountDescription accountDescription) {
1113            this.accountDescription = accountDescription;
1114        }
1115    
1116        /**
1117         * @return Returns the subAccounts.
1118         */
1119        public List getSubAccounts() {
1120            return subAccounts;
1121        }
1122    
1123    
1124        /**
1125         * @param subAccounts The subAccounts to set.
1126         */
1127        public void setSubAccounts(List subAccounts) {
1128            this.subAccounts = subAccounts;
1129        }
1130    
1131    
1132        /**
1133         * @return Returns the chartOfAccountsCode.
1134         */
1135        public String getChartOfAccountsCode() {
1136            return chartOfAccountsCode;
1137        }
1138    
1139    
1140        /**
1141         * @param chartOfAccountsCode The chartOfAccountsCode to set.
1142         */
1143        public void setChartOfAccountsCode(String chartOfAccountsCode) {
1144            this.chartOfAccountsCode = chartOfAccountsCode;
1145        }
1146    
1147    
1148        /**
1149         * @return Returns the accountFiscalOfficerSystemIdentifier.
1150         */
1151        public String getAccountFiscalOfficerSystemIdentifier() {
1152            return accountFiscalOfficerSystemIdentifier;
1153        }
1154    
1155        /**
1156         * @return Returns the accountFiscalOfficerSystemIdentifier.
1157         */
1158        public String getAccountFiscalOfficerSystemIdentifierForSearching() {
1159            return getAccountFiscalOfficerSystemIdentifier();
1160        }
1161        
1162        
1163        /**
1164         * @param accountFiscalOfficerSystemIdentifier The accountFiscalOfficerSystemIdentifier to set.
1165         */
1166        public void setAccountFiscalOfficerSystemIdentifier(String accountFiscalOfficerSystemIdentifier) {
1167            this.accountFiscalOfficerSystemIdentifier = accountFiscalOfficerSystemIdentifier;
1168        }
1169    
1170        /**
1171         * @return Returns the accountManagerSystemIdentifier.
1172         */
1173        public String getAccountManagerSystemIdentifier() {
1174            return accountManagerSystemIdentifier;
1175        }
1176        
1177        /**
1178         * @return Returns the accountManagerSystemIdentifier.
1179         */
1180        public String getAccountManagerSystemIdentifierForSearching() {
1181            return getAccountManagerSystemIdentifier();
1182        }
1183    
1184        /**
1185         * @param accountManagerSystemIdentifier The accountManagerSystemIdentifier to set.
1186         */
1187        public void setAccountManagerSystemIdentifier(String accountManagerSystemIdentifier) {
1188            this.accountManagerSystemIdentifier = accountManagerSystemIdentifier;
1189        }
1190    
1191        /**
1192         * @return Returns the accountPhysicalCampusCode.
1193         */
1194        public String getAccountPhysicalCampusCode() {
1195            return accountPhysicalCampusCode;
1196        }
1197    
1198        /**
1199         * @param accountPhysicalCampusCode The accountPhysicalCampusCode to set.
1200         */
1201        public void setAccountPhysicalCampusCode(String accountPhysicalCampusCode) {
1202            this.accountPhysicalCampusCode = accountPhysicalCampusCode;
1203        }
1204    
1205        /**
1206         * @return Returns the accountRestrictedStatusCode.
1207         */
1208        public String getAccountRestrictedStatusCode() {
1209            return accountRestrictedStatusCode;
1210        }
1211    
1212        /**
1213         * @param accountRestrictedStatusCode The accountRestrictedStatusCode to set.
1214         */
1215        public void setAccountRestrictedStatusCode(String accountRestrictedStatusCode) {
1216            this.accountRestrictedStatusCode = accountRestrictedStatusCode;
1217        }
1218    
1219        /**
1220         * @return Returns the accountsSupervisorySystemsIdentifier.
1221         */
1222        public String getAccountsSupervisorySystemsIdentifier() {
1223            return accountsSupervisorySystemsIdentifier;
1224        }
1225        
1226        /**
1227         * @return Returns the accountsSupervisorySystemsIdentifier.
1228         */
1229        public String getAccountsSupervisorySystemsIdentifierForSearching() {
1230            return accountsSupervisorySystemsIdentifier;
1231        }
1232    
1233        /**
1234         * @param accountsSupervisorySystemsIdentifier The accountsSupervisorySystemsIdentifier to set.
1235         */
1236        public void setAccountsSupervisorySystemsIdentifier(String accountsSupervisorySystemsIdentifier) {
1237            this.accountsSupervisorySystemsIdentifier = accountsSupervisorySystemsIdentifier;
1238        }
1239    
1240        /**
1241         * @return Returns the accountTypeCode.
1242         */
1243        public String getAccountTypeCode() {
1244            return accountTypeCode;
1245        }
1246    
1247        /**
1248         * @param accountTypeCode The accountTypeCode to set.
1249         */
1250        public void setAccountTypeCode(String accountTypeCode) {
1251            this.accountTypeCode = accountTypeCode;
1252        }
1253    
1254        /**
1255         * @return Returns the continuationAccountNumber.
1256         */
1257        public String getContinuationAccountNumber() {
1258            return continuationAccountNumber;
1259        }
1260    
1261        /**
1262         * @param continuationAccountNumber The continuationAccountNumber to set.
1263         */
1264        public void setContinuationAccountNumber(String continuationAccountNumber) {
1265            this.continuationAccountNumber = continuationAccountNumber;
1266        }
1267    
1268        /**
1269         * @return Returns the continuationFinChrtOfAcctCd.
1270         */
1271        public String getContinuationFinChrtOfAcctCd() {
1272            return continuationFinChrtOfAcctCd;
1273        }
1274    
1275        /**
1276         * @param continuationFinChrtOfAcctCd The continuationFinChrtOfAcctCd to set.
1277         */
1278        public void setContinuationFinChrtOfAcctCd(String continuationFinChrtOfAcctCd) {
1279            this.continuationFinChrtOfAcctCd = continuationFinChrtOfAcctCd;
1280        }
1281    
1282        /**
1283         * @return Returns the contractControlAccountNumber.
1284         */
1285        public String getContractControlAccountNumber() {
1286            return contractControlAccountNumber;
1287        }
1288    
1289        /**
1290         * @param contractControlAccountNumber The contractControlAccountNumber to set.
1291         */
1292        public void setContractControlAccountNumber(String contractControlAccountNumber) {
1293            this.contractControlAccountNumber = contractControlAccountNumber;
1294        }
1295    
1296        /**
1297         * @return Returns the contractControlFinCoaCode.
1298         */
1299        public String getContractControlFinCoaCode() {
1300            return contractControlFinCoaCode;
1301        }
1302    
1303        /**
1304         * @param contractControlFinCoaCode The contractControlFinCoaCode to set.
1305         */
1306        public void setContractControlFinCoaCode(String contractControlFinCoaCode) {
1307            this.contractControlFinCoaCode = contractControlFinCoaCode;
1308        }
1309    
1310        /**
1311         * @return Returns the endowmentIncomeAccountNumber.
1312         */
1313        public String getEndowmentIncomeAccountNumber() {
1314            return endowmentIncomeAccountNumber;
1315        }
1316    
1317        /**
1318         * @param endowmentIncomeAccountNumber The endowmentIncomeAccountNumber to set.
1319         */
1320        public void setEndowmentIncomeAccountNumber(String endowmentIncomeAccountNumber) {
1321            this.endowmentIncomeAccountNumber = endowmentIncomeAccountNumber;
1322        }
1323    
1324        /**
1325         * @return Returns the endowmentIncomeAcctFinCoaCd.
1326         */
1327        public String getEndowmentIncomeAcctFinCoaCd() {
1328            return endowmentIncomeAcctFinCoaCd;
1329        }
1330    
1331        /**
1332         * @param endowmentIncomeAcctFinCoaCd The endowmentIncomeAcctFinCoaCd to set.
1333         */
1334        public void setEndowmentIncomeAcctFinCoaCd(String endowmentIncomeAcctFinCoaCd) {
1335            this.endowmentIncomeAcctFinCoaCd = endowmentIncomeAcctFinCoaCd;
1336        }
1337    
1338        /**
1339         * @return Returns the financialHigherEdFunctionCd.
1340         */
1341        public String getFinancialHigherEdFunctionCd() {
1342            return financialHigherEdFunctionCd;
1343        }
1344    
1345        /**
1346         * @param financialHigherEdFunctionCd The financialHigherEdFunctionCd to set.
1347         */
1348        public void setFinancialHigherEdFunctionCd(String financialHigherEdFunctionCd) {
1349            this.financialHigherEdFunctionCd = financialHigherEdFunctionCd;
1350        }
1351    
1352        /**
1353         * @return Returns the incomeStreamAccountNumber.
1354         */
1355        public String getIncomeStreamAccountNumber() {
1356            return incomeStreamAccountNumber;
1357        }
1358    
1359        /**
1360         * @param incomeStreamAccountNumber The incomeStreamAccountNumber to set.
1361         */
1362        public void setIncomeStreamAccountNumber(String incomeStreamAccountNumber) {
1363            this.incomeStreamAccountNumber = incomeStreamAccountNumber;
1364        }
1365    
1366        /**
1367         * @return Returns the incomeStreamFinancialCoaCode.
1368         */
1369        public String getIncomeStreamFinancialCoaCode() {
1370            return incomeStreamFinancialCoaCode;
1371        }
1372    
1373        /**
1374         * @param incomeStreamFinancialCoaCode The incomeStreamFinancialCoaCode to set.
1375         */
1376        public void setIncomeStreamFinancialCoaCode(String incomeStreamFinancialCoaCode) {
1377            this.incomeStreamFinancialCoaCode = incomeStreamFinancialCoaCode;
1378        }
1379    
1380        /**
1381         * @return Returns the indirectCostRcvyFinCoaCode.
1382         */
1383        public String getIndirectCostRcvyFinCoaCode() {
1384            return indirectCostRcvyFinCoaCode;
1385        }
1386    
1387        /**
1388         * @param indirectCostRcvyFinCoaCode The indirectCostRcvyFinCoaCode to set.
1389         */
1390        public void setIndirectCostRcvyFinCoaCode(String indirectCostRcvyFinCoaCode) {
1391            this.indirectCostRcvyFinCoaCode = indirectCostRcvyFinCoaCode;
1392        }
1393    
1394        /**
1395         * @return Returns the indirectCostRecoveryAcctNbr.
1396         */
1397        public String getIndirectCostRecoveryAcctNbr() {
1398            return indirectCostRecoveryAcctNbr;
1399        }
1400    
1401        /**
1402         * @param indirectCostRecoveryAcctNbr The indirectCostRecoveryAcctNbr to set.
1403         */
1404        public void setIndirectCostRecoveryAcctNbr(String indirectCostRecoveryAcctNbr) {
1405            this.indirectCostRecoveryAcctNbr = indirectCostRecoveryAcctNbr;
1406        }
1407    
1408        /**
1409         * @return Returns the organizationCode.
1410         */
1411        public String getOrganizationCode() {
1412            return organizationCode;
1413        }
1414    
1415        /**
1416         * @param organizationCode The organizationCode to set.
1417         */
1418        public void setOrganizationCode(String organizationCode) {
1419            this.organizationCode = organizationCode;
1420        }
1421    
1422        /**
1423         * @return Returns the reportsToAccountNumber.
1424         */
1425        public String getReportsToAccountNumber() {
1426            return reportsToAccountNumber;
1427        }
1428    
1429        /**
1430         * @param reportsToAccountNumber The reportsToAccountNumber to set.
1431         */
1432        public void setReportsToAccountNumber(String reportsToAccountNumber) {
1433            this.reportsToAccountNumber = reportsToAccountNumber;
1434        }
1435    
1436        /**
1437         * @return Returns the reportsToChartOfAccountsCode.
1438         */
1439        public String getReportsToChartOfAccountsCode() {
1440            return reportsToChartOfAccountsCode;
1441        }
1442    
1443        /**
1444         * @param reportsToChartOfAccountsCode The reportsToChartOfAccountsCode to set.
1445         */
1446        public void setReportsToChartOfAccountsCode(String reportsToChartOfAccountsCode) {
1447            this.reportsToChartOfAccountsCode = reportsToChartOfAccountsCode;
1448        }
1449    
1450        /**
1451         * @return Returns the subFundGroupCode.
1452         */
1453        public String getSubFundGroupCode() {
1454            return subFundGroupCode;
1455        }
1456    
1457        /**
1458         * @param subFundGroupCode The subFundGroupCode to set.
1459         */
1460        public void setSubFundGroupCode(String subFundGroupCode) {        
1461            this.subFundGroupCode = subFundGroupCode;
1462            forContractsAndGrants = null;
1463        }
1464    
1465        /**
1466         * Gets the postalZipCode attribute.
1467         * 
1468         * @return Returns the postalZipCode.
1469         */
1470        public PostalCode getPostalZipCode() {
1471            postalZipCode = SpringContext.getBean(PostalCodeService.class).getByPostalCodeInDefaultCountryIfNecessary(accountZipCode, postalZipCode);
1472            return postalZipCode;
1473        }
1474    
1475        /**
1476         * Sets the postalZipCode attribute value.
1477         * 
1478         * @param postalZipCode The postalZipCode to set.
1479         */
1480        public void setPostalZipCode(PostalCode postalZipCode) {
1481            this.postalZipCode = postalZipCode;
1482        }
1483    
1484        /**
1485         * Gets the budgetRecordingLevel attribute.
1486         * 
1487         * @return Returns the budgetRecordingLevel.
1488         */
1489        public BudgetRecordingLevel getBudgetRecordingLevel() {
1490            return budgetRecordingLevel;
1491        }
1492    
1493        /**
1494         * Sets the budgetRecordingLevel attribute value.
1495         * 
1496         * @param budgetRecordingLevel The budgetRecordingLevel to set.
1497         */
1498        public void setBudgetRecordingLevel(BudgetRecordingLevel budgetRecordingLevel) {
1499            this.budgetRecordingLevel = budgetRecordingLevel;
1500        }
1501    
1502        /**
1503         * Gets the sufficientFundsCode attribute.
1504         * 
1505         * @return Returns the sufficientFundsCode.
1506         */
1507        public SufficientFundsCode getSufficientFundsCode() {
1508            return sufficientFundsCode;
1509        }
1510    
1511        /**
1512         * Sets the sufficientFundsCode attribute value.
1513         * 
1514         * @param sufficientFundsCode The sufficientFundsCode to set.
1515         */
1516        public void setSufficientFundsCode(SufficientFundsCode sufficientFundsCode) {
1517            this.sufficientFundsCode = sufficientFundsCode;
1518        }
1519    
1520        /**
1521         * Gets the acctIndirectCostRcvyType attribute.
1522         * 
1523         * @return Returns the acctIndirectCostRcvyType.
1524         */
1525        public IndirectCostRecoveryType getAcctIndirectCostRcvyType() {
1526            return acctIndirectCostRcvyType;
1527        }
1528    
1529        /**
1530         * Sets the acctIndirectCostRcvyType attribute value.
1531         * 
1532         * @param acctIndirectCostRcvyType The acctIndirectCostRcvyType to set.
1533         */
1534        public void setAcctIndirectCostRcvyType(IndirectCostRecoveryType acctIndirectCostRcvyType) {
1535            this.acctIndirectCostRcvyType = acctIndirectCostRcvyType;
1536        }
1537    
1538        /**
1539         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
1540         */
1541        protected LinkedHashMap toStringMapper() {
1542            LinkedHashMap m = new LinkedHashMap();
1543    
1544            m.put("chartCode", this.chartOfAccountsCode);
1545            m.put("accountNumber", this.accountNumber);
1546    
1547            return m;
1548        }
1549    
1550    
1551        /**
1552         * Implementing equals since I need contains to behave reasonably in a hashed datastructure.
1553         * 
1554         * @see java.lang.Object#equals(java.lang.Object)
1555         */
1556        public boolean equals(Object obj) {
1557            boolean equal = false;
1558    
1559            if (obj != null) {
1560                if (this.getClass().equals(obj.getClass())) {
1561                    Account other = (Account) obj;
1562    
1563                    if (StringUtils.equals(this.getChartOfAccountsCode(), other.getChartOfAccountsCode())) {
1564                        if (StringUtils.equals(this.getAccountNumber(), other.getAccountNumber())) {
1565                            equal = true;
1566                        }
1567                    }
1568                }
1569            }
1570    
1571            return equal;
1572        }
1573    
1574        /**
1575         * Calcluates hashCode based on current values of chartOfAccountsCode and accountNumber fields. Somewhat dangerous, since both
1576         * of those fields are mutable, but I don't expect people to be editing those values directly for Accounts stored in hashed
1577         * datastructures.
1578         * 
1579         * @see java.lang.Object#hashCode()
1580         */
1581        public int hashCode() {
1582            String hashString = getChartOfAccountsCode() + "|" + getAccountNumber();
1583    
1584            return hashString.hashCode();
1585        }
1586    
1587    
1588        /**
1589         * Convenience method to make the primitive account fields from this Account easier to compare to the account fields from
1590         * another Account or an AccountingLine
1591         * 
1592         * @return String representing the account associated with this Accounting
1593         */
1594        public String getAccountKey() {
1595            String key = getChartOfAccountsCode() + ":" + getAccountNumber();
1596            return key;
1597        }
1598    
1599        /**
1600         * Gets the dummy attribute.
1601         * 
1602         * @return Returns the dummy.
1603         */
1604    
1605        /**
1606         * Gets the accountResponsibilitySection attribute.
1607         * 
1608         * @return Returns the accountResponsibilitySection.
1609         */
1610        public String getAccountResponsibilitySection() {
1611            return accountResponsibilitySection;
1612        }
1613    
1614        /**
1615         * Sets the accountResponsibilitySection attribute value.
1616         * 
1617         * @param accountResponsibilitySection The accountResponsibilitySection to set.
1618         */
1619        public void setAccountResponsibilitySection(String accountResponsibilitySection) {
1620            this.accountResponsibilitySection = accountResponsibilitySection;
1621        }
1622    
1623        /**
1624         * Gets the contractsAndGrantsSection attribute.
1625         * 
1626         * @return Returns the contractsAndGrantsSection.
1627         */
1628        public String getContractsAndGrantsSection() {
1629            return contractsAndGrantsSection;
1630        }
1631    
1632        /**
1633         * Sets the contractsAndGrantsSection attribute value.
1634         * 
1635         * @param contractsAndGrantsSection The contractsAndGrantsSection to set.
1636         */
1637        public void setContractsAndGrantsSection(String contractsAndGrantsSection) {
1638            this.contractsAndGrantsSection = contractsAndGrantsSection;
1639        }
1640    
1641        /**
1642         * Gets the accountDescriptionSection attribute.
1643         * 
1644         * @return Returns the accountDescriptionSection.
1645         */
1646        public String getAccountDescriptionSection() {
1647            return accountDescriptionSection;
1648        }
1649    
1650        /**
1651         * Sets the accountDescriptionSection attribute value.
1652         * 
1653         * @param accountDescriptionSection The accountDescriptionSection to set.
1654         */
1655        public void setAccountDescriptionSection(String accountDescriptionSection) {
1656            this.accountDescriptionSection = accountDescriptionSection;
1657        }
1658    
1659        /**
1660         * Gets the guidelinesAndPurposeSection attribute.
1661         * 
1662         * @return Returns the guidelinesAndPurposeSection.
1663         */
1664        public String getGuidelinesAndPurposeSection() {
1665            return guidelinesAndPurposeSection;
1666        }
1667    
1668        /**
1669         * Sets the guidelinesAndPurposeSection attribute value.
1670         * 
1671         * @param guidelinesAndPurposeSection The guidelinesAndPurposeSection to set.
1672         */
1673        public void setGuidelinesAndPurposeSection(String guidelinesAndPurposeSection) {
1674            this.guidelinesAndPurposeSection = guidelinesAndPurposeSection;
1675        }
1676    
1677        /**
1678         * Gets the accountResponsibilitySectionBlank attribute.
1679         * 
1680         * @return Returns the accountResponsibilitySectionBlank.
1681         */
1682        public String getAccountResponsibilitySectionBlank() {
1683            return accountResponsibilitySectionBlank;
1684        }
1685    
1686        /**
1687         * Gets the contractsAndGrantsSectionBlank attribute.
1688         * 
1689         * @return Returns the contractsAndGrantsSectionBlank.
1690         */
1691        public String getContractsAndGrantsSectionBlank() {
1692            return contractsAndGrantsSectionBlank;
1693        }
1694    
1695        /**
1696         * Gets the accountDescriptionSectionBlank attribute.
1697         * 
1698         * @return Returns the accountDescriptionSectionBlank.
1699         */
1700        public String getAccountDescriptionSectionBlank() {
1701            return accountDescriptionSectionBlank;
1702        }
1703    
1704        /**
1705         * Gets the guidelinesAndPurposeSectionBlank attribute.
1706         * 
1707         * @return Returns the guidelinesAndPurposeSectionBlank.
1708         */
1709        public String getGuidelinesAndPurposeSectionBlank() {
1710            return guidelinesAndPurposeSectionBlank;
1711        }
1712    
1713        /**
1714         * Gets the endowmentIncomeChartOfAccounts attribute.
1715         * 
1716         * @return Returns the endowmentIncomeChartOfAccounts.
1717         */
1718        public Chart getEndowmentIncomeChartOfAccounts() {
1719            return endowmentIncomeChartOfAccounts;
1720        }
1721    
1722        /**
1723         * Sets the endowmentIncomeChartOfAccounts attribute value.
1724         * 
1725         * @param endowmentIncomeChartOfAccounts The endowmentIncomeChartOfAccounts to set.
1726         */
1727        public void setEndowmentIncomeChartOfAccounts(Chart endowmentIncomeChartOfAccounts) {
1728            this.endowmentIncomeChartOfAccounts = endowmentIncomeChartOfAccounts;
1729        }
1730    
1731        @Override
1732        public void beforeUpdate(PersistenceBroker persistenceBroker) throws PersistenceBrokerException {
1733            super.beforeUpdate(persistenceBroker);
1734            try {
1735                // KULCOA-549: update the sufficient funds table
1736                // get the current data from the database
1737                BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
1738                Account originalAcct = (Account) boService.retrieve(this);
1739    
1740                if (originalAcct != null) {
1741                    if (!originalAcct.getSufficientFundsCode().equals(getSufficientFundsCode()) || originalAcct.isExtrnlFinEncumSufficntFndIndicator() != isExtrnlFinEncumSufficntFndIndicator() || originalAcct.isIntrnlFinEncumSufficntFndIndicator() != isIntrnlFinEncumSufficntFndIndicator() || originalAcct.isPendingAcctSufficientFundsIndicator() != isPendingAcctSufficientFundsIndicator() || originalAcct.isFinPreencumSufficientFundIndicator() != isFinPreencumSufficientFundIndicator()) {
1742                        SufficientFundRebuild sfr = new SufficientFundRebuild();
1743                        sfr.setAccountFinancialObjectTypeCode(SufficientFundRebuild.REBUILD_ACCOUNT);
1744                        sfr.setChartOfAccountsCode(getChartOfAccountsCode());
1745                        sfr.setAccountNumberFinancialObjectCode(getAccountNumber());
1746                        if (boService.retrieve(sfr) == null) {
1747                            persistenceBroker.store(sfr);
1748                        }
1749                    }
1750                }
1751            }
1752            catch (Exception ex) {
1753                LOG.error("Problem updating sufficient funds rebuild table: ", ex);
1754            }
1755        }
1756    
1757        /**
1758         * Gets the forContractsAndGrants attribute.
1759         * 
1760         * @return Returns the forContractsAndGrants.
1761         */
1762        public boolean isForContractsAndGrants() {
1763            if ( forContractsAndGrants == null ) {
1764                forContractsAndGrants = SpringContext.getBean(SubFundGroupService.class).isForContractsAndGrants(getSubFundGroup());
1765            }
1766            return forContractsAndGrants;
1767        }
1768    
1769        /**
1770         * determine if the given account is awarded by a federal agency
1771         * 
1772         * @param account the given account
1773         * @param federalAgencyTypeCodes the given federal agency type code
1774         * @return true if the given account is funded by a federal agency or associated with federal pass through indicator; otherwise,
1775         *         false
1776         */
1777        public boolean isAwardedByFederalAgency(List<String> federalAgencyTypeCodes) {
1778            return SpringContext.getBean(ContractsAndGrantsModuleService.class).isAwardedByFederalAgency(getChartOfAccountsCode(), getAccountNumber(), federalAgencyTypeCodes);
1779        }
1780    
1781        /**
1782         * Gets the contractsAndGrantsAccountResponsibilityId attribute.
1783         * 
1784         * @return Returns the contractsAndGrantsAccountResponsibilityId.
1785         */
1786        public Integer getContractsAndGrantsAccountResponsibilityId() {
1787            return contractsAndGrantsAccountResponsibilityId;
1788        }
1789        
1790        /**
1791         * Sets the contractsAndGrantsAccountResponsibilityId attribute value.
1792         * 
1793         * @param contractsAndGrantsAccountResponsibilityId The contractsAndGrantsAccountResponsibilityId to set.
1794         */
1795        public void setContractsAndGrantsAccountResponsibilityId(Integer contractsAndGrantsAccountResponsibilityId) {
1796            this.contractsAndGrantsAccountResponsibilityId = contractsAndGrantsAccountResponsibilityId;
1797        }
1798        
1799        /**
1800         * Gets the fringeBenefitsChartOfAccount attribute.
1801         * 
1802         * @return Returns the fringeBenefitsChartOfAccount.
1803         */
1804        public Chart getFringeBenefitsChartOfAccount() {
1805            return fringeBenefitsChartOfAccount;
1806        }
1807    
1808        /**
1809         * Sets the fringeBenefitsChartOfAccount attribute value.
1810         * 
1811         * @param fringeBenefitsChartOfAccount The fringeBenefitsChartOfAccount to set.
1812         */
1813        public void setFringeBenefitsChartOfAccount(Chart fringeBenefitsChartOfAccount) {
1814            this.fringeBenefitsChartOfAccount = fringeBenefitsChartOfAccount;
1815        }    
1816        
1817        /**
1818         * Gets the continuationChartOfAccount attribute.
1819         * 
1820         * @return Returns the continuationChartOfAccount.
1821         */
1822        public Chart getContinuationChartOfAccount() {
1823            return continuationChartOfAccount;
1824        }
1825    
1826        /**
1827         * Sets the continuationChartOfAccount attribute value.
1828         * 
1829         * @param continuationChartOfAccount The continuationChartOfAccount to set.
1830         */
1831        public void setContinuationChartOfAccount(Chart continuationChartOfAccount) {
1832            this.continuationChartOfAccount = continuationChartOfAccount;
1833        }    
1834        
1835        /**
1836         * Gets the incomeStreamChartOfAccounts attribute.
1837         * 
1838         * @return Returns the incomeStreamChartOfAccounts.
1839         */
1840        public Chart getIncomeStreamChartOfAccounts() {
1841            return incomeStreamChartOfAccounts;
1842        }
1843    
1844        /**
1845         * Sets the incomeStreamChartOfAccounts attribute value.
1846         * 
1847         * @param incomeStreamChartOfAccounts The incomeStreamChartOfAccounts to set.
1848         */
1849        public void setIncomeStreamChartOfAccounts(Chart incomeStreamChartOfAccounts) {
1850            this.incomeStreamChartOfAccounts = incomeStreamChartOfAccounts;
1851        }    
1852        
1853        /**
1854        * Gets the incomeStreamChartOfAccounts attribute.
1855        * 
1856        * @return Returns the incomeStreamChartOfAccounts.
1857        */
1858       public Chart getContractControlChartOfAccounts() {
1859           return contractControlChartOfAccounts;
1860       }
1861    
1862       /**
1863        * Sets the contractControlChartOfAccounts attribute value.
1864        * 
1865        * @param contractControlChartOfAccounts The contractControlChartOfAccounts to set.
1866        */
1867       public void setContractControlChartOfAccounts(Chart contractControlChartOfAccounts) {
1868           this.contractControlChartOfAccounts = contractControlChartOfAccounts;
1869       }    
1870       
1871       /**
1872        * Gets the indirectCostRcvyChartOfAccounts attribute.
1873        * 
1874        * @return Returns the indirectCostRcvyChartOfAccounts.
1875        */
1876       public Chart getIndirectCostRcvyChartOfAccounts() {
1877           return indirectCostRcvyChartOfAccounts;
1878       }
1879    
1880       /**
1881        * Sets the indirectCostRcvyChartOfAccounts attribute value.
1882        * 
1883        * @param indirectCostRcvyChartOfAccounts The indirectCostRcvyChartOfAccounts to set.
1884        */
1885       public void setIndirectCostRcvyChartOfAccounts(Chart indirectCostRcvyChartOfAccounts) {
1886           this.indirectCostRcvyChartOfAccounts = indirectCostRcvyChartOfAccounts;
1887       }   
1888       
1889    }