001/*
002 * Copyright 2005 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
017package org.kuali.ole.coa.businessobject;
018
019import java.sql.Date;
020import java.util.ArrayList;
021import java.util.Calendar;
022import java.util.Collection;
023import java.util.HashMap;
024import java.util.List;
025import java.util.Map;
026
027import org.apache.commons.lang.StringUtils;
028import org.apache.commons.lang.time.DateUtils;
029import org.kuali.ole.coa.service.SubFundGroupService;
030import org.kuali.ole.gl.businessobject.SufficientFundRebuild;
031import org.kuali.ole.integration.cg.ContractsAndGrantsAccountAwardInformation;
032import org.kuali.ole.integration.cg.ContractsAndGrantsModuleService;
033import org.kuali.ole.select.businessobject.OleLegacyFundCode;
034import org.kuali.ole.select.businessobject.OleStewardshipRequirement;
035import org.kuali.ole.select.businessobject.OleSufficientFundCheck;
036import org.kuali.ole.sys.OLEConstants;
037import org.kuali.ole.sys.OLEPropertyConstants;
038import org.kuali.ole.sys.context.SpringContext;
039import org.kuali.ole.vnd.businessobject.VendorDetail;
040import org.kuali.rice.core.api.datetime.DateTimeService;
041import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
042import org.kuali.rice.core.api.util.type.KualiDecimal;
043import org.kuali.rice.kim.api.identity.Person;
044import org.kuali.rice.krad.bo.PersistableBusinessObject;
045import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
046import org.kuali.rice.krad.service.BusinessObjectService;
047import org.kuali.rice.krad.service.KualiModuleService;
048import org.kuali.rice.krad.service.ModuleService;
049import org.kuali.rice.krad.util.ObjectUtils;
050import org.kuali.rice.location.api.LocationConstants;
051import org.kuali.rice.location.framework.campus.CampusEbo;
052import org.kuali.rice.location.framework.postalcode.PostalCodeEbo;
053import org.kuali.rice.location.framework.state.StateEbo;
054
055/**
056 *
057 */
058public class Account extends PersistableBusinessObjectBase implements AccountIntf, MutableInactivatable {
059    private static final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(Account.class);
060    public static final String CACHE_NAME = OLEConstants.APPLICATION_NAMESPACE_CODE + "/" + "Account";
061
062    protected String chartOfAccountsCode;
063    protected String accountNumber;
064    protected String accountName;
065    protected boolean accountsFringesBnftIndicator;
066    protected Date accountRestrictedStatusDate;
067    protected String accountCityName;
068    protected String accountStateCode;
069    protected String accountStreetAddress;
070    protected String accountZipCode;
071    protected String accountCountryCode = OLEConstants.COUNTRY_CODE_UNITED_STATES;
072    protected Date accountCreateDate;
073    protected Date accountEffectiveDate;
074    protected Date accountExpirationDate;
075    protected String acctIndirectCostRcvyTypeCd;
076    protected String acctCustomIndCstRcvyExclCd;
077    protected String financialIcrSeriesIdentifier;
078    protected boolean accountInFinancialProcessingIndicator;
079    protected String budgetRecordingLevelCode;
080    protected String accountSufficientFundsCode;
081    protected boolean pendingAcctSufficientFundsIndicator;
082    protected boolean extrnlFinEncumSufficntFndIndicator;
083    protected boolean intrnlFinEncumSufficntFndIndicator;
084    protected boolean finPreencumSufficientFundIndicator;
085    protected boolean financialObjectivePrsctrlIndicator;
086    protected String accountCfdaNumber;
087    protected boolean accountOffCampusIndicator;
088    protected boolean active;
089
090    protected String accountFiscalOfficerSystemIdentifier;
091    protected String accountsSupervisorySystemsIdentifier;
092    protected String accountManagerSystemIdentifier;
093    protected String organizationCode;
094    protected String accountTypeCode;
095    protected String accountPhysicalCampusCode;
096    protected String subFundGroupCode;
097    protected String financialHigherEdFunctionCd;
098    protected String accountRestrictedStatusCode;
099    protected String reportsToChartOfAccountsCode;
100    protected String reportsToAccountNumber;
101    protected String continuationFinChrtOfAcctCd;
102    protected String continuationAccountNumber;
103    protected String endowmentIncomeAcctFinCoaCd;
104    protected String endowmentIncomeAccountNumber;
105    protected String contractControlFinCoaCode;
106    protected String contractControlAccountNumber;
107    protected String incomeStreamFinancialCoaCode;
108    protected String incomeStreamAccountNumber;
109    protected Integer contractsAndGrantsAccountResponsibilityId;
110
111    protected Chart chartOfAccounts;
112    protected Chart endowmentIncomeChartOfAccounts;
113    protected Organization organization;
114    protected AccountType accountType;
115    protected CampusEbo accountPhysicalCampus;
116    protected StateEbo accountState;
117    protected SubFundGroup subFundGroup;
118    protected HigherEducationFunction financialHigherEdFunction;
119    protected RestrictedStatus accountRestrictedStatus;
120    protected Account reportsToAccount;
121    protected Account continuationAccount;
122    protected Account endowmentIncomeAccount;
123    protected Account contractControlAccount;
124    protected Account incomeStreamAccount;
125    protected IndirectCostRecoveryType acctIndirectCostRcvyType;
126    protected Person accountFiscalOfficerUser;
127    protected Person accountSupervisoryUser;
128    protected Person accountManagerUser;
129    protected PostalCodeEbo postalZipCode;
130    protected BudgetRecordingLevel budgetRecordingLevel;
131    protected SufficientFundsCode sufficientFundsCode;
132    protected CFDA cfda;
133
134    protected Chart fringeBenefitsChartOfAccount;
135    protected Chart continuationChartOfAccount;
136    protected Chart incomeStreamChartOfAccounts;
137    protected Chart contractControlChartOfAccounts;
138
139    // Several kinds of Dummy Attributes for dividing sections on Inquiry page
140    protected String accountResponsibilitySectionBlank;
141    protected String accountResponsibilitySection;
142    protected String contractsAndGrantsSectionBlank;
143    protected String contractsAndGrantsSection;
144    protected String guidelinesAndPurposeSectionBlank;
145    protected String guidelinesAndPurposeSection;
146    protected String accountDescriptionSectionBlank;
147    protected String accountDescriptionSection;
148
149    protected Boolean forContractsAndGrants;
150
151    protected AccountGuideline accountGuideline;
152    protected AccountDescription accountDescription;
153
154    protected List subAccounts;
155    protected List<ContractsAndGrantsAccountAwardInformation> awards;
156    protected List<IndirectCostRecoveryAccount> indirectCostRecoveryAccounts;
157    //added for the employee labor benefit calculation
158    protected String laborBenefitRateCategoryCode;
159//    protected LaborBenefitRateCategory laborBenefitRateCategory;
160   // changes for jira ole-2341
161    protected List<OleStewardshipRequirement> oleStewardshipRequirements;
162    protected List<OleLegacyFundCode> oleLegacyFundCodes;
163
164    // Modified for jira OLE-2519 starts
165    protected String universityAccountNumber;
166
167    protected OleStewardshipRequirement stewardshipRequirement;
168
169    protected boolean restricted;
170    // Modified for jira OLE-2519 starts
171
172    protected OleLegacyFundCode oleLegacyFundCode;
173
174    protected Integer vendorHeaderGeneratedIdentifier;
175    protected Integer vendorDetailAssignedIdentifier;
176    protected VendorDetail vendorDetail;
177    private boolean vendorDepositAccount;
178    private OleSufficientFundCheck oleSufficientFundCheck;
179    protected String vendorName;
180    protected KualiDecimal thresholdPercentage;
181    protected KualiDecimal thresholdAmount;
182
183    public OleSufficientFundCheck getOleSufficientFundCheck() {
184        return oleSufficientFundCheck;
185    }
186
187    public void setOleSufficientFundCheck(OleSufficientFundCheck oleSufficientFundCheck) {
188        this.oleSufficientFundCheck = oleSufficientFundCheck;
189    }
190
191    /**
192     * Gets the vendorDepositAccount attribute.
193     * @return Returns the vendorDepositAccount.
194     */
195    public boolean isVendorDepositAccount() {
196        return vendorDepositAccount;
197    }
198
199    /**
200     * Sets the vendorDepositAccount attribute value.
201     * @param vendorDepositAccount The vendorDepositAccount to set.
202     */
203    public void setVendorDepositAccount(boolean vendorDepositAccount) {
204        this.vendorDepositAccount = vendorDepositAccount;
205    }
206
207    /**
208     * Gets the vendorName attribute.
209     * @return Returns the vendorName
210     */
211    public String getVendorName() {
212        VendorDetail tempVendorDetail = new VendorDetail();
213        tempVendorDetail.setVendorHeaderGeneratedIdentifier(vendorHeaderGeneratedIdentifier);
214        tempVendorDetail.setVendorDetailAssignedIdentifier(vendorDetailAssignedIdentifier);
215        String headerId = "";
216        String detailId = "";
217        String vendorName = "";
218        if (ObjectUtils.isNotNull(this.vendorHeaderGeneratedIdentifier)) {
219            headerId = this.vendorHeaderGeneratedIdentifier.toString();
220        }
221        if (ObjectUtils.isNotNull(this.vendorDetailAssignedIdentifier)) {
222            detailId = this.vendorDetailAssignedIdentifier.toString();
223        }
224        if (!StringUtils.isEmpty(headerId) && !StringUtils.isEmpty(detailId)) {
225            VendorDetail vendorDetail;
226            Map<String, String> pkMap = new HashMap<String, String>();
227            pkMap.put("vendorHeaderGeneratedIdentifier", headerId);
228            pkMap.put("vendorDetailAssignedIdentifier", detailId);
229            vendorDetail = SpringContext.getBean(BusinessObjectService.class).findByPrimaryKey(VendorDetail.class,
230                    pkMap);
231            vendorName = vendorDetail.getVendorName();
232        }
233        return vendorName;
234    }
235
236    /**
237     * Sets the vendorName attribute.
238     * 
239     * @param vendorName The vendorName to set.
240     */
241    public void setVendorName(String vendorName) {
242        VendorDetail tempVendorDetail = new VendorDetail();
243        tempVendorDetail.setVendorName(vendorName);
244        if (StringUtils.isEmpty(vendorName)) {
245            vendorHeaderGeneratedIdentifier = null;
246            vendorDetailAssignedIdentifier = null;
247            return;
248        }
249    }
250
251    /**
252     * Gets the vendorHeaderGeneratedIdentifier attribute.
253     * @return Returns the vendorHeaderGeneratedIdentifier
254     */
255    public Integer getVendorHeaderGeneratedIdentifier() {
256        return vendorHeaderGeneratedIdentifier;
257    }
258
259    /**
260     * Sets the vendorHeaderGeneratedIdentifier attribute.
261     * @param vendorHeaderGeneratedIdentifier The vendorHeaderGeneratedIdentifier to set.
262     */
263    public void setVendorHeaderGeneratedIdentifier(Integer vendorHeaderGeneratedIdentifier) {
264        this.vendorHeaderGeneratedIdentifier = vendorHeaderGeneratedIdentifier;
265    }
266
267    /**
268     * Gets the vendorDetailAssignedIdentifier attribute.
269     * @return Returns the vendorDetailAssignedIdentifier
270     */
271    public Integer getVendorDetailAssignedIdentifier() {
272        return vendorDetailAssignedIdentifier;
273    }
274
275    /**
276     * Sets the vendorDetailAssignedIdentifier attribute.
277     * @param vendorDetailAssignedIdentifier The vendorDetailAssignedIdentifier to set.
278     */
279    public void setVendorDetailAssignedIdentifier(Integer vendorDetailAssignedIdentifier) {
280        this.vendorDetailAssignedIdentifier = vendorDetailAssignedIdentifier;
281    }
282
283    /**
284     * Gets the vendorDetail attribute.
285     * @return Returns the vendorDetail.
286     */
287    public VendorDetail getVendorDetail() {
288        return vendorDetail;
289    }
290
291    /**
292     * Sets the vendorDetail attribute value.
293     * @param vendorDetail The vendorDetail to set.
294     */
295    public void setVendorDetail(VendorDetail vendorDetail) {
296        this.vendorDetail = vendorDetail;
297    }
298
299    // Modified for jira OLE-2519 starts
300    /**
301     * Gets the restricted attribute.
302     * @return Returns the restricted.
303     */
304    public boolean isRestricted() {
305        return restricted;
306    }
307
308    /**
309     * Sets the restricted attribute value.
310     * @param restricted The restricted to set.
311     */
312    public void setRestricted(boolean restricted) {
313        this.restricted = restricted;
314    }
315
316    /**
317     * Gets the stewardshipRequirement attribute.
318     * @return Returns the stewardshipRequirement.
319     */
320    public OleStewardshipRequirement getStewardshipRequirement() {
321        return stewardshipRequirement;
322    }
323
324    /**
325     * Sets the stewardshipRequirement attribute value.
326     * @param stewardshipRequirement The stewardshipRequirement to set.
327     */
328    public void setStewardshipRequirement(OleStewardshipRequirement stewardshipRequirement) {
329        this.stewardshipRequirement = stewardshipRequirement;
330    }
331    // Modified for jira OLE-2519 starts
332
333    public OleLegacyFundCode getOleLegacyFundCode() {
334        return oleLegacyFundCode;
335    }
336
337    public void setOleLegacyFundCode(OleLegacyFundCode oleLegacyFundCode) {
338        this.oleLegacyFundCode = oleLegacyFundCode;
339    }
340
341    public String getUniversityAccountNumber() {
342        return universityAccountNumber;
343    }
344
345    public void setUniversityAccountNumber(String universityAccountNumber) {
346        this.universityAccountNumber = universityAccountNumber;
347    }
348
349    public List<OleLegacyFundCode> getOleLegacyFundCodes() {
350        return oleLegacyFundCodes;
351    }
352
353    public void setOleLegacyFundCodes(List<OleLegacyFundCode> oleLegacyFundCodes) {
354        this.oleLegacyFundCodes = oleLegacyFundCodes;
355    }
356
357    public List<OleStewardshipRequirement> getOleStewardshipRequirements() {
358        return oleStewardshipRequirements;
359    }
360
361    public void setOleStewardshipRequirements(List<OleStewardshipRequirement> oleStewardshipRequirements) {
362        this.oleStewardshipRequirements = oleStewardshipRequirements;
363    }
364
365    /**
366     * Default no-arg constructor.
367     */
368    public Account() {
369        active = true; // assume active is true until set otherwise
370        indirectCostRecoveryAccounts = new ArrayList<IndirectCostRecoveryAccount>();
371        oleStewardshipRequirements = new ArrayList<OleStewardshipRequirement>();
372        oleLegacyFundCodes = new ArrayList<OleLegacyFundCode>();
373    }
374
375    /**
376     * This method gathers all SubAccounts related to this account if the account is marked as closed to deactivate
377     */
378    public List<PersistableBusinessObject> generateDeactivationsToPersist() {
379        BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
380
381        // retreive all the existing sub accounts for this
382        List<SubAccount> bosToDeactivate = new ArrayList<SubAccount>();
383        if (!isActive()) {
384            Map<String, Object> fieldValues = new HashMap<String,Object>();
385            fieldValues.put(OLEPropertyConstants.CHART_OF_ACCOUNTS_CODE, getChartOfAccountsCode());
386            fieldValues.put(OLEPropertyConstants.ACCOUNT_NUMBER, getAccountNumber());
387            fieldValues.put(OLEPropertyConstants.ACTIVE, true);
388            Collection<SubAccount> existingSubAccounts = SpringContext.getBean(BusinessObjectService.class).findMatching(SubAccount.class, fieldValues);
389            bosToDeactivate.addAll(existingSubAccounts);
390        }
391        // mark all the sub accounts as inactive
392        for (SubAccount subAccount : bosToDeactivate) {
393            subAccount.setActive(false);
394        }
395        return new ArrayList<PersistableBusinessObject>(bosToDeactivate);
396    }
397
398    /**
399     * Gets the accountNumber attribute.
400     *
401     * @return Returns the accountNumber
402     */
403    @Override
404    public String getAccountNumber() {
405        return accountNumber;
406    }
407
408    /**
409     * Sets the accountNumber attribute.
410     *
411     * @param accountNumber The accountNumber to set.
412     */
413    @Override
414    public void setAccountNumber(String accountNumber) {
415        this.accountNumber = accountNumber;
416    }
417
418    /**
419     * Gets the accountName attribute.
420     *
421     * @return Returns the accountName
422     */
423    @Override
424    public String getAccountName() {
425        return accountName;
426    }
427
428    /**
429     * Sets the accountName attribute.
430     *
431     * @param accountName The accountName to set.
432     */
433    @Override
434    public void setAccountName(String accountName) {
435        this.accountName = accountName;
436    }
437
438    /**
439     * Gets the _AccountsFringesBnftIndicator_ attribute.
440     *
441     * @return Returns the _AccountsFringesBnftIndicator_
442     */
443    @Override
444    public boolean isAccountsFringesBnftIndicator() {
445        return accountsFringesBnftIndicator;
446    }
447
448    /**
449     * Sets the _AccountsFringesBnftIndicator_ attribute.
450     *
451     * @param _AccountsFringesBnftIndicator_ The _AccountsFringesBnftIndicator_ to set.
452     */
453    @Override
454    public void setAccountsFringesBnftIndicator(boolean _AccountsFringesBnftIndicator_) {
455        this.accountsFringesBnftIndicator = _AccountsFringesBnftIndicator_;
456    }
457
458    /**
459     * Gets the accountRestrictedStatusDate attribute.
460     *
461     * @return Returns the accountRestrictedStatusDate
462     */
463    @Override
464    public Date getAccountRestrictedStatusDate() {
465        return accountRestrictedStatusDate;
466    }
467
468    /**
469     * Sets the accountRestrictedStatusDate attribute.
470     *
471     * @param accountRestrictedStatusDate The accountRestrictedStatusDate to set.
472     */
473    @Override
474    public void setAccountRestrictedStatusDate(Date accountRestrictedStatusDate) {
475        this.accountRestrictedStatusDate = accountRestrictedStatusDate;
476    }
477
478    /**
479     * Gets the accountCityName attribute.
480     *
481     * @return Returns the accountCityName
482     */
483    @Override
484    public String getAccountCityName() {
485        return accountCityName;
486    }
487
488    /**
489     * Sets the accountCityName attribute.
490     *
491     * @param accountCityName The accountCityName to set.
492     */
493    @Override
494    public void setAccountCityName(String accountCityName) {
495        this.accountCityName = accountCityName;
496    }
497
498    /**
499     * Gets the accountStateCode attribute.
500     *
501     * @return Returns the accountStateCode
502     */
503    @Override
504    public String getAccountStateCode() {
505        return accountStateCode;
506    }
507
508    /**
509     * Sets the accountStateCode attribute.
510     *
511     * @param accountStateCode The accountStateCode to set.
512     */
513    @Override
514    public void setAccountStateCode(String accountStateCode) {
515        this.accountStateCode = accountStateCode;
516    }
517
518    /**
519     * Gets the accountStreetAddress attribute.
520     *
521     * @return Returns the accountStreetAddress
522     */
523    @Override
524    public String getAccountStreetAddress() {
525        return accountStreetAddress;
526    }
527
528    /**
529     * Sets the accountStreetAddress attribute.
530     *
531     * @param accountStreetAddress The accountStreetAddress to set.
532     */
533    @Override
534    public void setAccountStreetAddress(String accountStreetAddress) {
535        this.accountStreetAddress = accountStreetAddress;
536    }
537
538    /**
539     * Gets the accountZipCode attribute.
540     *
541     * @return Returns the accountZipCode
542     */
543    @Override
544    public String getAccountZipCode() {
545        return accountZipCode;
546    }
547
548    /**
549     * Sets the accountZipCode attribute.
550     *
551     * @param accountZipCode The accountZipCode to set.
552     */
553    @Override
554    public void setAccountZipCode(String accountZipCode) {
555        this.accountZipCode = accountZipCode;
556    }
557
558    /**
559     * Gets the accountCreateDate attribute.
560     *
561     * @return Returns the accountCreateDate
562     */
563    @Override
564    public Date getAccountCreateDate() {
565        return accountCreateDate;
566    }
567
568    /**
569     * Sets the accountCreateDate attribute.
570     *
571     * @param accountCreateDate The accountCreateDate to set.
572     */
573    @Override
574    public void setAccountCreateDate(Date accountCreateDate) {
575        this.accountCreateDate = accountCreateDate;
576    }
577
578    /**
579     * Gets the accountEffectiveDate attribute.
580     *
581     * @return Returns the accountEffectiveDate
582     */
583    @Override
584    public Date getAccountEffectiveDate() {
585        return accountEffectiveDate;
586    }
587
588    /**
589     * Sets the accountEffectiveDate attribute.
590     *
591     * @param accountEffectiveDate The accountEffectiveDate to set.
592     */
593    @Override
594    public void setAccountEffectiveDate(Date accountEffectiveDate) {
595        this.accountEffectiveDate = accountEffectiveDate;
596    }
597
598    /**
599     * Gets the accountExpirationDate attribute.
600     *
601     * @return Returns the accountExpirationDate
602     */
603    @Override
604    public Date getAccountExpirationDate() {
605        return accountExpirationDate;
606    }
607
608    /**
609     * Sets the accountExpirationDate attribute.
610     *
611     * @param accountExpirationDate The accountExpirationDate to set.
612     */
613    @Override
614    public void setAccountExpirationDate(Date accountExpirationDate) {
615        this.accountExpirationDate = accountExpirationDate;
616    }
617
618    /**
619     * This method determines whether the account is expired or not. Note that if Expiration Date is the same as today, then this
620     * will return false. It will only return true if the account expiration date is one day earlier than today or earlier. Note
621     * that this logic ignores all time components when doing the comparison. It only does the before/after comparison based on date
622     * values, not time-values.
623     *
624     * @return true or false based on the logic outlined above
625     */
626    @Override
627    public boolean isExpired() {
628        LOG.debug("entering isExpired()");
629        // dont even bother trying to test if the accountExpirationDate is null
630        if (accountExpirationDate == null) {
631            return false;
632        }
633
634        return isExpired(SpringContext.getBean(DateTimeService.class).getCurrentCalendar());
635    }
636
637    /**
638     * This method determines whether the account is expired or not. Note that if Expiration Date is the same date as testDate, then
639     * this will return false. It will only return true if the account expiration date is one day earlier than testDate or earlier.
640     * Note that this logic ignores all time components when doing the comparison. It only does the before/after comparison based on
641     * date values, not time-values.
642     *
643     * @param testDate - Calendar instance with the date to test the Account's Expiration Date against. This is most commonly set to
644     *        today's date.
645     * @return true or false based on the logic outlined above
646     */
647    @Override
648    public boolean isExpired(Calendar testDate) {
649        if (LOG.isDebugEnabled()) {
650            LOG.debug("entering isExpired(" + testDate + ")");
651        }
652
653        // dont even bother trying to test if the accountExpirationDate is null
654        if (accountExpirationDate == null) {
655            return false;
656        }
657
658        // remove any time-components from the testDate
659        testDate = DateUtils.truncate(testDate, Calendar.DAY_OF_MONTH);
660
661        // get a calendar reference to the Account Expiration
662        // date, and remove any time components
663        Calendar acctDate = Calendar.getInstance();
664        acctDate.setTime(this.accountExpirationDate);
665        acctDate = DateUtils.truncate(acctDate, Calendar.DAY_OF_MONTH);
666
667        // if the Account Expiration Date is before the testDate
668        return acctDate.before(testDate);
669    }
670
671    /**
672     * This method determines whether the account is expired or not. Note that if Expiration Date is the same date as testDate, then
673     * this will return false. It will only return true if the account expiration date is one day earlier than testDate or earlier.
674     * Note that this logic ignores all time components when doing the comparison. It only does the before/after comparison based on
675     * date values, not time-values.
676     *
677     * @param testDate - java.util.Date instance with the date to test the Account's Expiration Date against. This is most commonly
678     *        set to today's date.
679     * @return true or false based on the logic outlined above
680     */
681    @Override
682    public boolean isExpired(Date testDate) {
683
684        // dont even bother trying to test if the accountExpirationDate is null
685        if (accountExpirationDate == null) {
686            return false;
687        }
688
689        Calendar acctDate = Calendar.getInstance();
690        acctDate.setTime(testDate);
691        return isExpired(acctDate);
692    }
693
694    /**
695     * Gets the acctIndirectCostRcvyTypeCd attribute.
696     *
697     * @return Returns the acctIndirectCostRcvyTypeCd
698     */
699    @Override
700    public String getAcctIndirectCostRcvyTypeCd() {
701        return acctIndirectCostRcvyTypeCd;
702    }
703
704    /**
705     * Sets the acctIndirectCostRcvyTypeCd attribute.
706     *
707     * @param acctIndirectCostRcvyTypeCd The acctIndirectCostRcvyTypeCd to set.
708     */
709    @Override
710    public void setAcctIndirectCostRcvyTypeCd(String acctIndirectCostRcvyTypeCd) {
711        this.acctIndirectCostRcvyTypeCd = acctIndirectCostRcvyTypeCd;
712    }
713
714    /**
715     * Gets the acctCustomIndCstRcvyExclCd attribute.
716     *
717     * @return Returns the acctCustomIndCstRcvyExclCd
718     */
719    @Override
720    public String getAcctCustomIndCstRcvyExclCd() {
721        return acctCustomIndCstRcvyExclCd;
722    }
723
724    /**
725     * Sets the acctCustomIndCstRcvyExclCd attribute.
726     *
727     * @param acctCustomIndCstRcvyExclCd The acctCustomIndCstRcvyExclCd to set.
728     */
729    @Override
730    public void setAcctCustomIndCstRcvyExclCd(String acctCustomIndCstRcvyExclCd) {
731        this.acctCustomIndCstRcvyExclCd = acctCustomIndCstRcvyExclCd;
732    }
733
734    /**
735     * Gets the financialIcrSeriesIdentifier attribute.
736     *
737     * @return Returns the financialIcrSeriesIdentifier
738     */
739    @Override
740    public String getFinancialIcrSeriesIdentifier() {
741        return financialIcrSeriesIdentifier;
742    }
743
744    /**
745     * Sets the financialIcrSeriesIdentifier attribute.
746     *
747     * @param financialIcrSeriesIdentifier The financialIcrSeriesIdentifier to set.
748     */
749    @Override
750    public void setFinancialIcrSeriesIdentifier(String financialIcrSeriesIdentifier) {
751        this.financialIcrSeriesIdentifier = financialIcrSeriesIdentifier;
752    }
753
754    /**
755     * Gets the accountInFinancialProcessingIndicator attribute.
756     *
757     * @return Returns the accountInFinancialProcessingIndicator
758     */
759    @Override
760    public boolean getAccountInFinancialProcessingIndicator() {
761        return accountInFinancialProcessingIndicator;
762    }
763
764    /**
765     * Sets the accountInFinancialProcessingIndicator attribute.
766     *
767     * @param accountInFinancialProcessingIndicator The accountInFinancialProcessingIndicator to set.
768     */
769    @Override
770    public void setAccountInFinancialProcessingIndicator(boolean accountInFinancialProcessingIndicator) {
771        this.accountInFinancialProcessingIndicator = accountInFinancialProcessingIndicator;
772    }
773
774    /**
775     * Gets the budgetRecordingLevelCode attribute.
776     *
777     * @return Returns the budgetRecordingLevelCode
778     */
779    @Override
780    public String getBudgetRecordingLevelCode() {
781        return budgetRecordingLevelCode;
782    }
783
784    /**
785     * Sets the budgetRecordingLevelCode attribute.
786     *
787     * @param budgetRecordingLevelCode The budgetRecordingLevelCode to set.
788     */
789    @Override
790    public void setBudgetRecordingLevelCode(String budgetRecordingLevelCode) {
791        this.budgetRecordingLevelCode = budgetRecordingLevelCode;
792    }
793
794    /**
795     * Gets the accountSufficientFundsCode attribute.
796     *
797     * @return Returns the accountSufficientFundsCode
798     */
799    @Override
800    public String getAccountSufficientFundsCode() {
801        return accountSufficientFundsCode;
802    }
803
804    /**
805     * Sets the accountSufficientFundsCode attribute.
806     *
807     * @param accountSufficientFundsCode The accountSufficientFundsCode to set.
808     */
809    @Override
810    public void setAccountSufficientFundsCode(String accountSufficientFundsCode) {
811        this.accountSufficientFundsCode = accountSufficientFundsCode;
812    }
813
814    /**
815     * Gets the pendingAcctSufficientFundsIndicator attribute.
816     *
817     * @return Returns the pendingAcctSufficientFundsIndicator
818     */
819    @Override
820    public boolean isPendingAcctSufficientFundsIndicator() {
821        return pendingAcctSufficientFundsIndicator;
822    }
823
824    /**
825     * Sets the pendingAcctSufficientFundsIndicator attribute.
826     *
827     * @param pendingAcctSufficientFundsIndicator The pendingAcctSufficientFundsIndicator to set.
828     */
829    @Override
830    public void setPendingAcctSufficientFundsIndicator(boolean pendingAcctSufficientFundsIndicator) {
831        this.pendingAcctSufficientFundsIndicator = pendingAcctSufficientFundsIndicator;
832    }
833
834    /**
835     * Gets the extrnlFinEncumSufficntFndIndicator attribute.
836     *
837     * @return Returns the extrnlFinEncumSufficntFndIndicator
838     */
839    @Override
840    public boolean isExtrnlFinEncumSufficntFndIndicator() {
841        return extrnlFinEncumSufficntFndIndicator;
842    }
843
844    /**
845     * Sets the extrnlFinEncumSufficntFndIndicator attribute.
846     *
847     * @param extrnlFinEncumSufficntFndIndicator The extrnlFinEncumSufficntFndIndicator to set.
848     */
849    @Override
850    public void setExtrnlFinEncumSufficntFndIndicator(boolean extrnlFinEncumSufficntFndIndicator) {
851        this.extrnlFinEncumSufficntFndIndicator = extrnlFinEncumSufficntFndIndicator;
852    }
853
854    /**
855     * Gets the intrnlFinEncumSufficntFndIndicator attribute.
856     *
857     * @return Returns the intrnlFinEncumSufficntFndIndicator
858     */
859    @Override
860    public boolean isIntrnlFinEncumSufficntFndIndicator() {
861        return intrnlFinEncumSufficntFndIndicator;
862    }
863
864    /**
865     * Sets the intrnlFinEncumSufficntFndIndicator attribute.
866     *
867     * @param intrnlFinEncumSufficntFndIndicator The intrnlFinEncumSufficntFndIndicator to set.
868     */
869    @Override
870    public void setIntrnlFinEncumSufficntFndIndicator(boolean intrnlFinEncumSufficntFndIndicator) {
871        this.intrnlFinEncumSufficntFndIndicator = intrnlFinEncumSufficntFndIndicator;
872    }
873
874    /**
875     * Gets the finPreencumSufficientFundIndicator attribute.
876     *
877     * @return Returns the finPreencumSufficientFundIndicator
878     */
879    @Override
880    public boolean isFinPreencumSufficientFundIndicator() {
881        return finPreencumSufficientFundIndicator;
882    }
883
884    /**
885     * Sets the finPreencumSufficientFundIndicator attribute.
886     *
887     * @param finPreencumSufficientFundIndicator The finPreencumSufficientFundIndicator to set.
888     */
889    @Override
890    public void setFinPreencumSufficientFundIndicator(boolean finPreencumSufficientFundIndicator) {
891        this.finPreencumSufficientFundIndicator = finPreencumSufficientFundIndicator;
892    }
893
894    /**
895     * Gets the _FinancialObjectivePrsctrlIndicator_ attribute.
896     *
897     * @return Returns the _FinancialObjectivePrsctrlIndicator_
898     */
899    @Override
900    public boolean isFinancialObjectivePrsctrlIndicator() {
901        return financialObjectivePrsctrlIndicator;
902    }
903
904    /**
905     * Sets the _FinancialObjectivePrsctrlIndicator_ attribute.
906     *
907     * @param _FinancialObjectivePrsctrlIndicator_ The _FinancialObjectivePrsctrlIndicator_ to set.
908     */
909    @Override
910    public void setFinancialObjectivePrsctrlIndicator(boolean _FinancialObjectivePrsctrlIndicator_) {
911        this.financialObjectivePrsctrlIndicator = _FinancialObjectivePrsctrlIndicator_;
912    }
913
914    /**
915     * Gets the accountCfdaNumber attribute.
916     *
917     * @return Returns the accountCfdaNumber
918     */
919    @Override
920    public String getAccountCfdaNumber() {
921        return accountCfdaNumber;
922    }
923
924    /**
925     * Sets the accountCfdaNumber attribute.
926     *
927     * @param accountCfdaNumber The accountCfdaNumber to set.
928     */
929    @Override
930    public void setAccountCfdaNumber(String accountCfdaNumber) {
931        this.accountCfdaNumber = accountCfdaNumber;
932    }
933
934    /**
935     * Gets the related CFDA record for this account
936     *
937     * @return a CFDA record
938     */
939    public CFDA getCfda() {
940        return cfda ;
941    }
942
943    /**
944     * Sets the given related CFDA object
945     * @param cfda the related CFDA object.
946     */
947    public void setCfda(CFDA cfda) {
948        this.cfda = cfda;
949    }
950
951    public List<ContractsAndGrantsAccountAwardInformation> getAwards() {
952        // TODO this code totally breaks modularization but can't be fixed until data dictionary modularization plans come down the
953        // pike
954        awards = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(ContractsAndGrantsAccountAwardInformation.class).retrieveExternalizableBusinessObjectsList(this, "awards", ContractsAndGrantsAccountAwardInformation.class);
955        return awards;
956    }
957
958    public void setAwards(List awards) {
959        this.awards = awards;
960    }
961
962    @Override
963    public List<IndirectCostRecoveryAccount> getIndirectCostRecoveryAccounts() {
964        return this.indirectCostRecoveryAccounts;
965    }
966
967    public List<IndirectCostRecoveryAccount> getActiveIndirectCostRecoveryAccounts() {
968        List<IndirectCostRecoveryAccount> activeList = new ArrayList<IndirectCostRecoveryAccount>();
969        for (IndirectCostRecoveryAccount icr : getIndirectCostRecoveryAccounts()){
970            if (icr.isActive()){
971                activeList.add(IndirectCostRecoveryAccount.copyICRAccount(icr));
972            }
973        }
974        return activeList;
975    }
976
977    @Override
978    public void setIndirectCostRecoveryAccounts(List<? extends IndirectCostRecoveryAccount> indirectCostRecoveryAccounts) {
979        List<IndirectCostRecoveryAccount> accountIcrList = new ArrayList<IndirectCostRecoveryAccount>();
980        for (IndirectCostRecoveryAccount icr : indirectCostRecoveryAccounts){
981            accountIcrList.add(icr);
982        }
983        this.indirectCostRecoveryAccounts = accountIcrList;
984    }
985
986    /**
987     * Gets the accountOffCampusIndicator attribute.
988     *
989     * @return Returns the accountOffCampusIndicator
990     */
991    @Override
992    public boolean isAccountOffCampusIndicator() {
993        return accountOffCampusIndicator;
994    }
995
996    /**
997     * Sets the accountOffCampusIndicator attribute.
998     *
999     * @param accountOffCampusIndicator The accountOffCampusIndicator to set.
1000     */
1001    @Override
1002    public void setAccountOffCampusIndicator(boolean accountOffCampusIndicator) {
1003        this.accountOffCampusIndicator = accountOffCampusIndicator;
1004    }
1005
1006    /**
1007     * Gets the active attribute.
1008     *
1009     * @return Returns the active
1010     */
1011    @Override
1012    public boolean isActive() {
1013        return active;
1014    }
1015
1016    /**
1017     * Sets the active attribute.
1018     *
1019     * @param active The active to set.
1020     */
1021    @Override
1022    public void setActive(boolean active) {
1023        this.active = active;
1024    }
1025
1026    /**
1027     * Returns whether this account is not active or not
1028     *
1029     * @return the opposite of isActive()
1030     */
1031    @Override
1032    public boolean isClosed() {
1033        return !active;
1034    }
1035
1036    /**
1037     * Sets the closed attribute.
1038     *
1039     * @param closed The closed to set.
1040     */
1041    public void setClosed(boolean closed) {
1042        this.active = !closed;
1043    }
1044
1045    /**
1046     * Gets the chartOfAccounts attribute.
1047     *
1048     * @return Returns the chartOfAccounts
1049     */
1050    @Override
1051    public Chart getChartOfAccounts() {
1052        return chartOfAccounts;
1053    }
1054
1055    /**
1056     * Sets the chartOfAccounts attribute.
1057     *
1058     * @param chartOfAccounts The chartOfAccounts to set.
1059     * @deprecated
1060     */
1061    @Deprecated
1062    @Override
1063    public void setChartOfAccounts(Chart chartOfAccounts) {
1064        this.chartOfAccounts = chartOfAccounts;
1065    }
1066
1067    /**
1068     * Gets the organization attribute.
1069     *
1070     * @return Returns the organization
1071     */
1072    @Override
1073    public Organization getOrganization() {
1074        return organization;
1075    }
1076
1077    /**
1078     * Sets the organization attribute.
1079     *
1080     * @param organization The organization to set.
1081     * @deprecated
1082     */
1083    @Deprecated
1084    @Override
1085    public void setOrganization(Organization organization) {
1086        this.organization = organization;
1087    }
1088
1089    /**
1090     * Gets the accountType attribute.
1091     *
1092     * @return Returns the accountType
1093     */
1094    @Override
1095    public AccountType getAccountType() {
1096        return accountType;
1097    }
1098
1099    /**
1100     * Sets the accountType attribute.
1101     *
1102     * @param accountType The accountType to set.
1103     * @deprecated
1104     */
1105    @Deprecated
1106    @Override
1107    public void setAccountType(AccountType accountType) {
1108        this.accountType = accountType;
1109    }
1110
1111    /**
1112     * Gets the accountPhysicalCampus attribute.
1113     *
1114     * @return Returns the accountPhysicalCampus
1115     */
1116    @Override
1117    public CampusEbo getAccountPhysicalCampus() {
1118        if ( StringUtils.isBlank(accountPhysicalCampusCode) ) {
1119            accountPhysicalCampus = null;
1120        } else {
1121            if ( accountPhysicalCampus == null || !StringUtils.equals( accountPhysicalCampus.getCode(),accountPhysicalCampusCode) ) {
1122                ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CampusEbo.class);
1123                if ( moduleService != null ) {
1124                    Map<String,Object> keys = new HashMap<String, Object>(1);
1125                    keys.put(LocationConstants.PrimaryKeyConstants.CODE, accountPhysicalCampusCode);
1126                    accountPhysicalCampus = moduleService.getExternalizableBusinessObject(CampusEbo.class, keys);
1127                } else {
1128                    throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
1129                }
1130            }
1131        }
1132        return accountPhysicalCampus;
1133    }
1134
1135    /**
1136     * Sets the accountPhysicalCampus attribute.
1137     *
1138     * @param accountPhysicalCampus The accountPhysicalCampus to set.
1139     * @deprecated
1140     */
1141    @Deprecated
1142    @Override
1143    public void setAccountPhysicalCampus(CampusEbo accountPhysicalCampus) {
1144        this.accountPhysicalCampus = accountPhysicalCampus;
1145    }
1146
1147    /**
1148     * Gets the accountState attribute
1149     *
1150     * @return Returns the accountState
1151     */
1152    @Override
1153    public StateEbo getAccountState() {
1154        if ( StringUtils.isBlank(accountStateCode) || StringUtils.isBlank(accountCountryCode) ) {
1155            accountState = null;
1156        } else {
1157            if ( accountState == null || !StringUtils.equals( accountState.getCode(),accountStateCode) || !StringUtils.equals(accountState.getCountryCode(), accountCountryCode ) ) {
1158                ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(StateEbo.class);
1159                if ( moduleService != null ) {
1160                    Map<String,Object> keys = new HashMap<String, Object>(2);
1161                    keys.put(LocationConstants.PrimaryKeyConstants.COUNTRY_CODE, accountCountryCode);
1162                    keys.put(LocationConstants.PrimaryKeyConstants.CODE, accountStateCode);
1163                    accountState = moduleService.getExternalizableBusinessObject(StateEbo.class, keys);
1164                } else {
1165                    throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
1166                }
1167            }
1168        }
1169        return accountState;
1170    }
1171
1172    /**
1173     * Sets the accountState attribute
1174     *
1175     * @param state
1176     * @deprecated
1177     */
1178    @Deprecated
1179    @Override
1180    public void setAccountState(StateEbo state) {
1181        this.accountState = state;
1182    }
1183
1184    /**
1185     * Gets the subFundGroup attribute.
1186     *
1187     * @return Returns the subFundGroup
1188     */
1189    @Override
1190    public SubFundGroup getSubFundGroup() {
1191        return subFundGroup;
1192    }
1193
1194    /**
1195     * Sets the subFundGroup attribute.
1196     *
1197     * @param subFundGroup The subFundGroup to set.
1198     * @deprecated
1199     */
1200    @Deprecated
1201    @Override
1202    public void setSubFundGroup(SubFundGroup subFundGroup) {
1203        this.subFundGroup = subFundGroup;
1204    }
1205
1206    /**
1207     * Gets the financialHigherEdFunction attribute.
1208     *
1209     * @return Returns the financialHigherEdFunction
1210     */
1211    @Override
1212    public HigherEducationFunction getFinancialHigherEdFunction() {
1213        return financialHigherEdFunction;
1214    }
1215
1216    /**
1217     * Sets the financialHigherEdFunction attribute.
1218     *
1219     * @param financialHigherEdFunction The financialHigherEdFunction to set.
1220     * @deprecated
1221     */
1222    @Deprecated
1223    @Override
1224    public void setFinancialHigherEdFunction(HigherEducationFunction financialHigherEdFunction) {
1225        this.financialHigherEdFunction = financialHigherEdFunction;
1226    }
1227
1228    /**
1229     * Gets the accountRestrictedStatus attribute.
1230     *
1231     * @return Returns the accountRestrictedStatus
1232     */
1233    @Override
1234    public RestrictedStatus getAccountRestrictedStatus() {
1235        return accountRestrictedStatus;
1236    }
1237
1238    /**
1239     * Sets the accountRestrictedStatus attribute.
1240     *
1241     * @param accountRestrictedStatus The accountRestrictedStatus to set.
1242     * @deprecated
1243     */
1244    @Deprecated
1245    @Override
1246    public void setAccountRestrictedStatus(RestrictedStatus accountRestrictedStatus) {
1247        this.accountRestrictedStatus = accountRestrictedStatus;
1248    }
1249
1250    /**
1251     * Gets the reportsToAccount attribute.
1252     *
1253     * @return Returns the reportsToAccount
1254     */
1255    @Override
1256    public Account getReportsToAccount() {
1257        return reportsToAccount;
1258    }
1259
1260    /**
1261     * Sets the reportsToAccount attribute.
1262     *
1263     * @param reportsToAccount The reportsToAccount to set.
1264     * @deprecated
1265     */
1266    @Deprecated
1267    @Override
1268    public void setReportsToAccount(Account reportsToAccount) {
1269        this.reportsToAccount = reportsToAccount;
1270    }
1271
1272    /**
1273     * Gets the endowmentIncomeAccount attribute.
1274     *
1275     * @return Returns the endowmentIncomeAccount
1276     */
1277    @Override
1278    public Account getEndowmentIncomeAccount() {
1279        return endowmentIncomeAccount;
1280    }
1281
1282    /**
1283     * Sets the endowmentIncomeAccount attribute.
1284     *
1285     * @param endowmentIncomeAccount The endowmentIncomeAccount to set.
1286     * @deprecated
1287     */
1288    @Deprecated
1289    @Override
1290    public void setEndowmentIncomeAccount(Account endowmentIncomeAccount) {
1291        this.endowmentIncomeAccount = endowmentIncomeAccount;
1292    }
1293
1294    /**
1295     * Gets the contractControlAccount attribute.
1296     *
1297     * @return Returns the contractControlAccount
1298     */
1299    @Override
1300    public Account getContractControlAccount() {
1301        return contractControlAccount;
1302    }
1303
1304    /**
1305     * Sets the contractControlAccount attribute.
1306     *
1307     * @param contractControlAccount The contractControlAccount to set.
1308     * @deprecated
1309     */
1310    @Deprecated
1311    @Override
1312    public void setContractControlAccount(Account contractControlAccount) {
1313        this.contractControlAccount = contractControlAccount;
1314    }
1315
1316
1317    /**
1318     * Gets the incomeStreamAccount attribute.
1319     *
1320     * @return Returns the incomeStreamAccount
1321     */
1322    @Override
1323    public Account getIncomeStreamAccount() {
1324        return incomeStreamAccount;
1325    }
1326
1327    /**
1328     * Sets the incomeStreamAccount attribute.
1329     *
1330     * @param incomeStreamAccount The incomeStreamAccount to set.
1331     * @deprecated
1332     */
1333    @Deprecated
1334    @Override
1335    public void setIncomeStreamAccount(Account incomeStreamAccount) {
1336        this.incomeStreamAccount = incomeStreamAccount;
1337    }
1338
1339    @Override
1340    public Person getAccountFiscalOfficerUser() {
1341        accountFiscalOfficerUser = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(accountFiscalOfficerSystemIdentifier, accountFiscalOfficerUser);
1342        return accountFiscalOfficerUser;
1343    }
1344
1345    /**
1346     * This fix is temporary until Jonathan's fix is reflected to Rice
1347     * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#refreshReferenceObject(java.lang.String)
1348     */
1349    @Override
1350    public void refreshReferenceObject(String referenceObjectName) {
1351        if (referenceObjectName.equals("accountFiscalOfficerUser") ||
1352            referenceObjectName.equals("accountSupervisoryUser") ||
1353            referenceObjectName.equals("accountManagerUser")) {
1354            // do nothing
1355        } else {
1356            super.refreshReferenceObject(referenceObjectName);
1357        }
1358    }
1359
1360   /**
1361     * @param accountFiscalOfficerUser The accountFiscalOfficerUser to set.
1362     * @deprecated
1363     */
1364    @Deprecated
1365    @Override
1366    public void setAccountFiscalOfficerUser(Person accountFiscalOfficerUser) {
1367        this.accountFiscalOfficerUser = accountFiscalOfficerUser;
1368    }
1369
1370    @Override
1371    public Person getAccountManagerUser() {
1372        accountManagerUser = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(accountManagerSystemIdentifier, accountManagerUser);
1373        return accountManagerUser;
1374    }
1375
1376    /**
1377     * @param accountManagerUser The accountManagerUser to set.
1378     * @deprecated
1379     */
1380    @Deprecated
1381    @Override
1382    public void setAccountManagerUser(Person accountManagerUser) {
1383        this.accountManagerUser = accountManagerUser;
1384    }
1385
1386
1387    @Override
1388    public Person getAccountSupervisoryUser() {
1389        accountSupervisoryUser = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(accountsSupervisorySystemsIdentifier, accountSupervisoryUser);
1390        return accountSupervisoryUser;
1391    }
1392
1393    /**
1394     * @param accountSupervisoryUser The accountSupervisoryUser to set.
1395     * @deprecated
1396     */
1397    @Deprecated
1398    @Override
1399    public void setAccountSupervisoryUser(Person accountSupervisoryUser) {
1400        this.accountSupervisoryUser = accountSupervisoryUser;
1401    }
1402
1403
1404    /**
1405     * @return Returns the continuationAccount.
1406     */
1407    @Override
1408    public Account getContinuationAccount() {
1409        return continuationAccount;
1410    }
1411
1412
1413    /**
1414     * @param continuationAccount The continuationAccount to set.
1415     * @deprecated
1416     */
1417    @Deprecated
1418    @Override
1419    public void setContinuationAccount(Account continuationAccount) {
1420        this.continuationAccount = continuationAccount;
1421    }
1422
1423    /**
1424     * @return Returns the accountGuideline.
1425     */
1426    @Override
1427    public AccountGuideline getAccountGuideline() {
1428        return accountGuideline;
1429    }
1430
1431
1432    /**
1433     * @param accountGuideline The accountGuideline to set.
1434     */
1435    @Override
1436    public void setAccountGuideline(AccountGuideline accountGuideline) {
1437        this.accountGuideline = accountGuideline;
1438    }
1439
1440
1441    /**
1442     * Gets the accountDescription attribute.
1443     *
1444     * @return Returns the accountDescription.
1445     */
1446    @Override
1447    public AccountDescription getAccountDescription() {
1448        return accountDescription;
1449    }
1450
1451    /**
1452     * Sets the accountDescription attribute value.
1453     *
1454     * @param accountDescription The accountDescription to set.
1455     */
1456    @Override
1457    public void setAccountDescription(AccountDescription accountDescription) {
1458        this.accountDescription = accountDescription;
1459    }
1460
1461    /**
1462     * @return Returns the subAccounts.
1463     */
1464    @Override
1465    public List getSubAccounts() {
1466        return subAccounts;
1467    }
1468
1469
1470    /**
1471     * @param subAccounts The subAccounts to set.
1472     */
1473    @Override
1474    public void setSubAccounts(List subAccounts) {
1475        this.subAccounts = subAccounts;
1476    }
1477
1478
1479    /**
1480     * @return Returns the chartOfAccountsCode.
1481     */
1482    @Override
1483    public String getChartOfAccountsCode() {
1484        return chartOfAccountsCode;
1485    }
1486
1487
1488    /**
1489     * @param chartOfAccountsCode The chartOfAccountsCode to set.
1490     */
1491    @Override
1492    public void setChartOfAccountsCode(String chartOfAccountsCode) {
1493        this.chartOfAccountsCode = chartOfAccountsCode;
1494    }
1495
1496
1497    /**
1498     * @return Returns the accountFiscalOfficerSystemIdentifier.
1499     */
1500    @Override
1501    public String getAccountFiscalOfficerSystemIdentifier() {
1502        return accountFiscalOfficerSystemIdentifier;
1503    }
1504
1505    /**
1506     * @return Returns the accountFiscalOfficerSystemIdentifier.
1507     */
1508    public String getAccountFiscalOfficerSystemIdentifierForSearching() {
1509        return getAccountFiscalOfficerSystemIdentifier();
1510    }
1511
1512
1513    /**
1514     * @param accountFiscalOfficerSystemIdentifier The accountFiscalOfficerSystemIdentifier to set.
1515     */
1516    @Override
1517    public void setAccountFiscalOfficerSystemIdentifier(String accountFiscalOfficerSystemIdentifier) {
1518        this.accountFiscalOfficerSystemIdentifier = accountFiscalOfficerSystemIdentifier;
1519    }
1520
1521    /**
1522     * @return Returns the accountManagerSystemIdentifier.
1523     */
1524    @Override
1525    public String getAccountManagerSystemIdentifier() {
1526        return accountManagerSystemIdentifier;
1527    }
1528
1529    /**
1530     * @return Returns the accountManagerSystemIdentifier.
1531     */
1532    public String getAccountManagerSystemIdentifierForSearching() {
1533        return getAccountManagerSystemIdentifier();
1534    }
1535
1536    /**
1537     * @param accountManagerSystemIdentifier The accountManagerSystemIdentifier to set.
1538     */
1539    @Override
1540    public void setAccountManagerSystemIdentifier(String accountManagerSystemIdentifier) {
1541        this.accountManagerSystemIdentifier = accountManagerSystemIdentifier;
1542    }
1543
1544    /**
1545     * @return Returns the accountPhysicalCampusCode.
1546     */
1547    @Override
1548    public String getAccountPhysicalCampusCode() {
1549        return accountPhysicalCampusCode;
1550    }
1551
1552    /**
1553     * @param accountPhysicalCampusCode The accountPhysicalCampusCode to set.
1554     */
1555    @Override
1556    public void setAccountPhysicalCampusCode(String accountPhysicalCampusCode) {
1557        this.accountPhysicalCampusCode = accountPhysicalCampusCode;
1558    }
1559
1560    /**
1561     * @return Returns the accountRestrictedStatusCode.
1562     */
1563    @Override
1564    public String getAccountRestrictedStatusCode() {
1565        return accountRestrictedStatusCode;
1566    }
1567
1568    /**
1569     * @param accountRestrictedStatusCode The accountRestrictedStatusCode to set.
1570     */
1571    @Override
1572    public void setAccountRestrictedStatusCode(String accountRestrictedStatusCode) {
1573        this.accountRestrictedStatusCode = accountRestrictedStatusCode;
1574    }
1575
1576    /**
1577     * @return Returns the accountsSupervisorySystemsIdentifier.
1578     */
1579    @Override
1580    public String getAccountsSupervisorySystemsIdentifier() {
1581        return accountsSupervisorySystemsIdentifier;
1582    }
1583
1584    /**
1585     * @return Returns the accountsSupervisorySystemsIdentifier.
1586     */
1587    public String getAccountsSupervisorySystemsIdentifierForSearching() {
1588        return accountsSupervisorySystemsIdentifier;
1589    }
1590
1591    /**
1592     * @param accountsSupervisorySystemsIdentifier The accountsSupervisorySystemsIdentifier to set.
1593     */
1594    @Override
1595    public void setAccountsSupervisorySystemsIdentifier(String accountsSupervisorySystemsIdentifier) {
1596        this.accountsSupervisorySystemsIdentifier = accountsSupervisorySystemsIdentifier;
1597    }
1598
1599    /**
1600     * @return Returns the accountTypeCode.
1601     */
1602    @Override
1603    public String getAccountTypeCode() {
1604        return accountTypeCode;
1605    }
1606
1607    /**
1608     * @param accountTypeCode The accountTypeCode to set.
1609     */
1610    @Override
1611    public void setAccountTypeCode(String accountTypeCode) {
1612        this.accountTypeCode = accountTypeCode;
1613    }
1614
1615    /**
1616     * @return Returns the continuationAccountNumber.
1617     */
1618    @Override
1619    public String getContinuationAccountNumber() {
1620        return continuationAccountNumber;
1621    }
1622
1623    /**
1624     * @param continuationAccountNumber The continuationAccountNumber to set.
1625     */
1626    @Override
1627    public void setContinuationAccountNumber(String continuationAccountNumber) {
1628        this.continuationAccountNumber = continuationAccountNumber;
1629    }
1630
1631    /**
1632     * @return Returns the continuationFinChrtOfAcctCd.
1633     */
1634    @Override
1635    public String getContinuationFinChrtOfAcctCd() {
1636        return continuationFinChrtOfAcctCd;
1637    }
1638
1639    /**
1640     * @param continuationFinChrtOfAcctCd The continuationFinChrtOfAcctCd to set.
1641     */
1642    @Override
1643    public void setContinuationFinChrtOfAcctCd(String continuationFinChrtOfAcctCd) {
1644        this.continuationFinChrtOfAcctCd = continuationFinChrtOfAcctCd;
1645    }
1646
1647    /**
1648     * @return Returns the contractControlAccountNumber.
1649     */
1650    @Override
1651    public String getContractControlAccountNumber() {
1652        return contractControlAccountNumber;
1653    }
1654
1655    /**
1656     * @param contractControlAccountNumber The contractControlAccountNumber to set.
1657     */
1658    @Override
1659    public void setContractControlAccountNumber(String contractControlAccountNumber) {
1660        this.contractControlAccountNumber = contractControlAccountNumber;
1661    }
1662
1663    /**
1664     * @return Returns the contractControlFinCoaCode.
1665     */
1666    @Override
1667    public String getContractControlFinCoaCode() {
1668        return contractControlFinCoaCode;
1669    }
1670
1671    /**
1672     * @param contractControlFinCoaCode The contractControlFinCoaCode to set.
1673     */
1674    @Override
1675    public void setContractControlFinCoaCode(String contractControlFinCoaCode) {
1676        this.contractControlFinCoaCode = contractControlFinCoaCode;
1677    }
1678
1679    /**
1680     * @return Returns the endowmentIncomeAccountNumber.
1681     */
1682    @Override
1683    public String getEndowmentIncomeAccountNumber() {
1684        return endowmentIncomeAccountNumber;
1685    }
1686
1687    /**
1688     * @param endowmentIncomeAccountNumber The endowmentIncomeAccountNumber to set.
1689     */
1690    @Override
1691    public void setEndowmentIncomeAccountNumber(String endowmentIncomeAccountNumber) {
1692        this.endowmentIncomeAccountNumber = endowmentIncomeAccountNumber;
1693    }
1694
1695    /**
1696     * @return Returns the endowmentIncomeAcctFinCoaCd.
1697     */
1698    @Override
1699    public String getEndowmentIncomeAcctFinCoaCd() {
1700        return endowmentIncomeAcctFinCoaCd;
1701    }
1702
1703    /**
1704     * @param endowmentIncomeAcctFinCoaCd The endowmentIncomeAcctFinCoaCd to set.
1705     */
1706    @Override
1707    public void setEndowmentIncomeAcctFinCoaCd(String endowmentIncomeAcctFinCoaCd) {
1708        this.endowmentIncomeAcctFinCoaCd = endowmentIncomeAcctFinCoaCd;
1709    }
1710
1711    /**
1712     * @return Returns the financialHigherEdFunctionCd.
1713     */
1714    @Override
1715    public String getFinancialHigherEdFunctionCd() {
1716        return financialHigherEdFunctionCd;
1717    }
1718
1719    /**
1720     * @param financialHigherEdFunctionCd The financialHigherEdFunctionCd to set.
1721     */
1722    @Override
1723    public void setFinancialHigherEdFunctionCd(String financialHigherEdFunctionCd) {
1724        this.financialHigherEdFunctionCd = financialHigherEdFunctionCd;
1725    }
1726
1727    /**
1728     * @return Returns the incomeStreamAccountNumber.
1729     */
1730    @Override
1731    public String getIncomeStreamAccountNumber() {
1732        return incomeStreamAccountNumber;
1733    }
1734
1735    /**
1736     * @param incomeStreamAccountNumber The incomeStreamAccountNumber to set.
1737     */
1738    @Override
1739    public void setIncomeStreamAccountNumber(String incomeStreamAccountNumber) {
1740        this.incomeStreamAccountNumber = incomeStreamAccountNumber;
1741    }
1742
1743    /**
1744     * @return Returns the incomeStreamFinancialCoaCode.
1745     */
1746    @Override
1747    public String getIncomeStreamFinancialCoaCode() {
1748        return incomeStreamFinancialCoaCode;
1749    }
1750
1751    /**
1752     * @param incomeStreamFinancialCoaCode The incomeStreamFinancialCoaCode to set.
1753     */
1754    @Override
1755    public void setIncomeStreamFinancialCoaCode(String incomeStreamFinancialCoaCode) {
1756        this.incomeStreamFinancialCoaCode = incomeStreamFinancialCoaCode;
1757    }
1758
1759    /**
1760     * @return Returns the organizationCode.
1761     */
1762    @Override
1763    public String getOrganizationCode() {
1764        return organizationCode;
1765    }
1766
1767    /**
1768     * @param organizationCode The organizationCode to set.
1769     */
1770    @Override
1771    public void setOrganizationCode(String organizationCode) {
1772        this.organizationCode = organizationCode;
1773    }
1774
1775    /**
1776     * @return Returns the reportsToAccountNumber.
1777     */
1778    @Override
1779    public String getReportsToAccountNumber() {
1780        return reportsToAccountNumber;
1781    }
1782
1783    /**
1784     * @param reportsToAccountNumber The reportsToAccountNumber to set.
1785     */
1786    @Override
1787    public void setReportsToAccountNumber(String reportsToAccountNumber) {
1788        this.reportsToAccountNumber = reportsToAccountNumber;
1789    }
1790
1791    /**
1792     * @return Returns the reportsToChartOfAccountsCode.
1793     */
1794    @Override
1795    public String getReportsToChartOfAccountsCode() {
1796        return reportsToChartOfAccountsCode;
1797    }
1798
1799    /**
1800     * @param reportsToChartOfAccountsCode The reportsToChartOfAccountsCode to set.
1801     */
1802    @Override
1803    public void setReportsToChartOfAccountsCode(String reportsToChartOfAccountsCode) {
1804        this.reportsToChartOfAccountsCode = reportsToChartOfAccountsCode;
1805    }
1806
1807    /**
1808     * @return Returns the subFundGroupCode.
1809     */
1810    @Override
1811    public String getSubFundGroupCode() {
1812        return subFundGroupCode;
1813    }
1814
1815    /**
1816     * @param subFundGroupCode The subFundGroupCode to set.
1817     */
1818    @Override
1819    public void setSubFundGroupCode(String subFundGroupCode) {
1820        this.subFundGroupCode = subFundGroupCode;
1821        forContractsAndGrants = null;
1822    }
1823
1824    /**
1825     * Gets the postalZipCode attribute.
1826     *
1827     * @return Returns the postalZipCode.
1828     */
1829    @Override
1830    public PostalCodeEbo getPostalZipCode() {
1831        if ( StringUtils.isBlank(accountZipCode) || StringUtils.isBlank( accountCountryCode ) ) {
1832            postalZipCode = null;
1833        } else {
1834            if ( postalZipCode == null || !StringUtils.equals( postalZipCode.getCode(),accountZipCode)
1835                    || !StringUtils.equals(postalZipCode.getCountryCode(), accountCountryCode ) ) {
1836                ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(PostalCodeEbo.class);
1837                if ( moduleService != null ) {
1838                    Map<String,Object> keys = new HashMap<String, Object>(2);
1839                    keys.put(LocationConstants.PrimaryKeyConstants.COUNTRY_CODE, accountCountryCode);
1840                    keys.put(LocationConstants.PrimaryKeyConstants.CODE, accountZipCode);
1841                    postalZipCode = moduleService.getExternalizableBusinessObject(PostalCodeEbo.class, keys);
1842                } else {
1843                    throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class.  Unable to proceed." );
1844                }
1845            }
1846        }
1847        return postalZipCode;
1848    }
1849
1850    /**
1851     * Sets the postalZipCode attribute value.
1852     *
1853     * @param postalZipCode The postalZipCode to set.
1854     */
1855    @Override
1856    public void setPostalZipCode(PostalCodeEbo postalZipCode) {
1857        this.postalZipCode = postalZipCode;
1858    }
1859
1860    /**
1861     * Gets the budgetRecordingLevel attribute.
1862     *
1863     * @return Returns the budgetRecordingLevel.
1864     */
1865    @Override
1866    public BudgetRecordingLevel getBudgetRecordingLevel() {
1867        return budgetRecordingLevel;
1868    }
1869
1870    /**
1871     * Sets the budgetRecordingLevel attribute value.
1872     *
1873     * @param budgetRecordingLevel The budgetRecordingLevel to set.
1874     */
1875    @Override
1876    public void setBudgetRecordingLevel(BudgetRecordingLevel budgetRecordingLevel) {
1877        this.budgetRecordingLevel = budgetRecordingLevel;
1878    }
1879
1880    /**
1881     * Gets the sufficientFundsCode attribute.
1882     *
1883     * @return Returns the sufficientFundsCode.
1884     */
1885    @Override
1886    public SufficientFundsCode getSufficientFundsCode() {
1887        return sufficientFundsCode;
1888    }
1889
1890    /**
1891     * Sets the sufficientFundsCode attribute value.
1892     *
1893     * @param sufficientFundsCode The sufficientFundsCode to set.
1894     */
1895    @Override
1896    public void setSufficientFundsCode(SufficientFundsCode sufficientFundsCode) {
1897        this.sufficientFundsCode = sufficientFundsCode;
1898    }
1899
1900    /**
1901     * Gets the acctIndirectCostRcvyType attribute.
1902     *
1903     * @return Returns the acctIndirectCostRcvyType.
1904     */
1905    public IndirectCostRecoveryType getAcctIndirectCostRcvyType() {
1906        return acctIndirectCostRcvyType;
1907    }
1908
1909    /**
1910     * Sets the acctIndirectCostRcvyType attribute value.
1911     *
1912     * @param acctIndirectCostRcvyType The acctIndirectCostRcvyType to set.
1913     */
1914    public void setAcctIndirectCostRcvyType(IndirectCostRecoveryType acctIndirectCostRcvyType) {
1915        this.acctIndirectCostRcvyType = acctIndirectCostRcvyType;
1916    }
1917
1918    /**
1919     * Implementing equals since I need contains to behave reasonably in a hashed datastructure.
1920     *
1921     * @see java.lang.Object#equals(java.lang.Object)
1922     */
1923    @Override
1924    public boolean equals(Object obj) {
1925        boolean equal = false;
1926
1927        if (obj != null) {
1928            if (this.getClass().equals(obj.getClass())) {
1929                Account other = (Account) obj;
1930
1931                if (StringUtils.equals(this.getChartOfAccountsCode(), other.getChartOfAccountsCode())) {
1932                    if (StringUtils.equals(this.getAccountNumber(), other.getAccountNumber())) {
1933                        equal = true;
1934                    }
1935                }
1936            }
1937        }
1938
1939        return equal;
1940    }
1941
1942    /**
1943     * Calcluates hashCode based on current values of chartOfAccountsCode and accountNumber fields. Somewhat dangerous, since both
1944     * of those fields are mutable, but I don't expect people to be editing those values directly for Accounts stored in hashed
1945     * datastructures.
1946     *
1947     * @see java.lang.Object#hashCode()
1948     */
1949    @Override
1950    public int hashCode() {
1951        String hashString = getChartOfAccountsCode() + "|" + getAccountNumber();
1952
1953        return hashString.hashCode();
1954    }
1955
1956
1957    /**
1958     * Convenience method to make the primitive account fields from this Account easier to compare to the account fields from
1959     * another Account or an AccountingLine
1960     *
1961     * @return String representing the account associated with this Accounting
1962     */
1963    @Override
1964    public String getAccountKey() {
1965        String key = getChartOfAccountsCode() + ":" + getAccountNumber();
1966        return key;
1967    }
1968
1969    /**
1970     * Gets the dummy attribute.
1971     *
1972     * @return Returns the dummy.
1973     */
1974
1975    /**
1976     * Gets the accountResponsibilitySection attribute.
1977     *
1978     * @return Returns the accountResponsibilitySection.
1979     */
1980    @Override
1981    public String getAccountResponsibilitySection() {
1982        return accountResponsibilitySection;
1983    }
1984
1985    /**
1986     * Sets the accountResponsibilitySection attribute value.
1987     *
1988     * @param accountResponsibilitySection The accountResponsibilitySection to set.
1989     */
1990    @Override
1991    public void setAccountResponsibilitySection(String accountResponsibilitySection) {
1992        this.accountResponsibilitySection = accountResponsibilitySection;
1993    }
1994
1995    /**
1996     * Gets the contractsAndGrantsSection attribute.
1997     *
1998     * @return Returns the contractsAndGrantsSection.
1999     */
2000    @Override
2001    public String getContractsAndGrantsSection() {
2002        return contractsAndGrantsSection;
2003    }
2004
2005    /**
2006     * Sets the contractsAndGrantsSection attribute value.
2007     *
2008     * @param contractsAndGrantsSection The contractsAndGrantsSection to set.
2009     */
2010    @Override
2011    public void setContractsAndGrantsSection(String contractsAndGrantsSection) {
2012        this.contractsAndGrantsSection = contractsAndGrantsSection;
2013    }
2014
2015    /**
2016     * Gets the accountDescriptionSection attribute.
2017     *
2018     * @return Returns the accountDescriptionSection.
2019     */
2020    @Override
2021    public String getAccountDescriptionSection() {
2022        return accountDescriptionSection;
2023    }
2024
2025    /**
2026     * Sets the accountDescriptionSection attribute value.
2027     *
2028     * @param accountDescriptionSection The accountDescriptionSection to set.
2029     */
2030    @Override
2031    public void setAccountDescriptionSection(String accountDescriptionSection) {
2032        this.accountDescriptionSection = accountDescriptionSection;
2033    }
2034
2035    /**
2036     * Gets the guidelinesAndPurposeSection attribute.
2037     *
2038     * @return Returns the guidelinesAndPurposeSection.
2039     */
2040    @Override
2041    public String getGuidelinesAndPurposeSection() {
2042        return guidelinesAndPurposeSection;
2043    }
2044
2045    /**
2046     * Sets the guidelinesAndPurposeSection attribute value.
2047     *
2048     * @param guidelinesAndPurposeSection The guidelinesAndPurposeSection to set.
2049     */
2050    @Override
2051    public void setGuidelinesAndPurposeSection(String guidelinesAndPurposeSection) {
2052        this.guidelinesAndPurposeSection = guidelinesAndPurposeSection;
2053    }
2054
2055    /**
2056     * Gets the accountResponsibilitySectionBlank attribute.
2057     *
2058     * @return Returns the accountResponsibilitySectionBlank.
2059     */
2060    @Override
2061    public String getAccountResponsibilitySectionBlank() {
2062        return accountResponsibilitySectionBlank;
2063    }
2064
2065    /**
2066     * Gets the contractsAndGrantsSectionBlank attribute.
2067     *
2068     * @return Returns the contractsAndGrantsSectionBlank.
2069     */
2070    @Override
2071    public String getContractsAndGrantsSectionBlank() {
2072        return contractsAndGrantsSectionBlank;
2073    }
2074
2075    /**
2076     * Gets the accountDescriptionSectionBlank attribute.
2077     *
2078     * @return Returns the accountDescriptionSectionBlank.
2079     */
2080    @Override
2081    public String getAccountDescriptionSectionBlank() {
2082        return accountDescriptionSectionBlank;
2083    }
2084
2085    /**
2086     * Gets the guidelinesAndPurposeSectionBlank attribute.
2087     *
2088     * @return Returns the guidelinesAndPurposeSectionBlank.
2089     */
2090    @Override
2091    public String getGuidelinesAndPurposeSectionBlank() {
2092        return guidelinesAndPurposeSectionBlank;
2093    }
2094
2095    /**
2096     * Gets the endowmentIncomeChartOfAccounts attribute.
2097     *
2098     * @return Returns the endowmentIncomeChartOfAccounts.
2099     */
2100    public Chart getEndowmentIncomeChartOfAccounts() {
2101        return endowmentIncomeChartOfAccounts;
2102    }
2103
2104    /**
2105     * Sets the endowmentIncomeChartOfAccounts attribute value.
2106     *
2107     * @param endowmentIncomeChartOfAccounts The endowmentIncomeChartOfAccounts to set.
2108     */
2109    public void setEndowmentIncomeChartOfAccounts(Chart endowmentIncomeChartOfAccounts) {
2110        this.endowmentIncomeChartOfAccounts = endowmentIncomeChartOfAccounts;
2111    }
2112
2113    @Override protected void preUpdate() {
2114        super.preUpdate();
2115        try {
2116            // KULCOA-549: update the sufficient funds table
2117            // get the current data from the database
2118            BusinessObjectService boService = SpringContext.getBean(BusinessObjectService.class);
2119            Account originalAcct = (Account) boService.retrieve(this);
2120
2121            if (originalAcct != null) {
2122                if (!originalAcct.getSufficientFundsCode().equals(getSufficientFundsCode()) || originalAcct.isExtrnlFinEncumSufficntFndIndicator() != isExtrnlFinEncumSufficntFndIndicator() || originalAcct.isIntrnlFinEncumSufficntFndIndicator() != isIntrnlFinEncumSufficntFndIndicator() || originalAcct.isPendingAcctSufficientFundsIndicator() != isPendingAcctSufficientFundsIndicator() || originalAcct.isFinPreencumSufficientFundIndicator() != isFinPreencumSufficientFundIndicator()) {
2123                    SufficientFundRebuild sfr = new SufficientFundRebuild();
2124                    sfr.setAccountFinancialObjectTypeCode(SufficientFundRebuild.REBUILD_ACCOUNT);
2125                    sfr.setChartOfAccountsCode(getChartOfAccountsCode());
2126                    sfr.setAccountNumberFinancialObjectCode(getAccountNumber());
2127                    if (boService.retrieve(sfr) == null) {
2128                        boService.save(sfr);
2129                    }
2130                }
2131            }
2132        }
2133        catch (Exception ex) {
2134            LOG.error("Problem updating sufficient funds rebuild table: ", ex);
2135        }
2136    }
2137
2138    /**
2139     * Gets the forContractsAndGrants attribute.
2140     *
2141     * @return Returns the forContractsAndGrants.
2142     */
2143    @Override
2144    public boolean isForContractsAndGrants() {
2145        if ( forContractsAndGrants == null ) {
2146            forContractsAndGrants = SpringContext.getBean(SubFundGroupService.class).isForContractsAndGrants(getSubFundGroup());
2147        }
2148        return forContractsAndGrants;
2149    }
2150
2151    /**
2152     * determine if the given account is awarded by a federal agency
2153     *
2154     * @param account the given account
2155     * @param federalAgencyTypeCodes the given federal agency type code
2156     * @return true if the given account is funded by a federal agency or associated with federal pass through indicator; otherwise,
2157     *         false
2158     */
2159    public boolean isAwardedByFederalAgency(List<String> federalAgencyTypeCodes) {
2160        return SpringContext.getBean(ContractsAndGrantsModuleService.class).isAwardedByFederalAgency(getChartOfAccountsCode(), getAccountNumber(), federalAgencyTypeCodes);
2161    }
2162
2163    /**
2164     * Gets the contractsAndGrantsAccountResponsibilityId attribute.
2165     *
2166     * @return Returns the contractsAndGrantsAccountResponsibilityId.
2167     */
2168    public Integer getContractsAndGrantsAccountResponsibilityId() {
2169        return contractsAndGrantsAccountResponsibilityId;
2170    }
2171
2172    /**
2173     * Sets the contractsAndGrantsAccountResponsibilityId attribute value.
2174     *
2175     * @param contractsAndGrantsAccountResponsibilityId The contractsAndGrantsAccountResponsibilityId to set.
2176     */
2177    public void setContractsAndGrantsAccountResponsibilityId(Integer contractsAndGrantsAccountResponsibilityId) {
2178        this.contractsAndGrantsAccountResponsibilityId = contractsAndGrantsAccountResponsibilityId;
2179    }
2180
2181    /**
2182     * Gets the laborBenefitRateCategoryCode attribute.
2183     * @return Returns the laborBenefitRateCategoryCode.
2184     */
2185    public String getLaborBenefitRateCategoryCode() {
2186        // added default value for jira OLE-3713
2187        if(laborBenefitRateCategoryCode != null) {
2188            return laborBenefitRateCategoryCode;
2189        }
2190        return OLEConstants.Account.LABOR_BENEFIT_RATE_CATEGORY_CODE;
2191    }
2192
2193    /**
2194     * Sets the laborBenefitRateCategoryCode attribute value.
2195     * @param laborBenefitRateCategoryCode The laborBenefitRateCategoryCode to set.
2196     */
2197    public void setLaborBenefitRateCategoryCode(String laborBenefitRateCategoryCode) {
2198        this.laborBenefitRateCategoryCode = laborBenefitRateCategoryCode;
2199    }
2200
2201//    /**
2202//     * Gets the laborBenefitRateCategory attribute.
2203//     * @return Returns the laborBenefitRateCategory.
2204//     */
2205//    public LaborBenefitRateCategory getLaborBenefitRateCategory() {
2206//        laborBenefitRateCategory = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(LaborBenefitRateCategory.class).retrieveExternalizableBusinessObjectIfNecessary(this, laborBenefitRateCategory, "laborBenefitRateCategory");
2207//        return laborBenefitRateCategory;
2208//    }
2209//
2210//    /**
2211//     * Sets the laborBenefitRateCategory attribute value.
2212//     * @param laborBenefitRateCategory The laborBenefitRateCategory to set.
2213//     */
2214//    public void setLaborBenefitRateCategory(LaborBenefitRateCategory laborBenefitRateCategory) {
2215//        this.laborBenefitRateCategory = laborBenefitRateCategory;
2216//    }
2217
2218
2219    /**
2220     * Gets the fringeBenefitsChartOfAccount attribute.
2221     *
2222     * @return Returns the fringeBenefitsChartOfAccount.
2223     */
2224    public Chart getFringeBenefitsChartOfAccount() {
2225        return fringeBenefitsChartOfAccount;
2226    }
2227
2228    /**
2229     * Sets the fringeBenefitsChartOfAccount attribute value.
2230     *
2231     * @param fringeBenefitsChartOfAccount The fringeBenefitsChartOfAccount to set.
2232     */
2233    public void setFringeBenefitsChartOfAccount(Chart fringeBenefitsChartOfAccount) {
2234        this.fringeBenefitsChartOfAccount = fringeBenefitsChartOfAccount;
2235    }
2236
2237    /**
2238     * Gets the continuationChartOfAccount attribute.
2239     *
2240     * @return Returns the continuationChartOfAccount.
2241     */
2242    public Chart getContinuationChartOfAccount() {
2243        return continuationChartOfAccount;
2244    }
2245
2246    /**
2247     * Sets the continuationChartOfAccount attribute value.
2248     *
2249     * @param continuationChartOfAccount The continuationChartOfAccount to set.
2250     */
2251    public void setContinuationChartOfAccount(Chart continuationChartOfAccount) {
2252        this.continuationChartOfAccount = continuationChartOfAccount;
2253    }
2254
2255    /**
2256     * Gets the incomeStreamChartOfAccounts attribute.
2257     *
2258     * @return Returns the incomeStreamChartOfAccounts.
2259     */
2260    public Chart getIncomeStreamChartOfAccounts() {
2261        return incomeStreamChartOfAccounts;
2262    }
2263
2264    /**
2265     * Sets the incomeStreamChartOfAccounts attribute value.
2266     *
2267     * @param incomeStreamChartOfAccounts The incomeStreamChartOfAccounts to set.
2268     */
2269    public void setIncomeStreamChartOfAccounts(Chart incomeStreamChartOfAccounts) {
2270        this.incomeStreamChartOfAccounts = incomeStreamChartOfAccounts;
2271    }
2272
2273    /**
2274    * Gets the incomeStreamChartOfAccounts attribute.
2275    *
2276    * @return Returns the incomeStreamChartOfAccounts.
2277    */
2278   public Chart getContractControlChartOfAccounts() {
2279       return contractControlChartOfAccounts;
2280   }
2281
2282   /**
2283    * Sets the contractControlChartOfAccounts attribute value.
2284    *
2285    * @param contractControlChartOfAccounts The contractControlChartOfAccounts to set.
2286    */
2287   public void setContractControlChartOfAccounts(Chart contractControlChartOfAccounts) {
2288       this.contractControlChartOfAccounts = contractControlChartOfAccounts;
2289   }
2290
2291    public KualiDecimal getThresholdPercentage() {
2292        return thresholdPercentage;
2293    }
2294
2295    public void setThresholdPercentage(KualiDecimal thresholdPercentage) {
2296        this.thresholdPercentage = thresholdPercentage;
2297    }
2298
2299    public KualiDecimal getThresholdAmount() {
2300        return thresholdAmount;
2301    }
2302
2303    public void setThresholdAmount(KualiDecimal thresholdAmount) {
2304        this.thresholdAmount = thresholdAmount;
2305    }
2306
2307    /**
2308    * Gets the indirectCostRcvyChartOfAccounts attribute.
2309    *
2310    * @return Returns the indirectCostRcvyChartOfAccounts.
2311    */
2312   @Override
2313   public List<Collection<PersistableBusinessObject>> buildListOfDeletionAwareLists() {
2314       List<Collection<PersistableBusinessObject>> managedLists = super.buildListOfDeletionAwareLists();
2315       managedLists.add( new ArrayList<PersistableBusinessObject>( getIndirectCostRecoveryAccounts() ));
2316       return managedLists;
2317   }
2318
2319    public String getAccountCountryCode() {
2320        return accountCountryCode;
2321    }
2322
2323    public void setAccountCountryCode(String accountCountryCode) {
2324        this.accountCountryCode = accountCountryCode;
2325    }
2326   /**
2327    * Used by the Spring Framework to correctly retrieve the Legacy Fund Code as a single
2328    * attribute. The oleLegacyFundCodes is a collection of legacyFundCodes, and without this method,
2329    * there was no way to get a single attribute for it.
2330    *
2331    * @return the Legacy Fund Codes as a single attribute
2332    */
2333   public String getLegacyFundCodeAsString() {
2334
2335       // Modified for jira OLE-2543 starts
2336       StringBuilder sb = new StringBuilder();
2337
2338       boolean first = true;
2339       for (OleLegacyFundCode legacyFundCode : oleLegacyFundCodes) {
2340           if (!first) {
2341            sb.append(", ");
2342        }
2343        else {
2344            first = false;
2345        }
2346           sb.append(legacyFundCode.getLegacyFundCode().toString());
2347       }
2348
2349       // Modified for jira OLE-2543 ends
2350       return sb.toString();
2351   }
2352
2353}