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