KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > domain > hibernate > NodeStatusImpl


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.domain.hibernate;
18
19 import org.alfresco.repo.domain.NodeKey;
20 import org.alfresco.repo.domain.NodeStatus;
21 import org.alfresco.util.EqualsHelper;
22
23 /**
24  * Hibernate implementation of a <b>node status</b>
25  *
26  * @author Derek Hulley
27  */

28 public class NodeStatusImpl implements NodeStatus
29 {
30     private NodeKey key;
31     private String JavaDoc changeTxnId;
32     private boolean deleted;
33
34     public int hashCode()
35     {
36         return (key == null) ? 0 : key.hashCode();
37     }
38     
39     public boolean equals(Object JavaDoc obj)
40     {
41         if (obj == this)
42             return true;
43         else if (obj == null)
44             return false;
45         else if (!(obj instanceof NodeStatusImpl))
46             return false;
47         NodeStatus that = (NodeStatus) obj;
48         return (EqualsHelper.nullSafeEquals(this.key, that.getKey())) &&
49                (EqualsHelper.nullSafeEquals(this.changeTxnId, that.getChangeTxnId())) &&
50                (this.deleted == that.isDeleted());
51                         
52     }
53     
54     public String JavaDoc toString()
55     {
56         StringBuilder JavaDoc sb = new StringBuilder JavaDoc(50);
57         sb.append("NodeStatus")
58           .append("[key=").append(key)
59           .append(", txn=").append(changeTxnId)
60           .append(", deleted=").append(deleted)
61           .append("]");
62         return sb.toString();
63     }
64     
65     public NodeKey getKey()
66     {
67         return key;
68     }
69
70     public void setKey(NodeKey key)
71     {
72         this.key = key;
73     }
74
75     public String JavaDoc getChangeTxnId()
76     {
77         return changeTxnId;
78     }
79
80     public void setChangeTxnId(String JavaDoc txnId)
81     {
82         this.changeTxnId = txnId;
83     }
84
85     public boolean isDeleted()
86     {
87         return deleted;
88     }
89
90     public void setDeleted(boolean deleted)
91     {
92         this.deleted = deleted;
93     }
94 }
95
Popular Tags