1
2
3
4
5
6
7
8
9
10
11
12
13
14
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 import org.kuali.rice.krad.util.ObjectUtils;
27
28
29
30
31 public class ProposalProjectDirector extends PersistableBusinessObjectBase implements Primaryable, CGProjectDirector, MutableInactivatable {
32
33 private String principalId;
34 private Long proposalNumber;
35 private boolean proposalPrimaryProjectDirectorIndicator;
36 private String proposalProjectDirectorProjectTitle;
37 private boolean active = true;
38
39 private Person projectDirector;
40
41
42 private final String userLookupRoleNamespaceCode = OLEConstants.ParameterNamespaces.OLE;
43 private final String userLookupRoleName = OLEConstants.SysKimApiConstants.CONTRACTS_AND_GRANTS_PROJECT_DIRECTOR;
44
45
46
47
48 public ProposalProjectDirector() {
49 }
50
51
52
53
54 @Override
55 public String getPrincipalId() {
56 return principalId;
57 }
58
59
60
61
62 @Override
63 public void setPrincipalId(String principalId) {
64 this.principalId = principalId;
65 }
66
67
68
69
70 @Override
71 public Long getProposalNumber() {
72 return proposalNumber;
73 }
74
75
76
77
78 @Override
79 public void setProposalNumber(Long proposalNumber) {
80 this.proposalNumber = proposalNumber;
81 }
82
83
84
85
86
87
88
89 public boolean isProposalPrimaryProjectDirectorIndicator() {
90 return proposalPrimaryProjectDirectorIndicator;
91 }
92
93
94
95
96 @Override
97 public boolean isPrimary() {
98 return isProposalPrimaryProjectDirectorIndicator();
99 }
100
101
102
103
104
105
106 public void setProposalPrimaryProjectDirectorIndicator(boolean proposalPrimaryProjectDirectorIndicator) {
107 this.proposalPrimaryProjectDirectorIndicator = proposalPrimaryProjectDirectorIndicator;
108 }
109
110
111
112
113
114
115
116 public String getProposalProjectDirectorProjectTitle() {
117 return proposalProjectDirectorProjectTitle;
118 }
119
120
121
122
123
124
125 public void setProposalProjectDirectorProjectTitle(String proposalProjectDirectorProjectTitle) {
126 this.proposalProjectDirectorProjectTitle = proposalProjectDirectorProjectTitle;
127 }
128
129
130
131
132
133
134 @Override
135 public boolean isActive() {
136 return active;
137 }
138
139
140
141
142
143
144 @Override
145 public void setActive(boolean active) {
146 this.active = active;
147 }
148
149
150
151
152 @Override
153 public Person getProjectDirector() {
154 if (principalId != null) {
155 projectDirector = SpringContext.getBean(org.kuali.rice.kim.api.identity.PersonService.class).updatePersonIfNecessary(principalId, projectDirector);
156 }
157 return projectDirector;
158 }
159
160
161
162
163 @Override
164 public void setProjectDirector(Person projectDirector) {
165 this.projectDirector = projectDirector;
166 }
167
168
169
170
171 protected LinkedHashMap toStringMapper_RICE20_REFACTORME() {
172 LinkedHashMap m = new LinkedHashMap();
173 m.put("principalId", this.principalId);
174 if (this.proposalNumber != null) {
175 m.put("proposalNumber", this.proposalNumber.toString());
176 }
177 return m;
178 }
179
180
181
182
183
184
185 @Override
186 public String toString() {
187
188 String name = ObjectUtils.isNull(getProjectDirector()) ? "nonexistent" : getProjectDirector().getName();
189 String title = getProposalProjectDirectorProjectTitle() == null ? "" : " " + getProposalProjectDirectorProjectTitle();
190 return name + " " + (isProposalPrimaryProjectDirectorIndicator() ? "primary" : "secondary") + title;
191 }
192
193
194
195
196
197 public String getUserLookupRoleNamespaceCode() {
198 return userLookupRoleNamespaceCode;
199 }
200
201
202
203
204
205 public String getUserLookupRoleName() {
206 return userLookupRoleName;
207 }
208 }
209