Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
EmplId |
|
| 2.111111111111111;2.111 |
1 | /* | |
2 | * Copyright 2005-2009 The Kuali Foundation | |
3 | * | |
4 | * | |
5 | * Licensed under the Educational Community License, Version 2.0 (the "License"); | |
6 | * you may not use this file except in compliance with the License. | |
7 | * You may obtain a copy of the License at | |
8 | * | |
9 | * http://www.opensource.org/licenses/ecl2.php | |
10 | * | |
11 | * Unless required by applicable law or agreed to in writing, software | |
12 | * distributed under the License is distributed on an "AS IS" BASIS, | |
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 | * See the License for the specific language governing permissions and | |
15 | * limitations under the License. | |
16 | */ | |
17 | package org.kuali.rice.kew.user; | |
18 | ||
19 | import org.kuali.rice.kew.identity.EmployeeId; | |
20 | ||
21 | /** | |
22 | * EmplId is an "employee" id that can be used as a foreign key into another, | |
23 | * institutional, identity system. The workflow engine does not depend upon | |
24 | * the existence of this ID on a {@link WorkflowUser}. | |
25 | * | |
26 | * @deprecated use {@link EmployeeId} instead | |
27 | * | |
28 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
29 | */ | |
30 | public class EmplId implements UserId { | |
31 | ||
32 | private static final long serialVersionUID = -1335314734556834643L; | |
33 | ||
34 | private String emplId; | |
35 | ||
36 | 0 | public EmplId(String emplId) { |
37 | 0 | setEmplId(emplId); |
38 | 0 | } |
39 | ||
40 | 0 | public EmplId() { |
41 | 0 | } |
42 | ||
43 | public String getId() { | |
44 | 0 | return getEmplId(); |
45 | } | |
46 | ||
47 | public String getEmplId() { | |
48 | 0 | return emplId; |
49 | } | |
50 | ||
51 | public void setEmplId(String emplId) { | |
52 | 0 | this.emplId = (emplId == null ? null : emplId.trim()); |
53 | 0 | } |
54 | ||
55 | /** | |
56 | * Returns true if this userId has an empty value. Empty userIds can't be used as keys in a Hash, among other things. | |
57 | * | |
58 | * @return true if this instance doesn't have a value | |
59 | */ | |
60 | public boolean isEmpty() { | |
61 | 0 | return (emplId == null || emplId.trim().length() == 0); |
62 | } | |
63 | ||
64 | /** | |
65 | * If you make this class non-final, you must rewrite equals to work for subclasses. | |
66 | */ | |
67 | public boolean equals(Object obj) { | |
68 | ||
69 | 0 | if (obj != null && (obj instanceof EmplId)) { |
70 | 0 | EmplId a = (EmplId) obj; |
71 | ||
72 | 0 | if (getEmplId() == null) { |
73 | 0 | return false; |
74 | } | |
75 | ||
76 | 0 | return emplId.equals(a.emplId); |
77 | } | |
78 | ||
79 | 0 | return false; |
80 | } | |
81 | ||
82 | public int hashCode() { | |
83 | 0 | return emplId == null ? 0 : emplId.hashCode(); |
84 | } | |
85 | ||
86 | public String toString() { | |
87 | 0 | if (emplId == null) { |
88 | 0 | return "emplId: null"; |
89 | } | |
90 | 0 | return "emplId: " + emplId; |
91 | } | |
92 | } |