01: /*
02: * Copyright 2005-2006 The Kuali Foundation.
03: *
04: *
05: * Licensed under the Educational Community License, Version 1.0 (the "License");
06: * you may not use this file except in compliance with the License.
07: * You may obtain a copy of the License at
08: *
09: * http://www.opensource.org/licenses/ecl1.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 edu.iu.uis.eden.user;
18:
19: /**
20: * EmplId is an "employee" id that can be used as a foreign key into another,
21: * institutional, identity system. The workflow engine does not depend upon
22: * the existence of this ID on a {@link WorkflowUser}.
23: *
24: * @see WorkflowUser
25: *
26: * @author bmcgough
27: */
28: public final class EmplId implements UserId {
29:
30: private static final long serialVersionUID = -1335314734556834643L;
31:
32: private String emplId;
33:
34: public EmplId(String emplId) {
35: setEmplId(emplId);
36: }
37:
38: public EmplId() {
39: }
40:
41: public String getId() {
42: return getEmplId();
43: }
44:
45: public String getEmplId() {
46: return emplId;
47: }
48:
49: public void setEmplId(String emplId) {
50: this .emplId = (emplId == null ? null : emplId.trim());
51: }
52:
53: /**
54: * Returns true if this userId has an empty value. Empty userIds can't be used as keys in a Hash, among other things.
55: *
56: * @return true if this instance doesn't have a value
57: */
58: public boolean isEmpty() {
59: return (emplId == null || emplId.trim().length() == 0);
60: }
61:
62: /**
63: * If you make this class non-final, you must rewrite equals to work for subclasses.
64: */
65: public boolean equals(Object obj) {
66:
67: if (obj != null && (obj instanceof EmplId)) {
68: EmplId a = (EmplId) obj;
69:
70: if (getEmplId() == null) {
71: return false;
72: }
73:
74: return emplId.equals(a.emplId);
75: }
76:
77: return false;
78: }
79:
80: public int hashCode() {
81: return emplId == null ? 0 : emplId.hashCode();
82: }
83:
84: public String toString() {
85: if (emplId == null) {
86: return "emplId: null";
87: }
88: return "emplId: " + emplId;
89: }
90: }
|