1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.api.identity;
17
18 import org.kuali.rice.kew.api.user.UserId;
19
20
21
22
23
24
25
26 public class PrincipalId implements UserId {
27 private static final long serialVersionUID = -5551723348738932404L;
28
29 private String principalId;
30
31 public PrincipalId() { }
32
33 public PrincipalId(String principalId) {
34 setPrincipalId(principalId);
35 }
36
37 public String getPrincipalId() {
38 return this.principalId;
39 }
40
41 public void setPrincipalId(String principalId) {
42 this.principalId = (principalId == null ? null : principalId.trim());
43 }
44
45 @Override
46 public String getId() {
47 return getPrincipalId();
48 }
49
50
51
52
53
54
55
56 @Override
57 public boolean isEmpty() {
58 return (principalId == null || principalId.trim().length() == 0);
59 }
60
61
62
63
64 public boolean equals(Object obj) {
65 if (obj != null && (obj instanceof PrincipalId)) {
66 PrincipalId w = (PrincipalId) obj;
67
68 if (getPrincipalId() == null) {
69 return false;
70 }
71 return principalId.equals(w.getPrincipalId());
72 }
73
74 return false;
75 }
76
77 public int hashCode() {
78 return principalId == null ? 0 : principalId.hashCode();
79 }
80
81 public String toString() {
82 if (principalId == null) {
83 return "principalId: null";
84 }
85 return "principalId: " + principalId;
86 }
87
88 }