1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.actions;
18
19 import org.kuali.rice.kew.engine.RouteContext;
20 import org.kuali.rice.kew.identity.Id;
21 import org.kuali.rice.kew.routeheader.DocumentContent;
22 import org.kuali.rice.kew.rule.AbstractRoleAttribute;
23 import org.kuali.rice.kew.rule.ResolvedQualifiedRole;
24 import org.kuali.rice.kew.rule.Role;
25 import org.kuali.rice.kew.user.AuthenticationUserId;
26
27 import java.util.ArrayList;
28 import java.util.Arrays;
29 import java.util.List;
30
31
32
33
34
35
36
37
38
39
40 public class BANotificationRoleAttribute extends AbstractRoleAttribute {
41
42 public List getRoleNames() {
43 return Arrays.asList(new Role[] { new Role(getClass(), "Notify", "Notify"), new Role(getClass(), "Notify2", "Notify2"), new Role(getClass(), "NotifyDelegate", "NotifyDelegate") });
44 }
45
46 public List getQualifiedRoleNames(String roleName, DocumentContent documentContent) {
47 List<String> qualifiedRoleNames = new ArrayList<String>();
48 if (roleName.equals("Notify") || roleName.equals("Notify2")) {
49 qualifiedRoleNames.add("jitrue");
50 } else throw new RuntimeException("Bad Role " + roleName);
51 return qualifiedRoleNames;
52 }
53
54 public ResolvedQualifiedRole resolveQualifiedRole(RouteContext routeContext, String roleName, String qualifiedRole) {
55 if (roleName.equals("Notify") || roleName.equals("Notify2")) {
56 return new ResolvedQualifiedRole(roleName, Arrays.asList(new Id[] { new AuthenticationUserId(qualifiedRole) }));
57 } else if (roleName.equals("NotifyDelegate")) {
58 List<Id> recipients = new ArrayList<Id>();
59 recipients.add(new AuthenticationUserId("natjohns"));
60 recipients.add(new AuthenticationUserId("shenl"));
61 return new ResolvedQualifiedRole(roleName, recipients);
62 }
63 throw new RuntimeException("Bad Role " + roleName);
64 }
65
66 }