1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.rule;
17
18 import java.util.ArrayList;
19 import java.util.Collections;
20 import java.util.List;
21
22 import org.kuali.rice.kew.api.identity.PrincipalId;
23 import org.kuali.rice.kew.api.rule.RoleName;
24 import org.kuali.rice.kew.engine.RouteContext;
25
26
27
28
29
30
31 public class RoutedByUserRoleAttribute extends UnqualifiedRoleAttribute {
32 private static final long serialVersionUID = -7099014184598851664L;
33 private static final String ROUTED_BY_USER_ROLE_KEY = "ROUTED_BY_USER";
34 private static final String ROUTED_BY_USER_ROLE_LABEL = "Routed By User";
35
36 private static final RoleName ROLE = new RoleName(RoutedByUserRoleAttribute.class.getName(), ROUTED_BY_USER_ROLE_KEY, ROUTED_BY_USER_ROLE_LABEL);
37 private static final List<RoleName> ROLES;
38 static {
39 ArrayList<RoleName> roles = new ArrayList<RoleName>(1);
40 roles.add(ROLE);
41 ROLES = Collections.unmodifiableList(roles);
42 }
43
44 public RoutedByUserRoleAttribute() {
45 super(ROLES);
46 }
47
48 public ResolvedQualifiedRole resolveRole(RouteContext routeContext, String roleName) {
49
50
51 List members = new ArrayList(1);
52
53 members.add(new PrincipalId(routeContext.getDocument().getRoutedByUserWorkflowId()));
54 return new ResolvedQualifiedRole(ROUTED_BY_USER_ROLE_LABEL, members);
55 }
56 }