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