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
32 public class InitiatorRoleAttribute extends UnqualifiedRoleAttribute {
33 private static final String INITIATOR_ROLE_KEY = "INITIATOR";
34 private static final String INITIATOR_ROLE_LABEL = "Initiator";
35
36 private static final RoleName ROLE = new RoleName(InitiatorRoleAttribute.class.getName(), INITIATOR_ROLE_KEY, INITIATOR_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 InitiatorRoleAttribute() {
45 super(ROLES);
46 }
47
48 public ResolvedQualifiedRole resolveRole(RouteContext routeContext, String roleName) {
49 List members = new ArrayList(1);
50 members.add(new PrincipalId(routeContext.getDocument().getInitiatorWorkflowId()));
51 return new ResolvedQualifiedRole(INITIATOR_ROLE_LABEL, members);
52 }
53 }