1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.util;
17
18 import org.kuali.rice.kew.actionrequest.KimGroupRecipient;
19 import org.kuali.rice.kew.actionrequest.Recipient;
20 import org.kuali.rice.kew.role.KimRoleRecipient;
21 import org.kuali.rice.kim.api.group.Group;
22 import org.kuali.rice.kim.api.identity.Person;
23
24
25
26
27
28
29
30
31
32 public class WebFriendlyRecipient implements Recipient{
33
34 private static final long serialVersionUID = 2259350039081951688L;
35
36 private String displayName;
37 private String recipientId;
38
39 public WebFriendlyRecipient(String recipientId, String displayName) {
40 this.recipientId = recipientId;
41 this.displayName = displayName;
42 }
43
44 public WebFriendlyRecipient(Object recipient) {
45 if (recipient instanceof WebFriendlyRecipient) {
46 recipientId = ((WebFriendlyRecipient) recipient).getRecipientId();
47 displayName = ((WebFriendlyRecipient) recipient).getDisplayName();
48
49
50
51 } else if(recipient instanceof Person){
52 recipientId = ((Person)recipient).getPrincipalId();
53 displayName = ((Person)recipient).getLastName() + ", " + ((Person)recipient).getFirstName();
54
55 } else if(recipient instanceof KimGroupRecipient){
56 recipientId = ((KimGroupRecipient)recipient).getGroupId();
57 displayName = ((KimGroupRecipient)recipient).getGroup().getNamespaceCode() + ":" + ((KimGroupRecipient)recipient).getGroup().getName();
58
59 }else {
60 throw new IllegalArgumentException("Must pass in type Recipient or Person");
61 }
62 }
63
64 public String getRecipientId() {
65 return recipientId;
66 }
67
68
69
70
71
72 public String getDisplayName() {
73 return this.displayName;
74 }
75
76 }