1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.workgroup; |
18 | |
|
19 | |
import org.kuali.rice.kew.util.Utilities; |
20 | |
import org.kuali.rice.kim.util.KimConstants; |
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public final class GroupNameId implements GroupId { |
30 | |
|
31 | |
private static final long serialVersionUID = -4625193242111678434L; |
32 | |
|
33 | 0 | private String namespace = KimConstants.KIM_GROUP_DEFAULT_NAMESPACE_CODE; |
34 | |
private String nameId; |
35 | |
|
36 | 0 | public GroupNameId(String nameId) { |
37 | 0 | this.nameId = nameId; |
38 | 0 | this.namespace = Utilities.parseGroupNamespaceCode(nameId); |
39 | 0 | this.nameId = Utilities.parseGroupName(nameId); |
40 | 0 | } |
41 | |
|
42 | 0 | public GroupNameId(String namespace, String nameId) { |
43 | 0 | this.namespace = namespace; |
44 | 0 | this.nameId = nameId; |
45 | 0 | } |
46 | |
|
47 | |
public String getNameId() { |
48 | 0 | return nameId; |
49 | |
} |
50 | |
|
51 | |
public String getNamespace() { |
52 | 0 | return namespace; |
53 | |
} |
54 | |
|
55 | |
public boolean isEmpty() { |
56 | 0 | return (nameId == null) || (nameId.trim().length() == 0); |
57 | |
} |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
public boolean equals(Object obj) { |
63 | 0 | boolean isEqual = false; |
64 | |
|
65 | 0 | if (obj != null && (obj instanceof GroupNameId)) { |
66 | 0 | GroupNameId w = (GroupNameId) obj; |
67 | |
|
68 | 0 | if (w.getNameId() != null && getNameId() != null) { |
69 | 0 | return w.getNameId().equals(getNameId()) && w.getNamespace().equals(getNamespace()); |
70 | |
} else { |
71 | 0 | return false; |
72 | |
} |
73 | |
} |
74 | |
|
75 | 0 | return isEqual; |
76 | |
} |
77 | |
|
78 | |
public int hashCode() { |
79 | 0 | if (nameId == null) { |
80 | 0 | return 0; |
81 | |
} |
82 | 0 | return nameId.hashCode(); |
83 | |
} |
84 | |
|
85 | |
public String toString() { |
86 | 0 | if (nameId != null) { |
87 | 0 | return nameId; |
88 | |
} |
89 | 0 | return "null"; |
90 | |
} |
91 | |
|
92 | |
} |