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.module.cg.businessobject;
018    
019    import java.sql.Date;
020    import java.sql.Timestamp;
021    import java.util.ArrayList;
022    import java.util.LinkedHashMap;
023    import java.util.List;
024    
025    import org.apache.ojb.broker.PersistenceBroker;
026    import org.apache.ojb.broker.PersistenceBrokerException;
027    import org.kuali.kfs.integration.cg.ContractAndGrantsProposal;
028    import org.kuali.kfs.module.cg.CGConstants;
029    import org.kuali.kfs.sys.KFSConstants;
030    import org.kuali.kfs.sys.context.SpringContext;
031    import org.kuali.rice.kim.bo.Person;
032    import org.kuali.rice.kns.bo.Inactivateable;
033    import org.kuali.rice.kns.bo.PersistableBusinessObjectBase;
034    import org.kuali.rice.kns.service.LookupService;
035    import org.kuali.rice.kns.util.KualiDecimal;
036    import org.kuali.rice.kns.util.ObjectUtils;
037    import org.kuali.rice.kns.util.TypedArrayList;
038    
039    /**
040     * See functional documentation.
041     */
042    public class Proposal extends PersistableBusinessObjectBase implements Inactivateable, ContractAndGrantsProposal {
043    
044        private Long proposalNumber;
045        private Date proposalBeginningDate;
046        private Date proposalEndingDate;
047    
048        /**
049         * This field is for write-only to the database via OJB, not the corresponding property of this BO. OJB uses reflection to read
050         * it, so the compiler warns because it doesn't know.
051         * 
052         * @see #getProposalTotalAmount
053         * @see #setProposalTotalAmount
054         */
055        @SuppressWarnings( { "unused" })
056        private KualiDecimal proposalTotalAmount;
057    
058        private KualiDecimal proposalDirectCostAmount;
059        private KualiDecimal proposalIndirectCostAmount;
060        private Date proposalRejectedDate;
061        private Timestamp proposalLastUpdateDate;
062        private Date proposalDueDate;
063        private KualiDecimal proposalTotalProjectAmount;
064        private Date proposalSubmissionDate;
065        private boolean proposalFederalPassThroughIndicator;
066        private String oldProposalNumber;
067        private String grantNumber;
068        private Date proposalClosingDate;
069        private String proposalAwardTypeCode;
070        private String agencyNumber;
071        private String proposalStatusCode;
072        private String federalPassThroughAgencyNumber;
073        private String cfdaNumber;
074        private String proposalFellowName;
075        private String proposalPurposeCode;
076        private String proposalProjectTitle;
077        private boolean active;
078        private List<ProposalSubcontractor> proposalSubcontractors;
079        private List<ProposalOrganization> proposalOrganizations;
080        private List<ProposalProjectDirector> proposalProjectDirectors;
081        private List<ProposalResearchRisk> proposalResearchRisks;
082    
083        private ProposalAwardType proposalAwardType;
084        private Agency agency;
085        private ProposalStatus proposalStatus;
086        private Agency federalPassThroughAgency;
087        private ProposalPurpose proposalPurpose;
088        private CFDA cfda;
089        private ProposalOrganization primaryProposalOrganization;
090        private String routingOrg;
091        private String routingChart;
092        private LookupService lookupService;
093        private Award award;
094    
095        /** Dummy value used to facilitate lookups */
096        private transient String lookupPersonUniversalIdentifier;
097        private transient Person lookupPerson;
098    
099    
100        private final String userLookupRoleNamespaceCode = KFSConstants.ParameterNamespaces.KFS;
101        private final String userLookupRoleName = KFSConstants.SysKimConstants.CONTRACTS_AND_GRANTS_PROJECT_DIRECTOR;
102        
103        /**
104         * Default constructor.
105         */
106        @SuppressWarnings( { "unchecked" })
107        public Proposal() {
108            // Must use TypedArrayList because its get() method automatically grows
109            // the array for Struts.
110            proposalSubcontractors = new TypedArrayList(ProposalSubcontractor.class);
111            proposalOrganizations = new TypedArrayList(ProposalOrganization.class);
112            proposalProjectDirectors = new TypedArrayList(ProposalProjectDirector.class);
113            proposalResearchRisks = new TypedArrayList(ProposalResearchRisk.class);
114        }
115    
116        /**
117         * Gets the award awarded to a proposal instance.
118         * 
119         * @return the award corresponding to a proposal instance if the proposal has been awarded.
120         */
121        public Award getAward() {
122            return award;
123        }
124    
125        /**
126         * Sets the award awarding a proposal instance.
127         * 
128         * @param award the award awarding a proposal instance
129         */
130        public void setAward(Award award) {
131            this.award = award;
132        }
133    
134        /**
135         * @see org.kuali.rice.kns.bo.PersistableBusinessObjectBase#buildListOfDeletionAwareLists()
136         */
137        @Override
138        public List buildListOfDeletionAwareLists() {
139            List<List> managedLists = super.buildListOfDeletionAwareLists();
140            managedLists.add(getProposalSubcontractors());
141            managedLists.add(getProposalOrganizations());
142            managedLists.add(getProposalProjectDirectors());
143            // research risks cannot be deleted (nor added)
144            return managedLists;
145        }
146    
147        /**
148         * Gets the proposalNumber attribute.
149         * 
150         * @return Returns the proposalNumber
151         */
152        public Long getProposalNumber() {
153            return proposalNumber;
154        }
155    
156        /**
157         * Sets the proposalNumber attribute.
158         * 
159         * @param proposalNumber The proposalNumber to set.
160         */
161        public void setProposalNumber(Long proposalNumber) {
162            this.proposalNumber = proposalNumber;
163        }
164    
165        /**
166         * Gets the proposalBeginningDate attribute.
167         * 
168         * @return Returns the proposalBeginningDate
169         */
170        public Date getProposalBeginningDate() {
171            return proposalBeginningDate;
172        }
173    
174        /**
175         * Sets the proposalBeginningDate attribute.
176         * 
177         * @param proposalBeginningDate The proposalBeginningDate to set.
178         */
179        public void setProposalBeginningDate(Date proposalBeginningDate) {
180            this.proposalBeginningDate = proposalBeginningDate;
181        }
182    
183        /**
184         * Gets the proposalEndingDate attribute.
185         * 
186         * @return Returns the proposalEndingDate
187         */
188        public Date getProposalEndingDate() {
189            return proposalEndingDate;
190        }
191    
192        /**
193         * Sets the proposalEndingDate attribute.
194         * 
195         * @param proposalEndingDate The proposalEndingDate to set.
196         */
197        public void setProposalEndingDate(Date proposalEndingDate) {
198            this.proposalEndingDate = proposalEndingDate;
199        }
200    
201        /**
202         * Gets the proposalTotalAmount attribute.
203         * 
204         * @return Returns the proposalTotalAmount
205         */
206        public KualiDecimal getProposalTotalAmount() {
207            KualiDecimal direct = getProposalDirectCostAmount();
208            KualiDecimal indirect = getProposalIndirectCostAmount();
209            return ObjectUtils.isNull(direct) || ObjectUtils.isNull(indirect) ? null : direct.add(indirect);
210        }
211    
212        /**
213         * Does nothing. This property is determined by the direct and indirect cost amounts. This setter is here only because without
214         * it, the maintenance framework won't display this attribute.
215         * 
216         * @param proposalTotalAmount The proposalTotalAmount to set.
217         */
218        public void setProposalTotalAmount(KualiDecimal proposalTotalAmount) {
219            // do nothing
220        }
221    
222        /**
223         * OJB calls this method as the first operation before this BO is inserted into the database. The database contains
224         * CGPRPSL_TOT_AMT, a denormalized column that Kuali does not use but needs to maintain with this method because OJB bypasses
225         * the getter.
226         * 
227         * @param persistenceBroker from OJB
228         * @throws PersistenceBrokerException
229         */
230        @Override
231        public void beforeInsert(PersistenceBroker persistenceBroker) throws PersistenceBrokerException {
232            super.beforeInsert(persistenceBroker);
233            proposalTotalAmount = getProposalTotalAmount();
234        }
235    
236        /**
237         * OJB calls this method as the first operation before this BO is updated to the database. The database contains
238         * CGPRPSL_TOT_AMT, a denormalized column that Kuali does not use but needs to maintain with this method because OJB bypasses
239         * the getter.
240         * 
241         * @param persistenceBroker from OJB
242         * @throws PersistenceBrokerException
243         */
244        @Override
245        public void beforeUpdate(PersistenceBroker persistenceBroker) throws PersistenceBrokerException {
246            super.beforeUpdate(persistenceBroker);
247            proposalTotalAmount = getProposalTotalAmount();
248        }
249    
250        /**
251         * Gets the proposalDirectCostAmount attribute.
252         * 
253         * @return Returns the proposalDirectCostAmount
254         */
255        public KualiDecimal getProposalDirectCostAmount() {
256            return proposalDirectCostAmount;
257        }
258    
259        /**
260         * Sets the proposalDirectCostAmount attribute.
261         * 
262         * @param proposalDirectCostAmount The proposalDirectCostAmount to set.
263         */
264        public void setProposalDirectCostAmount(KualiDecimal proposalDirectCostAmount) {
265            this.proposalDirectCostAmount = proposalDirectCostAmount;
266        }
267    
268        /**
269         * Gets the proposalIndirectCostAmount attribute.
270         * 
271         * @return Returns the proposalIndirectCostAmount
272         */
273        public KualiDecimal getProposalIndirectCostAmount() {
274            return proposalIndirectCostAmount;
275        }
276    
277        /**
278         * Sets the proposalIndirectCostAmount attribute.
279         * 
280         * @param proposalIndirectCostAmount The proposalIndirectCostAmount to set.
281         */
282        public void setProposalIndirectCostAmount(KualiDecimal proposalIndirectCostAmount) {
283            this.proposalIndirectCostAmount = proposalIndirectCostAmount;
284        }
285    
286        /**
287         * Gets the proposalRejectedDate attribute.
288         * 
289         * @return Returns the proposalRejectedDate
290         */
291        public Date getProposalRejectedDate() {
292            return proposalRejectedDate;
293        }
294    
295        /**
296         * Sets the proposalRejectedDate attribute.
297         * 
298         * @param proposalRejectedDate The proposalRejectedDate to set.
299         */
300        public void setProposalRejectedDate(Date proposalRejectedDate) {
301            this.proposalRejectedDate = proposalRejectedDate;
302        }
303    
304        /**
305         * Gets the proposalLastUpdateDate attribute.
306         * 
307         * @return Returns the proposalLastUpdateDate
308         */
309        public Timestamp getProposalLastUpdateDate() {
310            return proposalLastUpdateDate;
311        }
312    
313        /**
314         * Sets the proposalLastUpdateDate attribute.
315         * 
316         * @param proposalLastUpdateDate The proposalLastUpdateDate to set.
317         */
318        public void setProposalLastUpdateDate(Timestamp proposalLastUpdateDate) {
319            this.proposalLastUpdateDate = proposalLastUpdateDate;
320        }
321    
322        /**
323         * Gets the proposalDueDate attribute.
324         * 
325         * @return Returns the proposalDueDate
326         */
327        public Date getProposalDueDate() {
328            return proposalDueDate;
329        }
330    
331        /**
332         * Sets the proposalDueDate attribute.
333         * 
334         * @param proposalDueDate The proposalDueDate to set.
335         */
336        public void setProposalDueDate(Date proposalDueDate) {
337            this.proposalDueDate = proposalDueDate;
338        }
339    
340        /**
341         * Gets the proposalTotalProjectAmount attribute.
342         * 
343         * @return Returns the proposalTotalProjectAmount
344         */
345        public KualiDecimal getProposalTotalProjectAmount() {
346            return proposalTotalProjectAmount;
347        }
348    
349        /**
350         * Sets the proposalTotalProjectAmount attribute.
351         * 
352         * @param proposalTotalProjectAmount The proposalTotalProjectAmount to set.
353         */
354        public void setProposalTotalProjectAmount(KualiDecimal proposalTotalProjectAmount) {
355            this.proposalTotalProjectAmount = proposalTotalProjectAmount;
356        }
357    
358        /**
359         * Gets the proposalSubmissionDate attribute.
360         * 
361         * @return Returns the proposalSubmissionDate
362         */
363        public Date getProposalSubmissionDate() {
364            return proposalSubmissionDate;
365        }
366    
367        /**
368         * Sets the proposalSubmissionDate attribute.
369         * 
370         * @param proposalSubmissionDate The proposalSubmissionDate to set.
371         */
372        public void setProposalSubmissionDate(Date proposalSubmissionDate) {
373            this.proposalSubmissionDate = proposalSubmissionDate;
374        }
375    
376        /**
377         * Gets the proposalFederalPassThroughIndicator attribute.
378         * 
379         * @return Returns the proposalFederalPassThroughIndicator
380         */
381        public boolean getProposalFederalPassThroughIndicator() {
382            return proposalFederalPassThroughIndicator;
383        }
384    
385        /**
386         * Sets the proposalFederalPassThroughIndicator attribute.
387         * 
388         * @param proposalFederalPassThroughIndicator The proposalFederalPassThroughIndicator to set.
389         */
390        public void setProposalFederalPassThroughIndicator(boolean proposalFederalPassThroughIndicator) {
391            this.proposalFederalPassThroughIndicator = proposalFederalPassThroughIndicator;
392        }
393    
394        /**
395         * Gets the oldProposalNumber attribute.
396         * 
397         * @return Returns the oldProposalNumber
398         */
399        public String getOldProposalNumber() {
400            return oldProposalNumber;
401        }
402    
403        /**
404         * Sets the oldProposalNumber attribute.
405         * 
406         * @param oldProposalNumber The oldProposalNumber to set.
407         */
408        public void setOldProposalNumber(String oldProposalNumber) {
409            this.oldProposalNumber = oldProposalNumber;
410        }
411    
412        /**
413         * Gets the grantNumber attribute.
414         * 
415         * @return Returns the grantNumber
416         */
417        public String getGrantNumber() {
418            return grantNumber;
419        }
420    
421        /**
422         * Sets the grantNumber attribute.
423         * 
424         * @param grantNumber The grantNumber to set.
425         */
426        public void setGrantNumber(String grantNumber) {
427            this.grantNumber = grantNumber;
428        }
429    
430        /**
431         * Gets the proposalClosingDate attribute.
432         * 
433         * @return Returns the proposalClosingDate
434         */
435        public Date getProposalClosingDate() {
436            return proposalClosingDate;
437        }
438    
439        /**
440         * Sets the proposalClosingDate attribute.
441         * 
442         * @param proposalClosingDate The proposalClosingDate to set.
443         */
444        public void setProposalClosingDate(Date proposalClosingDate) {
445            this.proposalClosingDate = proposalClosingDate;
446        }
447    
448        /**
449         * Gets the proposalAwardTypeCode attribute.
450         * 
451         * @return Returns the proposalAwardTypeCode
452         */
453        public String getProposalAwardTypeCode() {
454            return proposalAwardTypeCode;
455        }
456    
457        /**
458         * Sets the proposalAwardTypeCode attribute.
459         * 
460         * @param proposalAwardTypeCode The proposalAwardTypeCode to set.
461         */
462        public void setProposalAwardTypeCode(String proposalAwardTypeCode) {
463            this.proposalAwardTypeCode = proposalAwardTypeCode;
464        }
465    
466        /**
467         * Gets the agencyNumber attribute.
468         * 
469         * @return Returns the agencyNumber
470         */
471        public String getAgencyNumber() {
472            return agencyNumber;
473        }
474    
475        /**
476         * Sets the agencyNumber attribute.
477         * 
478         * @param agencyNumber The agencyNumber to set.
479         */
480        public void setAgencyNumber(String agencyNumber) {
481            this.agencyNumber = agencyNumber;
482        }
483    
484        /**
485         * Gets the proposalStatusCode attribute.
486         * 
487         * @return Returns the proposalStatusCode
488         */
489        public String getProposalStatusCode() {
490            return proposalStatusCode;
491        }
492    
493        /**
494         * Sets the proposalStatusCode attribute.
495         * 
496         * @param proposalStatusCode The proposalStatusCode to set.
497         */
498        public void setProposalStatusCode(String proposalStatusCode) {
499            this.proposalStatusCode = proposalStatusCode;
500        }
501    
502        /**
503         * Gets the federalPassThroughAgencyNumber attribute.
504         * 
505         * @return Returns the federalPassThroughAgencyNumber
506         */
507        public String getFederalPassThroughAgencyNumber() {
508            return federalPassThroughAgencyNumber;
509        }
510    
511        /**
512         * Sets the federalPassThroughAgencyNumber attribute.
513         * 
514         * @param federalPassThroughAgencyNumber The federalPassThroughAgencyNumber to set.
515         */
516        public void setFederalPassThroughAgencyNumber(String federalPassThroughAgencyNumber) {
517            this.federalPassThroughAgencyNumber = federalPassThroughAgencyNumber;
518        }
519    
520        /**
521         * Gets the cfdaNumber attribute.
522         * 
523         * @return Returns the cfdaNumber
524         */
525        public String getCfdaNumber() {
526            return cfdaNumber;
527        }
528    
529        /**
530         * Sets the cfdaNumber attribute.
531         * 
532         * @param cfdaNumber The cfdaNumber to set.
533         */
534        public void setCfdaNumber(String cfdaNumber) {
535            this.cfdaNumber = cfdaNumber;
536        }
537    
538        /**
539         * Gets the proposalFellowName attribute.
540         * 
541         * @return Returns the proposalFellowName
542         */
543        public String getProposalFellowName() {
544            return proposalFellowName;
545        }
546    
547        /**
548         * Sets the proposalFellowName attribute.
549         * 
550         * @param proposalFellowName The proposalFellowName to set.
551         */
552        public void setProposalFellowName(String proposalFellowName) {
553            this.proposalFellowName = proposalFellowName;
554        }
555    
556        /**
557         * Gets the proposalPurposeCode attribute.
558         * 
559         * @return Returns the proposalPurposeCode
560         */
561        public String getProposalPurposeCode() {
562            return proposalPurposeCode;
563        }
564    
565        /**
566         * Sets the proposalPurposeCode attribute.
567         * 
568         * @param proposalPurposeCode The proposalPurposeCode to set.
569         */
570        public void setProposalPurposeCode(String proposalPurposeCode) {
571            this.proposalPurposeCode = proposalPurposeCode;
572        }
573    
574        /**
575         * Gets the proposalProjectTitle attribute.
576         * 
577         * @return Returns the proposalProjectTitle
578         */
579        public String getProposalProjectTitle() {
580            return proposalProjectTitle;
581        }
582    
583        /**
584         * Sets the proposalProjectTitle attribute.
585         * 
586         * @param proposalProjectTitle The proposalProjectTitle to set.
587         */
588        public void setProposalProjectTitle(String proposalProjectTitle) {
589            this.proposalProjectTitle = proposalProjectTitle;
590        }
591    
592        /**
593         * Gets the active attribute.
594         * 
595         * @return Returns the active.
596         */
597        public boolean isActive() {
598            return active;
599        }
600    
601        /**
602         * Sets the active attribute value.
603         * 
604         * @param active The active to set.
605         */
606        public void setActive(boolean active) {
607            this.active = active;
608        }
609    
610        /**
611         * Gets the {@link ProposalAwardType} attribute.
612         * 
613         * @return Returns the {@link ProposalAwardType}
614         */
615        public ProposalAwardType getProposalAwardType() {
616            return proposalAwardType;
617        }
618    
619        /**
620         * Sets the {@link ProposalAwardType} attribute.
621         * 
622         * @param proposalAwardType The {@link ProposalAwardType} to set.
623         * @deprecated
624         */
625        public void setProposalAwardType(ProposalAwardType proposalAwardType) {
626            this.proposalAwardType = proposalAwardType;
627        }
628    
629        /**
630         * Gets the {@link Agency} attribute.
631         * 
632         * @return Returns the {@link Agency}
633         */
634        public Agency getAgency() {
635            return agency;
636        }
637    
638        /**
639         * Sets the {@link Agency} attribute.
640         * 
641         * @param agency The {@link Agency} to set.
642         * @deprecated
643         */
644        public void setAgency(Agency agency) {
645            this.agency = agency;
646        }
647    
648        /**
649         * Gets the {@link ProposalStatus} attribute.
650         * 
651         * @return Returns the {@link ProposalStatus}
652         */
653        public ProposalStatus getProposalStatus() {
654            return proposalStatus;
655        }
656    
657        /**
658         * Sets the {@link ProposalStatus} attribute.
659         * 
660         * @param proposalStatus The {@link ProposalStatus} to set.
661         * @deprecated
662         */
663        public void setProposalStatus(ProposalStatus proposalStatus) {
664            this.proposalStatus = proposalStatus;
665        }
666    
667        /**
668         * Gets the federalPassThroughAgency attribute.
669         * 
670         * @return Returns the federalPassThroughAgency
671         */
672        public Agency getFederalPassThroughAgency() {
673            return federalPassThroughAgency;
674        }
675    
676        /**
677         * Sets the federalPassThrough {@link Agency} attribute.
678         * 
679         * @param federalPassThroughAgency The federalPassThrough {@link Agency} to set.
680         * @deprecated
681         */
682        public void setFederalPassThroughAgency(Agency federalPassThroughAgency) {
683            this.federalPassThroughAgency = federalPassThroughAgency;
684        }
685    
686        /**
687         * Gets the {@link ProposalPurpose} attribute.
688         * 
689         * @return Returns the proposalPurpose
690         */
691        public ProposalPurpose getProposalPurpose() {
692            return proposalPurpose;
693        }
694    
695        /**
696         * Sets the {@link ProposalPurpose} attribute.
697         * 
698         * @param proposalPurpose The {@link ProposalPurpose} to set.
699         * @deprecated
700         */
701        public void setProposalPurpose(ProposalPurpose proposalPurpose) {
702            this.proposalPurpose = proposalPurpose;
703        }
704    
705        /**
706         * Gets the {@link CFDA} attribute.
707         * 
708         * @return Returns the {@link CFDA}
709         */
710        public CFDA getCfda() {
711            return cfda;
712        }
713    
714        /**
715         * Sets the {@link CFDA} attribute.
716         * 
717         * @param cfda The {@link CFDA} to set.
718         * @deprecated
719         */
720        public void setCfda(CFDA cfda) {
721            this.cfda = cfda;
722        }
723    
724        /**
725         * Gets the {@link List} of {@link ProposalSubcontractor}s associated with a {@link Proposal} instance.
726         * 
727         * @return Returns the proposalSubcontractors list
728         */
729        public List<ProposalSubcontractor> getProposalSubcontractors() {
730            return proposalSubcontractors;
731        }
732    
733        /**
734         * Sets the {@link ProposalSubcontractor}s {@link List}.
735         * 
736         * @param proposalSubcontractors The {@link ProposalSubcontractor}s {@link List} to set.
737         */
738        public void setProposalSubcontractors(List<ProposalSubcontractor> proposalSubcontractors) {
739            this.proposalSubcontractors = proposalSubcontractors;
740        }
741    
742        /**
743         * Gets the {@link List} of {@link ProposalOrganization}s associated with a {@link Proposal} instance.
744         * 
745         * @return Returns the {@link ProposalOrganization}s.
746         */
747        public List<ProposalOrganization> getProposalOrganizations() {
748            return proposalOrganizations;
749        }
750    
751        /**
752         * @param proposalOrganizations The proposalOrganizations to set.
753         */
754        public void setProposalOrganizations(List<ProposalOrganization> proposalOrganizations) {
755            this.proposalOrganizations = proposalOrganizations;
756        }
757    
758        /**
759         * @return Returns the proposalProjectDirectors.
760         */
761        public List<ProposalProjectDirector> getProposalProjectDirectors() {
762            return proposalProjectDirectors;
763        }
764    
765        /**
766         * @param proposalProjectDirectors The proposalProjectDirectors to set.
767         */
768        public void setProposalProjectDirectors(List<ProposalProjectDirector> proposalProjectDirectors) {
769            this.proposalProjectDirectors = proposalProjectDirectors;
770        }
771    
772        /**
773         * @return Returns the proposalResearchRisks.
774         */
775        public List<ProposalResearchRisk> getProposalResearchRisks() {
776            return proposalResearchRisks;
777        }
778    
779        /**
780         * @return Returns the active proposalResearchRisks.
781         */
782        public List<ProposalResearchRisk> getActiveProposalResearchRisks() {
783            List<ProposalResearchRisk> activeRisks = new ArrayList<ProposalResearchRisk>();
784            for (ProposalResearchRisk risk : proposalResearchRisks) {
785                if (risk.isActive())
786                    activeRisks.add(risk);
787            }
788            return activeRisks;
789        }
790    
791    
792        /**
793         * @param proposalResearchRisks The proposalResearchRisks to set.
794         */
795        public void setProposalResearchRisks(List<ProposalResearchRisk> proposalResearchRisks) {
796            this.proposalResearchRisks = proposalResearchRisks;
797        }
798    
799        /**
800         * @see org.kuali.rice.kns.bo.BusinessObjectBase#toStringMapper()
801         */
802        protected LinkedHashMap toStringMapper() {
803            LinkedHashMap<String, String> m = new LinkedHashMap<String, String>();
804            if (this.proposalNumber != null) {
805                m.put("proposalNumber", this.proposalNumber.toString());
806            }
807            return m;
808        }
809    
810        /**
811         * Gets the lookup {@link Person}.
812         * 
813         * @return the lookup {@link Person}
814         */
815        public Person getLookupPerson() {
816            return lookupPerson;
817        }
818    
819        /**
820         * Sets the lookup {@link Person}
821         * 
822         * @param lookupPerson
823         */
824        public void setLookupPerson(Person lookupPerson) {
825            this.lookupPerson = lookupPerson;
826        }
827    
828        /**
829         * Gets the universal user id of the lookup person.
830         * 
831         * @return the id of the lookup person
832         */
833        public String getLookupPersonUniversalIdentifier() {
834            lookupPerson = SpringContext.getBean(org.kuali.rice.kim.service.PersonService.class).updatePersonIfNecessary(lookupPersonUniversalIdentifier, lookupPerson); 
835            return lookupPersonUniversalIdentifier;
836        }
837    
838        /**
839         * Sets the universal user id of the lookup person
840         * 
841         * @param lookupPersonId the id of the lookup person
842         */
843        public void setLookupPersonUniversalIdentifier(String lookupPersonId) {
844            this.lookupPersonUniversalIdentifier = lookupPersonId;
845        }
846    
847        /**
848         * I added this getter to the BO to resolve KULCG-300. I'm not sure if this is actually needed by the code, but the framework
849         * breaks all lookups on the proposal maintenance doc without this getter.
850         * 
851         * @return the {@link LookupService} used by the instance.
852         */
853        public LookupService getLookupService() {
854            return lookupService;
855        }
856    
857    
858        /**
859         * Gets the id of the routing {@link Chart}
860         * 
861         * @return the id of the routing {@link Chart}
862         */
863        public String getRoutingChart() {
864            return routingChart;
865        }
866    
867        /**
868         * Sets the id of the routing {@link Chart}.
869         * 
870         * @return the id of the routing {@link Chart}.
871         */
872        public void setRoutingChart(String routingChart) {
873            this.routingChart = routingChart;
874        }
875    
876        /**
877         * Gets the id of the routing {@link Org}.
878         * 
879         * @return the id of the routing {@link Org}
880         */
881        public String getRoutingOrg() {
882            return routingOrg;
883        }
884    
885        /**
886         * Sets the id of the routing {@link Org}.
887         * 
888         * @param the id of the routing {@link Org}
889         */
890        public void setRoutingOrg(String routingOrg) {
891            this.routingOrg = routingOrg;
892        }
893    
894        /**
895         * Gets the primary {@link ProposalOrganization} for a proposal.
896         * 
897         * @return the primary {@link ProposalOrganization} for a proposal
898         */
899        public ProposalOrganization getPrimaryProposalOrganization() {
900            for (ProposalOrganization po : proposalOrganizations) {
901                if (po != null && po.isProposalPrimaryOrganizationIndicator()) {
902                    setPrimaryProposalOrganization(po);
903                    break;
904                }
905            }
906    
907            return primaryProposalOrganization;
908        }
909    
910        /**
911         * Sets the {@link LookupService}. For Spring compatibility.
912         * 
913         * @param lookupService
914         */
915        public void setLookupService(LookupService lookupService) {
916            this.lookupService = lookupService;
917        }
918    
919        /**
920         * Sets the primary {@link ProposalOrganization} for a proposal
921         * 
922         * @param primaryProposalOrganization
923         */
924        public void setPrimaryProposalOrganization(ProposalOrganization primaryProposalOrganization) {
925            this.primaryProposalOrganization = primaryProposalOrganization;
926            this.routingChart = primaryProposalOrganization.getChartOfAccountsCode();
927            this.routingOrg = primaryProposalOrganization.getOrganizationCode();
928        }
929    
930    
931        public String getUserLookupRoleNamespaceCode() {
932            return userLookupRoleNamespaceCode;
933        }
934    
935        public void setUserLookupRoleNamespaceCode(String userLookupRoleNamespaceCode) {
936        }
937    
938        public String getUserLookupRoleName() {
939            return userLookupRoleName;
940        }
941    
942        public void setUserLookupRoleName(String userLookupRoleName) {
943        }
944    }
945