1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kim.web.struts.form;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.kim.bo.ui.PersonDocumentAddress;
20 import org.kuali.rice.kim.bo.ui.PersonDocumentAffiliation;
21 import org.kuali.rice.kim.bo.ui.PersonDocumentCitizenship;
22 import org.kuali.rice.kim.bo.ui.PersonDocumentEmail;
23 import org.kuali.rice.kim.bo.ui.PersonDocumentEmploymentInfo;
24 import org.kuali.rice.kim.bo.ui.PersonDocumentGroup;
25 import org.kuali.rice.kim.bo.ui.PersonDocumentName;
26 import org.kuali.rice.kim.bo.ui.PersonDocumentPhone;
27 import org.kuali.rice.kim.bo.ui.PersonDocumentRole;
28 import org.kuali.rice.kim.bo.ui.RoleDocumentDelegationMember;
29 import org.kuali.rice.kim.document.IdentityManagementPersonDocument;
30 import org.kuali.rice.kns.util.GlobalVariables;
31 import org.kuali.rice.kns.web.format.DateDisplayTimestampObjectFormatter;
32
33
34
35
36
37
38
39 public class IdentityManagementPersonDocumentForm extends IdentityManagementDocumentFormBase {
40
41 {
42 requiredNonEditableProperties.add("methodToCall");
43 }
44
45 protected static final long serialVersionUID = -4787045391777666988L;
46 protected String principalId;
47 protected PersonDocumentAffiliation newAffln;
48 protected PersonDocumentEmploymentInfo newEmpInfo;
49 protected PersonDocumentCitizenship newCitizenship;
50 protected PersonDocumentName newName;
51 protected PersonDocumentAddress newAddress;
52 protected PersonDocumentPhone newPhone;
53 protected PersonDocumentEmail newEmail;
54 protected PersonDocumentGroup newGroup;
55 protected PersonDocumentRole newRole;
56 protected RoleDocumentDelegationMember newDelegationMember = new RoleDocumentDelegationMember();
57 protected String newDelegationMemberRoleId = null;
58 protected boolean delegationMemberLookup = false;
59 protected boolean canModifyEntity = false;
60 protected boolean canOverrideEntityPrivacyPreferences = false;
61 protected boolean userSameAsPersonEdited = false;
62
63
64
65
66 public boolean isCanModifyEntity() {
67 return this.canModifyEntity;
68 }
69
70
71
72
73 public void setCanModifyEntity(boolean canModifyEntity) {
74 this.canModifyEntity = canModifyEntity;
75 }
76
77 public IdentityManagementPersonDocumentForm() {
78 super();
79
80 this.setNewAffln(new PersonDocumentAffiliation());
81 this.setNewAddress(new PersonDocumentAddress());
82 this.setNewEmpInfo(new PersonDocumentEmploymentInfo());
83 this.setNewName(new PersonDocumentName());
84 this.setNewPhone(new PersonDocumentPhone());
85 this.setNewEmail(new PersonDocumentEmail());
86 this.setNewDelegationMember(new RoleDocumentDelegationMember());
87 setFormatterType("document.groups.activeFromDate", DateDisplayTimestampObjectFormatter.class);
88 setFormatterType("document.groups.activeToDate", DateDisplayTimestampObjectFormatter.class);
89 }
90
91 @Override
92 public String getDefaultDocumentTypeName(){
93 return "IdentityManagementPersonDocument";
94 }
95
96 public IdentityManagementPersonDocument getPersonDocument() {
97 return (IdentityManagementPersonDocument) this.getDocument();
98 }
99
100 public PersonDocumentAffiliation getNewAffln() {
101 return this.newAffln;
102 }
103
104 public void setNewAffln(PersonDocumentAffiliation newAffln) {
105 this.newAffln = newAffln;
106 }
107
108 public PersonDocumentEmploymentInfo getNewEmpInfo() {
109 return this.newEmpInfo;
110 }
111
112 public void setNewEmpInfo(PersonDocumentEmploymentInfo newEmpInfo) {
113 this.newEmpInfo = newEmpInfo;
114 }
115
116 public PersonDocumentCitizenship getNewCitizenship() {
117 return this.newCitizenship;
118 }
119
120 public void setNewCitizenship(PersonDocumentCitizenship newCitizenship) {
121 this.newCitizenship = newCitizenship;
122 }
123
124 public PersonDocumentName getNewName() {
125 return this.newName;
126 }
127
128 public void setNewName(PersonDocumentName newName) {
129 this.newName = newName;
130 }
131
132 public PersonDocumentAddress getNewAddress() {
133 return this.newAddress;
134 }
135
136 public void setNewAddress(PersonDocumentAddress newAddress) {
137 this.newAddress = newAddress;
138 }
139
140 public PersonDocumentPhone getNewPhone() {
141 return this.newPhone;
142 }
143
144 public void setNewPhone(PersonDocumentPhone newPhone) {
145 this.newPhone = newPhone;
146 }
147
148 public PersonDocumentEmail getNewEmail() {
149 return this.newEmail;
150 }
151
152 public void setNewEmail(PersonDocumentEmail newEmail) {
153 this.newEmail = newEmail;
154 }
155
156 public PersonDocumentGroup getNewGroup() {
157 return this.newGroup;
158 }
159
160 public void setNewGroup(PersonDocumentGroup newGroup) {
161 this.newGroup = newGroup;
162 }
163
164 public PersonDocumentRole getNewRole() {
165 return this.newRole;
166 }
167
168 public void setNewRole(PersonDocumentRole newRole) {
169 this.newRole = newRole;
170 }
171
172 public String getPrincipalId() {
173 return this.principalId;
174 }
175
176 public void setPrincipalId(String principalId) {
177 this.principalId = principalId;
178 }
179
180
181
182
183 public RoleDocumentDelegationMember getNewDelegationMember() {
184 return this.newDelegationMember;
185 }
186
187
188
189
190 public void setNewDelegationMember(
191 RoleDocumentDelegationMember newDelegationMember) {
192 this.newDelegationMember = newDelegationMember;
193 }
194
195
196
197
198 public boolean isDelegationMemberLookup() {
199 return this.delegationMemberLookup;
200 }
201
202
203
204
205 public void setDelegationMemberLookup(boolean delegationMemberLookup) {
206 this.delegationMemberLookup = delegationMemberLookup;
207 }
208
209
210
211
212 public String getNewDelegationMemberRoleId() {
213 return this.newDelegationMemberRoleId;
214 }
215
216
217
218
219 public void setNewDelegationMemberRoleId(String newDelegationMemberRoleId) {
220 this.newDelegationMemberRoleId = newDelegationMemberRoleId;
221 if(StringUtils.isNotEmpty(newDelegationMemberRoleId)){
222 newDelegationMember.getRoleImpl().setRoleId(newDelegationMemberRoleId);
223 }
224 }
225
226
227
228
229 public boolean isCanOverrideEntityPrivacyPreferences() {
230 return this.canOverrideEntityPrivacyPreferences || isUserSameAsPersonEdited();
231 }
232
233
234
235
236 public void setCanOverrideEntityPrivacyPreferences(
237 boolean canOverrideEntityPrivacyPreferences) {
238 this.canOverrideEntityPrivacyPreferences = canOverrideEntityPrivacyPreferences;
239 }
240
241
242
243
244 public boolean isUserSameAsPersonEdited() {
245 if(StringUtils.isNotEmpty(getPrincipalId())){
246 userSameAsPersonEdited = StringUtils.equals(GlobalVariables.getUserSession().getPrincipalId(), getPrincipalId());
247 }
248 return this.userSameAsPersonEdited;
249 }
250
251
252
253
254 public void setUserSameAsPersonEdited(boolean userSameAsPersonEdited) {
255 this.userSameAsPersonEdited = userSameAsPersonEdited;
256 }
257
258 }