View Javadoc
1   /*
2    * Copyright 2006 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.kuali.ole.module.cg.businessobject;
18  
19  import java.util.LinkedHashMap;
20  
21  import org.kuali.ole.sys.OLEConstants;
22  import org.kuali.ole.sys.context.SpringContext;
23  import org.kuali.rice.core.api.mo.common.active.MutableInactivatable;
24  import org.kuali.rice.kim.api.identity.Person;
25  import org.kuali.rice.krad.bo.PersistableBusinessObjectBase;
26  
27  /**
28   * This class represents an association between an award and a project director. It's like a reference to the project director from
29   * the award. This way an award can maintain a collection of these references instead of owning project directors directly.
30   */
31  public class AwardProjectDirector extends PersistableBusinessObjectBase implements Primaryable, CGProjectDirector, MutableInactivatable {
32  
33      private String principalId;
34      private Long proposalNumber;
35      private boolean awardPrimaryProjectDirectorIndicator;
36      private String awardProjectDirectorProjectTitle;
37      private boolean active = true;
38  
39      private Person projectDirector;
40  
41      private final String userLookupRoleNamespaceCode = OLEConstants.ParameterNamespaces.OLE;
42      private final String userLookupRoleName = OLEConstants.SysKimApiConstants.CONTRACTS_AND_GRANTS_PROJECT_DIRECTOR;
43  
44      /**
45       * Default no-args constructor.
46       */
47      public AwardProjectDirector() {
48      }
49  
50      /**
51       * @see org.kuali.ole.module.cg.businessobject.CGProjectDirector#getPrincipalId()
52       */
53      @Override
54      public String getPrincipalId() {
55          return principalId;
56      }
57  
58      /**
59       * @see org.kuali.ole.module.cg.businessobject.CGProjectDirector#setPrincipalId(java.lang.String)
60       */
61      @Override
62      public void setPrincipalId(String principalId) {
63          this.principalId = principalId;
64      }
65  
66  
67      /**
68       * @see org.kuali.ole.module.cg.businessobject.CGProjectDirector#getProposalNumber()
69       */
70      @Override
71      public Long getProposalNumber() {
72          return proposalNumber;
73      }
74  
75      /**
76       * @see org.kuali.ole.module.cg.businessobject.CGProjectDirector#setProposalNumber(java.lang.Long)
77       */
78      @Override
79      public void setProposalNumber(Long proposalNumber) {
80          this.proposalNumber = proposalNumber;
81      }
82  
83  
84      /**
85       * Gets the awardPrimaryProjectDirectorIndicator attribute.
86       *
87       * @return Returns the awardPrimaryProjectDirectorIndicator
88       */
89      public boolean isAwardPrimaryProjectDirectorIndicator() {
90          return awardPrimaryProjectDirectorIndicator;
91      }
92  
93  
94      /**
95       * Sets the awardPrimaryProjectDirectorIndicator attribute.
96       *
97       * @param awardPrimaryProjectDirectorIndicator The awardPrimaryProjectDirectorIndicator to set.
98       */
99      public void setAwardPrimaryProjectDirectorIndicator(boolean awardPrimaryProjectDirectorIndicator) {
100         this.awardPrimaryProjectDirectorIndicator = awardPrimaryProjectDirectorIndicator;
101     }
102 
103 
104     /**
105      * Gets the awardProjectDirectorProjectTitle attribute.
106      *
107      * @return Returns the awardProjectDirectorProjectTitle
108      */
109     public String getAwardProjectDirectorProjectTitle() {
110         return awardProjectDirectorProjectTitle;
111     }
112 
113     /**
114      * Sets the awardProjectDirectorProjectTitle attribute.
115      *
116      * @param awardProjectDirectorProjectTitle The awardProjectDirectorProjectTitle to set.
117      */
118     public void setAwardProjectDirectorProjectTitle(String awardProjectDirectorProjectTitle) {
119         this.awardProjectDirectorProjectTitle = awardProjectDirectorProjectTitle;
120     }
121 
122     /**
123      * @see org.kuali.ole.module.cg.businessobject.CGProjectDirector#getProjectDirector()
124      */
125     @Override
126     public Person getProjectDirector() {
127         projectDirector = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(principalId, projectDirector);
128         return projectDirector;
129     }
130 
131     /**
132      * @see org.kuali.ole.module.cg.businessobject.CGProjectDirector#setProjectDirector(org.kuali.ole.module.cg.businessobject.ProjectDirector)
133      */
134     @Override
135     public void setProjectDirector(Person projectDirector) {
136         this.projectDirector = projectDirector;
137     }
138 
139     /**
140      * @see Primaryable#isPrimary()
141      */
142     @Override
143     public boolean isPrimary() {
144         return isAwardPrimaryProjectDirectorIndicator();
145     }
146 
147     /**
148      * @see org.kuali.rice.core.api.mo.common.active.MutableInactivatable#isActive()
149      */
150     @Override
151     public boolean isActive() {
152         return active;
153     }
154 
155     /**
156      * @see org.kuali.rice.core.api.mo.common.active.MutableInactivatable#setActive(boolean)
157      */
158     @Override
159     public void setActive(boolean active) {
160         this.active = active;
161     }
162 
163     public String getUserLookupRoleNamespaceCode() {
164         return userLookupRoleNamespaceCode;
165     }
166 
167     public void setUserLookupRoleNamespaceCode(String userLookupRoleNamespaceCode) {
168     }
169 
170     public String getUserLookupRoleName() {
171         return userLookupRoleName;
172     }
173 
174     public void setUserLookupRoleName(String userLookupRoleName) {
175     }
176 
177     /**
178      * @see org.kuali.rice.krad.bo.BusinessObjectBase#toStringMapper()
179      */
180     @SuppressWarnings("unchecked")
181 
182     protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
183         LinkedHashMap m = new LinkedHashMap();
184         m.put("principalId", this.principalId);
185         if (this.proposalNumber != null) {
186             m.put("proposalNumber", this.proposalNumber.toString());
187         }
188         return m;
189     }
190 
191 }
192