1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.rice.kim.document; |
17 |
|
|
18 |
|
import org.apache.commons.lang.StringUtils; |
19 |
|
import org.kuali.rice.kew.dto.DocumentRouteStatusChangeDTO; |
20 |
|
import org.kuali.rice.kim.bo.types.dto.KimTypeInfo; |
21 |
|
import org.kuali.rice.kim.bo.ui.*; |
22 |
|
import org.kuali.rice.kim.service.KIMServiceLocator; |
23 |
|
import org.kuali.rice.kim.service.KIMServiceLocatorInternal; |
24 |
|
import org.kuali.rice.kim.service.KIMServiceLocatorWeb; |
25 |
|
import org.kuali.rice.kim.service.ResponsibilityService; |
26 |
|
import org.kuali.rice.kim.util.KimConstants; |
27 |
|
import org.kuali.rice.kim.web.struts.form.IdentityManagementRoleDocumentForm; |
28 |
|
import org.kuali.rice.kns.datadictionary.AttributeDefinition; |
29 |
|
import org.kuali.rice.kns.datadictionary.KimDataDictionaryAttributeDefinition; |
30 |
|
import org.kuali.rice.kns.datadictionary.KimNonDataDictionaryAttributeDefinition; |
31 |
|
import org.kuali.rice.kns.service.SequenceAccessorService; |
32 |
|
import org.springframework.util.AutoPopulatingList; |
33 |
|
|
34 |
|
import java.util.ArrayList; |
35 |
|
import java.util.Comparator; |
36 |
|
import java.util.List; |
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
@author |
43 |
|
|
44 |
|
|
|
|
| 0% |
Uncovered Elements: 299 (299) |
Complexity: 84 |
Complexity Density: 0.45 |
|
45 |
|
public class IdentityManagementRoleDocument extends IdentityManagementTypeAttributeTransactionalDocument { |
46 |
|
|
47 |
|
private static final long serialVersionUID = 1L; |
48 |
|
|
49 |
|
protected String roleId; |
50 |
|
protected String roleTypeId; |
51 |
|
protected String roleTypeName; |
52 |
|
protected String roleNamespace = ""; |
53 |
|
protected String roleName = ""; |
54 |
|
protected String roleDescription = ""; |
55 |
|
|
56 |
|
protected boolean active = true; |
57 |
|
|
58 |
|
protected boolean editing; |
59 |
|
|
60 |
|
protected List<KimDocumentRolePermission> permissions = new AutoPopulatingList(KimDocumentRolePermission.class); |
61 |
|
protected List<KimDocumentRoleResponsibility> responsibilities = new AutoPopulatingList(KimDocumentRoleResponsibility.class); |
62 |
|
protected List<KimDocumentRoleMember> members = new AutoPopulatingList(KimDocumentRoleMember.class); |
63 |
|
private List<RoleDocumentDelegationMember> delegationMembers = new AutoPopulatingList(RoleDocumentDelegationMember.class); |
64 |
|
private List<RoleDocumentDelegation> delegations = new AutoPopulatingList(RoleDocumentDelegation.class); |
65 |
|
|
66 |
|
transient private ResponsibilityService responsibilityService; |
67 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
68 |
0
|
public IdentityManagementRoleDocument() {... |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
@return |
73 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
74 |
0
|
public boolean isActive() {... |
75 |
0
|
return this.active; |
76 |
|
} |
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
81 |
0
|
public void setActive(boolean active) {... |
82 |
0
|
this.active = active; |
83 |
|
} |
84 |
|
|
85 |
|
|
86 |
|
@param |
87 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
88 |
0
|
public void setRoleId(String roleId) {... |
89 |
0
|
this.roleId = roleId; |
90 |
|
} |
91 |
|
|
92 |
|
|
93 |
|
@return |
94 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
95 |
0
|
public String getRoleName() {... |
96 |
0
|
return this.roleName; |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
@param |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
0
|
public void setRoleName(String roleName) {... |
103 |
0
|
this.roleName = roleName; |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
@return |
108 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
109 |
0
|
public String getRoleDescription() {... |
110 |
0
|
return this.roleDescription; |
111 |
|
} |
112 |
|
|
113 |
|
|
114 |
|
@param |
115 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
116 |
0
|
public void setRoleDescription(String roleDescription) {... |
117 |
0
|
this.roleDescription = roleDescription; |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
|
@return |
122 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
0
|
public String getRoleNamespace() {... |
124 |
0
|
return this.roleNamespace; |
125 |
|
} |
126 |
|
|
127 |
|
|
128 |
|
@param |
129 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
130 |
0
|
public void setRoleNamespace(String roleNamespace) {... |
131 |
0
|
this.roleNamespace = roleNamespace; |
132 |
|
} |
133 |
|
|
134 |
|
|
135 |
|
@return |
136 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
137 |
0
|
public String getRoleTypeId() {... |
138 |
0
|
return this.roleTypeId; |
139 |
|
} |
140 |
|
|
141 |
|
|
142 |
|
@param |
143 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
144 |
0
|
public void setRoleTypeId(String roleTypeId) {... |
145 |
0
|
this.roleTypeId = roleTypeId; |
146 |
|
} |
147 |
|
|
148 |
|
|
149 |
|
@return |
150 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 5 |
Complexity Density: 0.62 |
|
151 |
0
|
public String getRoleTypeName() {... |
152 |
0
|
if ( roleTypeName == null ) { |
153 |
0
|
if ( kimType != null ) { |
154 |
0
|
roleTypeName = kimType.getName(); |
155 |
0
|
} else if ( roleTypeId != null ) { |
156 |
0
|
setKimType( KIMServiceLocatorWeb.getTypeInfoService().getKimType(roleTypeId) ); |
157 |
0
|
if ( kimType != null ) { |
158 |
0
|
roleTypeName = kimType.getName(); |
159 |
|
} |
160 |
|
} |
161 |
|
} |
162 |
0
|
return this.roleTypeName; |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
|
@param |
167 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
0
|
public void setRoleTypeName(String roleTypeName) {... |
169 |
0
|
this.roleTypeName = roleTypeName; |
170 |
|
} |
171 |
|
|
172 |
|
|
173 |
|
@return |
174 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
175 |
0
|
public List<RoleDocumentDelegationMember> getDelegationMembers() {... |
176 |
0
|
return this.delegationMembers; |
177 |
|
} |
178 |
|
|
179 |
|
|
180 |
|
@param |
181 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
182 |
0
|
public void setDelegationMembers(... |
183 |
|
List<RoleDocumentDelegationMember> delegationMembers) { |
184 |
0
|
this.delegationMembers = delegationMembers; |
185 |
|
} |
186 |
|
|
187 |
|
|
188 |
|
@return |
189 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
190 |
0
|
public List<KimDocumentRolePermission> getPermissions() {... |
191 |
0
|
return this.permissions; |
192 |
|
} |
193 |
|
|
194 |
|
|
195 |
|
@param |
196 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
197 |
0
|
public void setPermissions(List<KimDocumentRolePermission> permissions) {... |
198 |
0
|
this.permissions = permissions; |
199 |
|
} |
200 |
|
|
201 |
|
|
202 |
|
@return |
203 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
204 |
0
|
public List<KimDocumentRoleResponsibility> getResponsibilities() {... |
205 |
0
|
return this.responsibilities; |
206 |
|
} |
207 |
|
|
208 |
|
|
209 |
|
@param |
210 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
211 |
0
|
public void setResponsibilities(... |
212 |
|
List<KimDocumentRoleResponsibility> responsibilities) { |
213 |
0
|
this.responsibilities = responsibilities; |
214 |
|
} |
215 |
|
|
216 |
|
|
217 |
|
@return |
218 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
219 |
0
|
public List<KimDocumentRoleMember> getMembers() {... |
220 |
0
|
return this.members; |
221 |
|
} |
222 |
|
|
|
|
| 0% |
Uncovered Elements: 26 (26) |
Complexity: 9 |
Complexity Density: 0.69 |
|
223 |
|
public enum RoleMemberMetaDataType implements Comparator<KimDocumentRoleMember>{ |
224 |
|
MEMBER_ID("memberId"), |
225 |
|
MEMBER_NAME("memberName"), |
226 |
|
FULL_MEMBER_NAME("memberFullName"); |
227 |
|
|
228 |
|
private final String attributeName; |
229 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
230 |
0
|
RoleMemberMetaDataType(String anAttributeName) {... |
231 |
0
|
this.attributeName = anAttributeName; |
232 |
|
} |
233 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
234 |
0
|
public String getAttributeName() {... |
235 |
0
|
return attributeName; |
236 |
|
} |
237 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 7 |
Complexity Density: 0.64 |
|
238 |
0
|
@Override... |
239 |
|
public int compare(KimDocumentRoleMember m1, KimDocumentRoleMember m2) { |
240 |
0
|
if (m1 == null && m2 == null) { |
241 |
0
|
return 0; |
242 |
0
|
} else if (m1 == null) { |
243 |
0
|
return -1; |
244 |
0
|
} else if (m2 == null) { |
245 |
0
|
return 1; |
246 |
|
} |
247 |
0
|
if (this.getAttributeName().equals(MEMBER_ID.getAttributeName())) |
248 |
0
|
return m1.getMemberId().compareToIgnoreCase(m2.getMemberId()); |
249 |
0
|
else if (this.getAttributeName().equals(FULL_MEMBER_NAME.getAttributeName())) |
250 |
0
|
return m1.getMemberFullName().compareToIgnoreCase(m2.getMemberFullName()); |
251 |
0
|
return m1.getMemberName().compareToIgnoreCase(m2.getMemberName()); |
252 |
|
} |
253 |
|
} |
254 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 4 |
Complexity Density: 0.31 |
|
255 |
0
|
public void setMemberMetaDataTypeToSort(Integer columnNumber)... |
256 |
|
{ |
257 |
0
|
switch( columnNumber ) |
258 |
|
{ |
259 |
0
|
case 1: |
260 |
0
|
this.memberMetaDataType = RoleMemberMetaDataType.MEMBER_ID; |
261 |
0
|
break; |
262 |
0
|
case 2: |
263 |
0
|
this.memberMetaDataType = RoleMemberMetaDataType.MEMBER_NAME; |
264 |
0
|
break; |
265 |
0
|
case 3: |
266 |
0
|
this.memberMetaDataType = RoleMemberMetaDataType.FULL_MEMBER_NAME; |
267 |
0
|
break; |
268 |
0
|
default: |
269 |
0
|
this.memberMetaDataType = RoleMemberMetaDataType.MEMBER_NAME; |
270 |
0
|
break; |
271 |
|
} |
272 |
|
} |
273 |
|
|
274 |
|
protected RoleMemberMetaDataType memberMetaDataType = RoleMemberMetaDataType.MEMBER_NAME; |
275 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
276 |
0
|
public RoleMemberMetaDataType getMemberMetaDataType() {... |
277 |
0
|
return memberMetaDataType; |
278 |
|
} |
279 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
280 |
0
|
public void setMemberMetaDataType(RoleMemberMetaDataType memberMetaDataType) {... |
281 |
0
|
this.memberMetaDataType = memberMetaDataType; |
282 |
|
} |
283 |
|
|
284 |
|
|
285 |
|
@return |
286 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
287 |
0
|
public KimDocumentRoleMember getMember(String roleMemberId) {... |
288 |
0
|
if(StringUtils.isEmpty(roleMemberId)) return null; |
289 |
0
|
for(KimDocumentRoleMember roleMember: getMembers()){ |
290 |
0
|
if(roleMemberId.equals(roleMember.getRoleMemberId())) |
291 |
0
|
return roleMember; |
292 |
|
} |
293 |
0
|
return null; |
294 |
|
} |
295 |
|
|
296 |
|
|
297 |
|
@param |
298 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
299 |
0
|
public void setMembers(List<KimDocumentRoleMember> members) {... |
300 |
0
|
this.members = members; |
301 |
|
} |
302 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
303 |
0
|
public void addResponsibility(KimDocumentRoleResponsibility roleResponsibility){... |
304 |
0
|
if(!getResponsibilityService().areActionsAtAssignmentLevelById(roleResponsibility.getResponsibilityId())) { |
305 |
0
|
roleResponsibility.getRoleRspActions().add(getNewRespAction(roleResponsibility)); |
306 |
|
} |
307 |
0
|
getResponsibilities().add(roleResponsibility); |
308 |
|
} |
309 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
310 |
0
|
protected KimDocumentRoleResponsibilityAction getNewRespAction(KimDocumentRoleResponsibility roleResponsibility){... |
311 |
0
|
KimDocumentRoleResponsibilityAction roleRspAction = new KimDocumentRoleResponsibilityAction(); |
312 |
0
|
roleRspAction.setKimResponsibility(roleResponsibility.getKimResponsibility()); |
313 |
0
|
roleRspAction.setRoleResponsibilityId(roleResponsibility.getRoleResponsibilityId()); |
314 |
0
|
return roleRspAction; |
315 |
|
} |
316 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
317 |
0
|
public void addDelegationMember(RoleDocumentDelegationMember newDelegationMember){... |
318 |
0
|
getDelegationMembers().add(newDelegationMember); |
319 |
|
} |
320 |
|
|
321 |
|
|
322 |
|
@param |
323 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
324 |
0
|
public void addMember(KimDocumentRoleMember member) {... |
325 |
0
|
SequenceAccessorService sas = getSequenceAccessorService(); |
326 |
0
|
Long nextSeq = sas.getNextAvailableSequenceNumber( |
327 |
|
KimConstants.SequenceNames.KRIM_ROLE_MBR_ID_S, |
328 |
|
KimDocumentRoleMember.class); |
329 |
0
|
String roleMemberId = nextSeq.toString(); |
330 |
0
|
member.setRoleMemberId(roleMemberId); |
331 |
0
|
setupMemberRspActions(member); |
332 |
0
|
getMembers().add(member); |
333 |
|
} |
334 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
335 |
0
|
public KimDocumentRoleMember getBlankMember() {... |
336 |
0
|
KimDocumentRoleMember member = new KimDocumentRoleMember(); |
337 |
0
|
KimDocumentRoleQualifier qualifier; |
338 |
0
|
if(getDefinitions()!=null){ |
339 |
0
|
for(String key : getDefinitions().keySet()) { |
340 |
0
|
qualifier = new KimDocumentRoleQualifier(); |
341 |
0
|
qualifier.setKimAttrDefnId(getKimAttributeDefnId(getDefinitions().get(key))); |
342 |
0
|
member.getQualifiers().add(qualifier); |
343 |
|
} |
344 |
|
} |
345 |
0
|
setupMemberRspActions(member); |
346 |
0
|
return member; |
347 |
|
} |
348 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
349 |
0
|
public RoleDocumentDelegationMember getBlankDelegationMember() {... |
350 |
0
|
RoleDocumentDelegationMember member = new RoleDocumentDelegationMember(); |
351 |
0
|
RoleDocumentDelegationMemberQualifier qualifier; |
352 |
0
|
if(getDefinitions()!=null){ |
353 |
0
|
for(String key : getDefinitions().keySet()) { |
354 |
0
|
qualifier = new RoleDocumentDelegationMemberQualifier(); |
355 |
0
|
setAttrDefnIdForDelMemberQualifier(qualifier, getDefinitions().get(key)); |
356 |
0
|
member.getQualifiers().add(qualifier); |
357 |
|
} |
358 |
|
} |
359 |
0
|
return member; |
360 |
|
} |
361 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
362 |
0
|
public void setupMemberRspActions(KimDocumentRoleMember member) {... |
363 |
0
|
member.getRoleRspActions().clear(); |
364 |
0
|
for (KimDocumentRoleResponsibility roleResp: getResponsibilities()) { |
365 |
0
|
if (getResponsibilityService().areActionsAtAssignmentLevelById(roleResp.getResponsibilityId())) { |
366 |
0
|
KimDocumentRoleResponsibilityAction action = new KimDocumentRoleResponsibilityAction(); |
367 |
0
|
action.setRoleResponsibilityId("*"); |
368 |
0
|
action.setRoleMemberId(member.getRoleMemberId()); |
369 |
0
|
member.getRoleRspActions().add(action); |
370 |
0
|
break; |
371 |
|
} |
372 |
|
} |
373 |
|
} |
374 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
375 |
0
|
public void updateMembers(IdentityManagementRoleDocumentForm roleDocumentForm){... |
376 |
0
|
for(KimDocumentRoleMember member: roleDocumentForm.getRoleDocument().getMembers()){ |
377 |
0
|
roleDocumentForm.getRoleDocument().setupMemberRspActions(member); |
378 |
|
} |
379 |
|
} |
380 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
381 |
0
|
public void updateMembers(KimDocumentRoleResponsibility newResponsibility){... |
382 |
0
|
for(KimDocumentRoleMember member: getMembers()){ |
383 |
0
|
setupMemberRspActions(newResponsibility, member); |
384 |
|
} |
385 |
|
} |
386 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 5 |
Complexity Density: 0.71 |
|
387 |
0
|
public void setupMemberRspActions(KimDocumentRoleResponsibility roleResp, KimDocumentRoleMember member) {... |
388 |
0
|
if ((member.getRoleRspActions()==null || member.getRoleRspActions().size()<1) && getResponsibilityService().areActionsAtAssignmentLevelById(roleResp.getResponsibilityId())) { |
389 |
0
|
KimDocumentRoleResponsibilityAction action = new KimDocumentRoleResponsibilityAction(); |
390 |
0
|
action.setRoleResponsibilityId("*"); |
391 |
0
|
action.setRoleMemberId(member.getRoleMemberId()); |
392 |
0
|
if(member.getRoleRspActions()==null) |
393 |
0
|
member.setRoleRspActions(new ArrayList<KimDocumentRoleResponsibilityAction>()); |
394 |
0
|
member.getRoleRspActions().add(action); |
395 |
|
} |
396 |
|
} |
397 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
398 |
0
|
protected void setAttrDefnIdForDelMemberQualifier(RoleDocumentDelegationMemberQualifier qualifier,AttributeDefinition definition) {... |
399 |
0
|
if (definition instanceof KimDataDictionaryAttributeDefinition) { |
400 |
0
|
qualifier.setKimAttrDefnId(((KimDataDictionaryAttributeDefinition)definition).getKimAttrDefnId()); |
401 |
|
|
402 |
|
} else { |
403 |
0
|
qualifier.setKimAttrDefnId(((KimNonDataDictionaryAttributeDefinition)definition).getKimAttrDefnId()); |
404 |
|
|
405 |
|
|
406 |
|
} |
407 |
|
} |
408 |
|
|
409 |
|
|
410 |
|
@see |
411 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
412 |
0
|
@Override... |
413 |
|
public void doRouteStatusChange(DocumentRouteStatusChangeDTO statusChangeEvent) { |
414 |
0
|
super.doRouteStatusChange(statusChangeEvent); |
415 |
0
|
if (getDocumentHeader().getWorkflowDocument().stateIsProcessed()) { |
416 |
0
|
KIMServiceLocatorInternal.getUiDocumentService().saveRole(this); |
417 |
|
} |
418 |
|
} |
419 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
420 |
0
|
public void initializeDocumentForNewRole() {... |
421 |
0
|
if(StringUtils.isBlank(this.roleId)){ |
422 |
0
|
SequenceAccessorService sas = getSequenceAccessorService(); |
423 |
0
|
Long nextSeq = sas.getNextAvailableSequenceNumber( |
424 |
|
KimConstants.SequenceNames.KRIM_ROLE_ID_S, this.getClass()); |
425 |
0
|
this.roleId = nextSeq.toString(); |
426 |
|
} |
427 |
0
|
if(StringUtils.isBlank(this.roleTypeId)) { |
428 |
0
|
this.roleTypeId = "1"; |
429 |
|
} |
430 |
|
} |
431 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
432 |
0
|
public String getRoleId(){... |
433 |
0
|
if(StringUtils.isBlank(this.roleId)){ |
434 |
0
|
initializeDocumentForNewRole(); |
435 |
|
} |
436 |
0
|
return roleId; |
437 |
|
} |
438 |
|
|
|
|
| 0% |
Uncovered Elements: 89 (89) |
Complexity: 14 |
Complexity Density: 0.22 |
|
439 |
0
|
@Override... |
440 |
|
public void prepareForSave(){ |
441 |
0
|
SequenceAccessorService sas = getSequenceAccessorService(); |
442 |
|
|
443 |
0
|
String roleId; |
444 |
0
|
if(StringUtils.isBlank(getRoleId())){ |
445 |
0
|
Long nextSeq = sas.getNextAvailableSequenceNumber( |
446 |
|
KimConstants.SequenceNames.KRIM_ROLE_ID_S, this.getClass()); |
447 |
0
|
roleId = nextSeq.toString(); |
448 |
0
|
setRoleId(roleId); |
449 |
|
} else |
450 |
0
|
roleId = getRoleId(); |
451 |
|
|
452 |
0
|
if(getPermissions()!=null){ |
453 |
0
|
String rolePermissionId; |
454 |
0
|
for(KimDocumentRolePermission permission: getPermissions()){ |
455 |
0
|
permission.setRoleId(roleId); |
456 |
0
|
if(StringUtils.isBlank(permission.getRolePermissionId())){ |
457 |
0
|
Long nextSeq = sas.getNextAvailableSequenceNumber( |
458 |
|
KimConstants.SequenceNames.KRIM_ROLE_PERM_ID_S, |
459 |
|
KimDocumentRolePermission.class); |
460 |
0
|
rolePermissionId = nextSeq.toString(); |
461 |
0
|
permission.setRolePermissionId(rolePermissionId); |
462 |
|
} |
463 |
|
} |
464 |
|
} |
465 |
0
|
if(getResponsibilities()!=null){ |
466 |
0
|
String roleResponsibilityId; |
467 |
0
|
for(KimDocumentRoleResponsibility responsibility: getResponsibilities()){ |
468 |
0
|
if(StringUtils.isBlank(responsibility.getRoleResponsibilityId())){ |
469 |
0
|
Long nextSeq = sas.getNextAvailableSequenceNumber( |
470 |
|
KimConstants.SequenceNames.KRIM_ROLE_RSP_ID_S, |
471 |
|
KimDocumentRoleResponsibility.class); |
472 |
0
|
roleResponsibilityId = nextSeq.toString(); |
473 |
0
|
responsibility.setRoleResponsibilityId(roleResponsibilityId); |
474 |
|
} |
475 |
0
|
responsibility.setRoleId(roleId); |
476 |
0
|
if(!getResponsibilityService().areActionsAtAssignmentLevelById(responsibility.getResponsibilityId())){ |
477 |
0
|
if(StringUtils.isBlank(responsibility.getRoleRspActions().get(0).getRoleResponsibilityActionId())){ |
478 |
0
|
Long nextSeq = sas.getNextAvailableSequenceNumber( |
479 |
|
KimConstants.SequenceNames.KRIM_ROLE_RSP_ACTN_ID_S, |
480 |
|
KimDocumentRoleResponsibilityAction.class); |
481 |
0
|
String roleResponsibilityActionId = nextSeq.toString(); |
482 |
0
|
responsibility.getRoleRspActions().get(0).setRoleResponsibilityActionId(roleResponsibilityActionId); |
483 |
|
} |
484 |
0
|
responsibility.getRoleRspActions().get(0).setRoleMemberId("*"); |
485 |
0
|
responsibility.getRoleRspActions().get(0).setDocumentNumber(getDocumentNumber()); |
486 |
|
} |
487 |
|
} |
488 |
|
} |
489 |
0
|
if(getMembers()!=null){ |
490 |
0
|
String roleMemberId; |
491 |
0
|
String roleResponsibilityActionId; |
492 |
0
|
for(KimDocumentRoleMember member: getMembers()){ |
493 |
0
|
member.setRoleId(roleId); |
494 |
0
|
if(StringUtils.isBlank(member.getRoleMemberId())){ |
495 |
0
|
Long nextSeq = sas.getNextAvailableSequenceNumber( |
496 |
|
KimConstants.SequenceNames.KRIM_ROLE_MBR_ID_S, |
497 |
|
KimDocumentRoleMember.class); |
498 |
0
|
roleMemberId = nextSeq.toString(); |
499 |
0
|
member.setRoleMemberId(roleMemberId); |
500 |
|
} |
501 |
0
|
for(KimDocumentRoleQualifier qualifier: member.getQualifiers()){ |
502 |
0
|
qualifier.setKimTypId(getKimType().getKimTypeId()); |
503 |
|
} |
504 |
0
|
for(KimDocumentRoleResponsibilityAction roleRespAction: member.getRoleRspActions()){ |
505 |
0
|
if(StringUtils.isBlank(roleRespAction.getRoleResponsibilityActionId())){ |
506 |
0
|
Long nextSeq = sas.getNextAvailableSequenceNumber( |
507 |
|
KimConstants.SequenceNames.KRIM_ROLE_RSP_ACTN_ID_S, |
508 |
|
KimDocumentRoleResponsibilityAction.class); |
509 |
0
|
roleResponsibilityActionId = nextSeq.toString(); |
510 |
0
|
roleRespAction.setRoleResponsibilityActionId(roleResponsibilityActionId); |
511 |
|
} |
512 |
0
|
roleRespAction.setRoleMemberId(member.getRoleMemberId()); |
513 |
0
|
roleRespAction.setDocumentNumber(getDocumentNumber()); |
514 |
0
|
if ( !StringUtils.equals( roleRespAction.getRoleResponsibilityId(), "*" ) ) { |
515 |
0
|
for(KimDocumentRoleResponsibility responsibility: getResponsibilities()){ |
516 |
0
|
if( StringUtils.equals( roleRespAction.getKimResponsibility().getResponsibilityId(), responsibility.getResponsibilityId() ) ) { |
517 |
0
|
roleRespAction.setRoleResponsibilityId(responsibility.getRoleResponsibilityId()); |
518 |
|
} |
519 |
|
} |
520 |
|
} |
521 |
|
} |
522 |
|
} |
523 |
|
} |
524 |
0
|
if(getDelegationMembers()!=null){ |
525 |
0
|
for(RoleDocumentDelegationMember delegationMember: getDelegationMembers()){ |
526 |
0
|
delegationMember.setDocumentNumber(getDocumentNumber()); |
527 |
0
|
addDelegationMemberToDelegation(delegationMember); |
528 |
|
} |
529 |
0
|
for(RoleDocumentDelegation delegation: getDelegations()){ |
530 |
0
|
delegation.setDocumentNumber(getDocumentNumber()); |
531 |
0
|
delegation.setKimTypeId(getKimType().getKimTypeId()); |
532 |
0
|
for(RoleDocumentDelegationMember member: delegation.getMembers()){ |
533 |
0
|
for(RoleDocumentDelegationMemberQualifier qualifier: member.getQualifiers()){ |
534 |
0
|
qualifier.setKimTypId(getKimType().getKimTypeId()); |
535 |
|
} |
536 |
|
} |
537 |
0
|
delegation.setRoleId(roleId); |
538 |
|
} |
539 |
|
} |
540 |
|
} |
541 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
542 |
0
|
public ResponsibilityService getResponsibilityService() {... |
543 |
0
|
if ( responsibilityService == null ) { |
544 |
0
|
responsibilityService = KIMServiceLocator.getResponsibilityService(); |
545 |
|
} |
546 |
0
|
return responsibilityService; |
547 |
|
} |
548 |
|
|
549 |
|
|
550 |
|
@return |
551 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
552 |
0
|
public boolean isEditing() {... |
553 |
0
|
return this.editing; |
554 |
|
} |
555 |
|
|
556 |
|
|
557 |
|
@param |
558 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
559 |
0
|
public void setEditing(boolean editing) {... |
560 |
0
|
this.editing = editing; |
561 |
|
} |
562 |
|
|
563 |
|
|
564 |
|
@return |
565 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
566 |
0
|
public List<RoleDocumentDelegation> getDelegations() {... |
567 |
0
|
return this.delegations; |
568 |
|
} |
569 |
|
|
570 |
|
|
571 |
|
@param |
572 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
573 |
0
|
public void setDelegations(List<RoleDocumentDelegation> delegations) {... |
574 |
0
|
this.delegations = delegations; |
575 |
|
} |
576 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
577 |
0
|
public void setKimType(KimTypeInfo kimType) {... |
578 |
0
|
super.setKimType(kimType); |
579 |
0
|
if (kimType != null){ |
580 |
0
|
setRoleTypeId(kimType.getKimTypeId()); |
581 |
0
|
setRoleTypeName(kimType.getName()); |
582 |
|
} |
583 |
|
} |
584 |
|
} |