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