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