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.Recipient;
19 import org.kuali.rice.kim.api.identity.Person;
20
21
22
23
24
25
26
27
28
29 public class WebFriendlyRecipient implements Recipient{
30
31 private static final long serialVersionUID = 2259350039081951688L;
32
33 private String displayName;
34 private String recipientId;
35
36 public WebFriendlyRecipient(String recipientId, String displayName) {
37 this.recipientId = recipientId;
38 this.displayName = displayName;
39 }
40
41 public WebFriendlyRecipient(Object recipient) {
42 if (recipient instanceof WebFriendlyRecipient) {
43 recipientId = ((WebFriendlyRecipient) recipient).getRecipientId();
44 displayName = ((WebFriendlyRecipient) recipient).getDisplayName();
45 } else if(recipient instanceof Person){
46 recipientId = ((Person)recipient).getPrincipalId();
47 displayName = ((Person)recipient).getLastName() + ", " + ((Person)recipient).getFirstName();
48 }else {
49 throw new IllegalArgumentException("Must pass in type Recipient or Person");
50 }
51 }
52
53 public String getRecipientId() {
54 return recipientId;
55 }
56
57
58
59
60
61 public String getDisplayName() {
62 return this.displayName;
63 }
64
65 }