1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
package org.kuali.student.lum.kim.role.type; |
16 | |
|
17 | |
import org.apache.commons.lang.StringUtils; |
18 | |
import org.kuali.rice.kim.api.KimConstants; |
19 | |
|
20 | |
import org.kuali.rice.kim.api.role.RoleMembership; |
21 | |
import org.kuali.rice.kns.kim.role.DerivedRoleTypeServiceBase; |
22 | |
|
23 | |
import java.util.ArrayList; |
24 | |
import java.util.List; |
25 | |
import java.util.Map; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | 0 | public class HierarchyNodeTestRoleTypeServiceBase extends DerivedRoleTypeServiceBase { |
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
@Override |
39 | |
public List<RoleMembership> getRoleMembersFromDerivedRole(String namespaceCode, String roleName, Map<String, String> qualification) { |
40 | 0 | List<RoleMembership> roleMembers = new ArrayList<RoleMembership>(); |
41 | 0 | roleMembers.add(RoleMembership.Builder.create(null, null, "eric", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE, null).build()); |
42 | 0 | roleMembers.add(RoleMembership.Builder.create(null, null, "fran", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE, null).build()); |
43 | 0 | roleMembers.add(RoleMembership.Builder.create(null, null, "user1", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE, null).build()); |
44 | 0 | roleMembers.add(RoleMembership.Builder.create(null, null, "user4", KimConstants.KimGroupMemberTypes.PRINCIPAL_MEMBER_TYPE, null).build()); |
45 | 0 | return roleMembers; |
46 | |
} |
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | |
|
52 | |
public List<RoleMembership> sortRoleMembers(List<RoleMembership> roleMembers) { |
53 | 0 | List<RoleMembership> sortedRoleMembers = new ArrayList<RoleMembership>(); |
54 | 0 | int group = 0; |
55 | 0 | for (RoleMembership roleMembership : roleMembers) { |
56 | 0 | RoleMembership.Builder bldr = RoleMembership.Builder.create(roleMembership); |
57 | 0 | bldr.setRoleSortingCode(StringUtils.leftPad(Integer.toString(group), 3, '0')); |
58 | 0 | sortedRoleMembers.add(bldr.build()); |
59 | 0 | group++; |
60 | 0 | } |
61 | 0 | return sortedRoleMembers; |
62 | |
} |
63 | |
} |