1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
package org.kuali.rice.ken.service.impl; |
17 |
|
|
18 |
|
import java.util.List; |
19 |
|
|
20 |
|
import org.apache.log4j.Level; |
21 |
|
import org.apache.log4j.Logger; |
22 |
|
import org.kuali.rice.ken.service.NotificationRecipientService; |
23 |
|
import org.kuali.rice.kim.bo.Group; |
24 |
|
import org.kuali.rice.kim.service.IdentityManagementService; |
25 |
|
import org.kuali.rice.kim.service.KIMServiceLocator; |
26 |
|
import org.kuali.rice.kim.util.KimConstants.KimGroupMemberTypes; |
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
@author |
32 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 9 |
Complexity Density: 0.56 |
|
33 |
|
public class NotificationRecipientServiceKimImpl implements NotificationRecipientService |
34 |
|
{ |
35 |
|
private static final Logger LOG = |
36 |
|
Logger.getLogger(NotificationRecipientServiceKimImpl.class); |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
38 |
0
|
protected IdentityManagementService getIdentityManagementService()... |
39 |
|
{ |
40 |
0
|
return KIMServiceLocator.getIdentityManagementService(); |
41 |
|
} |
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
@param |
47 |
|
@return |
48 |
|
@see |
49 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
50 |
0
|
public String[] getGroupMembers(String groupRecipientId)... |
51 |
|
{ |
52 |
0
|
Group group = getIdentityManagementService().getGroup(groupRecipientId); |
53 |
|
|
54 |
0
|
List<String> ids = getIdentityManagementService().getGroupMemberPrincipalIds(group.getGroupId()); |
55 |
|
|
56 |
0
|
String[] array = new String[ids.size()]; |
57 |
0
|
return ids.toArray(array); |
58 |
|
} |
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
@param |
63 |
|
@return |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
0
|
public String getUserDisplayName(String userId)... |
66 |
|
{ |
67 |
|
|
68 |
0
|
return null; |
69 |
|
} |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
@see |
74 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 4 |
Complexity Density: 0.5 |
|
75 |
0
|
public boolean isRecipientValid(String recipientId, String recipientType)... |
76 |
|
{ |
77 |
0
|
boolean b = false; |
78 |
|
|
79 |
0
|
if( recipientType.equals(KimGroupMemberTypes.GROUP_MEMBER_TYPE)) |
80 |
|
{ |
81 |
0
|
b = isGroupRecipientValid( recipientId ); |
82 |
|
} |
83 |
0
|
else if( recipientType.equals(KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE) ) |
84 |
|
{ |
85 |
0
|
b = isUserRecipientValid( recipientId ); |
86 |
|
} |
87 |
|
else |
88 |
|
{ |
89 |
0
|
if( LOG.isEnabledFor(Level.ERROR) ) |
90 |
|
{ |
91 |
0
|
LOG.error("Recipient Type is neither of two acceptable values"); |
92 |
|
} |
93 |
|
} |
94 |
0
|
return b; |
95 |
|
} |
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
@see |
101 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
102 |
0
|
public boolean isGroupRecipientValid(String groupRecipientId)... |
103 |
|
{ |
104 |
0
|
return (KIMServiceLocator.getIdentityManagementService().getGroup( groupRecipientId ) != null); |
105 |
|
} |
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
@see |
111 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
112 |
0
|
public boolean isUserRecipientValid(String principalName)... |
113 |
|
{ |
114 |
0
|
return (KIMServiceLocator.getIdentityManagementService() |
115 |
|
.getPrincipalByPrincipalName(principalName) != null); |
116 |
|
} |
117 |
|
|
118 |
|
} |