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