Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
WorkflowUserId |
|
| 2.111111111111111;2.111 |
1 | /* | |
2 | * Copyright 2005-2008 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.PrincipalId; | |
20 | ||
21 | /** | |
22 | * A unique user Id which is generated by the application. | |
23 | * | |
24 | * @deprecated use {@link PrincipalId} instead | |
25 | * | |
26 | * @author Kuali Rice Team (rice.collab@kuali.org) | |
27 | */ | |
28 | public class WorkflowUserId implements UserId { | |
29 | ||
30 | private static final long serialVersionUID = -5551723348738932404L; | |
31 | ||
32 | private String workflowId; | |
33 | ||
34 | 0 | public WorkflowUserId(String workflowId) { |
35 | 0 | setWorkflowId(workflowId); |
36 | 0 | } |
37 | ||
38 | 0 | public WorkflowUserId() { |
39 | 0 | } |
40 | ||
41 | public String getId() { | |
42 | 0 | return getWorkflowId(); |
43 | } | |
44 | ||
45 | public String getWorkflowId() { | |
46 | 0 | return workflowId; |
47 | } | |
48 | ||
49 | public void setWorkflowId(String workflowId) { | |
50 | 0 | this.workflowId = (workflowId == null ? null : workflowId.trim()); |
51 | 0 | } |
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 | 0 | return (workflowId == null || workflowId.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 | 0 | if (obj != null && (obj instanceof WorkflowUserId)) { |
67 | 0 | WorkflowUserId w = (WorkflowUserId) obj; |
68 | ||
69 | 0 | if (getWorkflowId() == null) { |
70 | 0 | return false; |
71 | } | |
72 | 0 | return workflowId.equals(w.getWorkflowId()); |
73 | } | |
74 | ||
75 | 0 | return false; |
76 | } | |
77 | ||
78 | public int hashCode() { | |
79 | 0 | return workflowId == null ? 0 : workflowId.hashCode(); |
80 | } | |
81 | ||
82 | public String toString() { | |
83 | 0 | if (workflowId == null) { |
84 | 0 | return "workflowId: null"; |
85 | } | |
86 | 0 | return "workflowId: " + workflowId; |
87 | } | |
88 | } |