KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > roller > pojos > CommentData


1 package org.roller.pojos;
2
3 import org.roller.util.PojoUtil;
4
5 /**
6  * Weblogentry Comment bean.
7  * @author Lance Lavandowska
8  *
9  * @ejb:bean name="CommentData"
10  * @struts.form include-all="true"
11  *
12  * @hibernate.class table="comment"
13  * hibernate.jcs-cache usage="read-write"
14  */

15 public class CommentData extends org.roller.pojos.PersistentObject
16     implements java.io.Serializable JavaDoc
17 {
18     static final long serialVersionUID = -6668122596726478462L;
19     protected java.lang.String JavaDoc id;
20     protected java.lang.String JavaDoc name;
21     protected java.lang.String JavaDoc email;
22     protected java.lang.String JavaDoc url;
23     protected java.lang.String JavaDoc content;
24     protected java.sql.Timestamp JavaDoc postTime;
25     protected WeblogEntryData mWeblogEntry;
26     protected Boolean JavaDoc spam;
27     protected Boolean JavaDoc notify;
28     protected String JavaDoc remoteHost;
29
30     public CommentData()
31     {
32         spam = Boolean.FALSE;
33     }
34
35     public CommentData(java.lang.String JavaDoc id, WeblogEntryData entry,
36                        java.lang.String JavaDoc name, java.lang.String JavaDoc email,
37                        java.lang.String JavaDoc url, java.lang.String JavaDoc content,
38                        java.sql.Timestamp JavaDoc postTime,
39                        Boolean JavaDoc spam, Boolean JavaDoc notify)
40     {
41         this.id = id;
42         this.name = name;
43         this.email = email;
44         this.url = url;
45         this.content = content;
46         this.postTime = postTime;
47         this.spam = spam;
48         this.notify = notify;
49
50         mWeblogEntry = entry;
51     }
52
53     public CommentData(CommentData otherData)
54     {
55         this.id = otherData.id;
56         this.name = otherData.name;
57         this.email = otherData.email;
58         this.url = otherData.url;
59         this.content = otherData.content;
60         this.postTime = otherData.postTime;
61         this.spam = otherData.spam;
62         this.notify = otherData.notify;
63         
64         mWeblogEntry = otherData.mWeblogEntry;
65     }
66
67     /**
68      * @ejb:persistent-field
69      * @hibernate.id column="id" type="string"
70      * generator-class="uuid.hex" unsaved-value="null"
71      */

72     public java.lang.String JavaDoc getId()
73     {
74         return this.id;
75     }
76
77     /** @ejb:persistent-field */
78     public void setId(java.lang.String JavaDoc id)
79     {
80         this.id = id;
81     }
82
83     /**
84      * @ejb:persistent-field
85      * @hibernate.many-to-one column="entryid" cascade="none" not-null="true"
86      */

87     public WeblogEntryData getWeblogEntry()
88     {
89         return mWeblogEntry;
90     }
91
92     /** @ejb:persistent-field */
93     public void setWeblogEntry(WeblogEntryData entry)
94     {
95         mWeblogEntry = entry;
96     }
97
98     /**
99      * @ejb:persistent-field
100      * @hibernate.property column="name" non-null="true" unique="false"
101      */

102     public java.lang.String JavaDoc getName()
103     {
104         return this.name;
105     }
106
107     /** @ejb:persistent-field */
108     public void setName(java.lang.String JavaDoc name)
109     {
110         this.name = name;
111     }
112
113     /**
114      * Email
115      * @ejb:persistent-field
116      * @hibernate.property column="email" non-null="true" unique="false"
117      */

118     public java.lang.String JavaDoc getEmail()
119     {
120         return this.email;
121     }
122
123     /** @ejb:persistent-field */
124     public void setEmail(java.lang.String JavaDoc email)
125     {
126         this.email = email;
127     }
128
129     /**
130      * @ejb:persistent-field
131      * @hibernate.property column="url" non-null="true" unique="false"
132      */

133     public java.lang.String JavaDoc getUrl()
134     {
135         return this.url;
136     }
137
138     /** @ejb:persistent-field */
139     public void setUrl(java.lang.String JavaDoc url)
140     {
141         this.url = url;
142     }
143
144     /**
145      * @ejb:persistent-field
146      * @hibernate.property column="content" non-null="true" unique="false"
147      */

148     public java.lang.String JavaDoc getContent()
149     {
150         return this.content;
151     }
152
153     /** @ejb:persistent-field */
154     public void setContent(java.lang.String JavaDoc content)
155     {
156         this.content = content;
157     }
158
159     /**
160      * @ejb:persistent-field
161      * @hibernate.property column="posttime" non-null="true" unique="false"
162      */

163     public java.sql.Timestamp JavaDoc getPostTime()
164     {
165         return this.postTime;
166     }
167
168     /** @ejb:persistent-field */
169     public void setPostTime(java.sql.Timestamp JavaDoc postTime)
170     {
171         this.postTime = postTime;
172     }
173
174     /**
175      * @ejb:persistent-field
176      * @hibernate.property column="spam" non-null="false" unique="false"
177      */

178     public Boolean JavaDoc getSpam()
179     {
180         return this.spam;
181     }
182
183     /** @ejb:persistent-field */
184     public void setSpam(Boolean JavaDoc spam)
185     {
186         this.spam = spam;
187     }
188
189     /**
190      * @ejb:persistent-field
191      * @hibernate.property column="notify" non-null="false" unique="false"
192      */

193     public Boolean JavaDoc getNotify()
194     {
195         return this.notify;
196     }
197
198     /** @ejb:persistent-field */
199     public void setNotify(Boolean JavaDoc notify)
200     {
201         this.notify = notify;
202     }
203
204     /**
205      * @ejb:persistent-field
206      */

207     public void setRemoteHost(String JavaDoc remoteHost) {
208         this.remoteHost = remoteHost;
209     }
210     
211     /**
212      * @ejb:persistent-field
213      * @hibernate.property column="remotehost" non-null="true" unique="false"
214      */

215     public String JavaDoc getRemoteHost() {
216         return this.remoteHost;
217     }
218
219     public String JavaDoc toString()
220     {
221         StringBuffer JavaDoc str = new StringBuffer JavaDoc("{");
222
223         str.append("id=" + id + " " +
224                    "name=" + name + " " +
225                    "email=" + email + " " +
226                    "url=" + url + " " +
227                    "content=" + content + " " +
228                    "postTime=" + postTime + " " +
229                    "spam=" + spam +
230                    "notify=" + notify);
231         str.append('}');
232
233         return (str.toString());
234     }
235
236     public boolean equals(Object JavaDoc pOther)
237     {
238         if (pOther instanceof CommentData)
239         {
240             CommentData lTest = (CommentData) pOther;
241             boolean lEquals = true;
242
243             lEquals = PojoUtil.equals(lEquals, this.id, lTest.id);
244             lEquals = PojoUtil.equals(lEquals, this.mWeblogEntry, lTest.mWeblogEntry);
245             lEquals = PojoUtil.equals(lEquals, this.name, lTest.name);
246             lEquals = PojoUtil.equals(lEquals, this.email, lTest.email);
247             lEquals = PojoUtil.equals(lEquals, this.url, lTest.url);
248             lEquals = PojoUtil.equals(lEquals, this.content, lTest.content);
249             lEquals = PojoUtil.equals(lEquals, this.postTime, lTest.postTime);
250             lEquals = PojoUtil.equals(lEquals, this.spam, lTest.spam);
251             lEquals = PojoUtil.equals(lEquals, this.notify, lTest.notify);
252
253             return lEquals;
254         }
255         else
256         {
257             return false;
258         }
259     }
260
261     public int hashCode()
262     {
263         int result = 17;
264         result = PojoUtil.addHashCode(result, this.id);
265         result = PojoUtil.addHashCode(result, this.mWeblogEntry);
266         result = PojoUtil.addHashCode(result, this.name);
267         result = PojoUtil.addHashCode(result, this.email);
268         result = PojoUtil.addHashCode(result, this.url);
269         result = PojoUtil.addHashCode(result, this.content);
270         result = PojoUtil.addHashCode(result, this.postTime);
271         result = PojoUtil.addHashCode(result, this.spam);
272         result = PojoUtil.addHashCode(result, this.notify);
273
274         return result;
275     }
276
277     /**
278      * Setter is needed in RollerImpl.storePersistentObject()
279      */

280     public void setData(org.roller.pojos.PersistentObject otherData)
281     {
282         CommentData otherComment = (CommentData) otherData;
283         this.id = otherComment.id;
284         this.mWeblogEntry = otherComment.mWeblogEntry;
285         this.name = otherComment.name;
286         this.email = otherComment.email;
287         this.url = otherComment.url;
288         this.content = otherComment.content;
289         this.postTime = otherComment.postTime;
290         this.spam = otherComment.spam;
291         this.notify = otherComment.notify;
292     }
293
294 }
Popular Tags