KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > javabb > vo > Post


1 package org.javabb.vo;
2
3 import java.io.Serializable JavaDoc;
4 import java.util.Date JavaDoc;
5
6 import org.apache.commons.lang.builder.EqualsBuilder;
7 import org.apache.commons.lang.builder.HashCodeBuilder;
8 import org.apache.commons.lang.builder.ToStringBuilder;
9
10 /*
11  * Copyright 2004 JavaFree.org
12  *
13  * Licensed under the Apache License, Version 2.0 (the "License");
14  * you may not use this file except in compliance with the License.
15  * You may obtain a copy of the License at
16  *
17  * http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */

25
26 /**
27  * $Id: Post.java,v 1.14.6.1.2.3 2006/04/17 17:46:59 daltoncamargo Exp $
28  * @author Dalton Camargo - <a HREF="mailto:dalton@javabb.org">dalton@javabb.org </a> <br>
29  * @author Ronald Tetsuo Miura
30  */

31 public class Post extends VOObject implements Serializable JavaDoc {
32
33     /** nullable persistent field */
34     private Date JavaDoc postDate;
35
36     /** nullable persistent field */
37     private String JavaDoc subject;
38
39     /** nullable persistent field */
40     private String JavaDoc postBody;
41
42     /** persistent field */
43     private User user;
44
45     /** persistent field */
46     private Topic topic;
47
48     /** persistent field */
49     private Integer JavaDoc sig;
50
51     /** nullable persistent field */
52     private String JavaDoc ip;
53
54     /** persistent field */
55     private Integer JavaDoc post_state;
56
57     /** */
58     private boolean acceptHTML = false;
59
60     /** */
61     private boolean acceptBBCode = true;
62
63     /** */
64     private boolean showSignature = true;
65
66     /**
67      * Full constructor.
68      * @param idPost
69      * @param postDate
70      * @param subject
71      * @param postBody
72      * @param user
73      * @param topic
74      */

75     public Post(Long JavaDoc idPost, Date JavaDoc postDate, String JavaDoc subject, String JavaDoc postBody, User user,
76         Topic topic) {
77         setId(idPost);
78         this.postDate = postDate;
79         this.subject = subject;
80         this.postBody = postBody;
81         this.user = user;
82         this.topic = topic;
83     }
84     
85     
86     
87     
88     public Post(Long JavaDoc topicId, Integer JavaDoc pageLastPost, Long JavaDoc postId, String JavaDoc titleTopic,
89             Long JavaDoc forumId, String JavaDoc forumName, Date JavaDoc postDate, Long JavaDoc userId, String JavaDoc userName,
90             Integer JavaDoc replies, Integer JavaDoc views){
91         
92         Topic topic = new Topic();
93         topic.setId(topicId);
94         topic.setPageLastPost(pageLastPost);
95         topic.setTitleTopic(titleTopic);
96         topic.setRespostas(replies);
97         topic.setVisualizacoes(views);
98         
99         Forum forum = new Forum();
100         forum.setId(forumId);
101         forum.setNome(forumName);
102         
103         topic.setForum(forum);
104         this.setTopic(topic);
105         
106         User user = new User();
107         user.setIdUser(userId);
108         user.setUser(userName);
109         this.setUser(user);
110         
111         this.setIdPost(postId);
112         this.setPostDate(postDate);
113         
114     }
115     
116     
117     
118     /**
119      * default constructor.
120      */

121     public Post() {
122         // do nothing...
123
}
124
125     public Post(Long JavaDoc id) {
126         setIdPost(id);
127     }
128     
129     /**
130      * Minimal constructor.
131      * @param id
132      * @param user
133      * @param topic
134      */

135     public Post(Long JavaDoc id, User user, Topic topic) {
136         setId(id);
137         this.user = user;
138         this.topic = topic;
139     }
140
141     /**
142      * @return idPost
143      */

144     public Long JavaDoc getIdPost() {
145         return getId();
146     }
147
148     /**
149      * @param idPost
150      */

151     public void setIdPost(Long JavaDoc idPost) {
152         this.setId(idPost);
153     }
154
155     /**
156      * @return postDate
157      */

158     public Date JavaDoc getPostDate() {
159         return this.postDate;
160     }
161
162     /**
163      * @param postDate
164      */

165     public void setPostDate(Date JavaDoc postDate) {
166         this.postDate = postDate;
167     }
168
169     /**
170      * @return subject
171      */

172     public String JavaDoc getSubject() {
173         return this.subject;
174     }
175
176     /**
177      * @param subject
178      */

179     public void setSubject(String JavaDoc subject) {
180         this.subject = subject;
181     }
182
183     /**
184      * @return post body
185      */

186     public String JavaDoc getPostBody() {
187         return this.postBody;
188     }
189
190     /**
191      * @param postBody
192      */

193     public void setPostBody(String JavaDoc postBody) {
194         this.postBody = postBody;
195     }
196
197     /**
198      * @return users portal
199      */

200     public User getUser() {
201         return this.user;
202     }
203
204     /**
205      * @param user
206      */

207     public void setUser(User user) {
208         this.user = user;
209     }
210
211     /**
212      * @return topic
213      */

214     public Topic getTopic() {
215         return this.topic;
216     }
217
218     /**
219      * @param topic
220      */

221     public void setTopic(Topic topic) {
222         this.topic = topic;
223     }
224
225     /**
226      * @return acceptBBCode
227      */

228     public boolean getAcceptBBCode() {
229         return acceptBBCode;
230     }
231
232     /**
233      * @param acceptBBCode the new acceptBBCode value
234      */

235     public void setAcceptBBCode(boolean acceptBBCode) {
236         this.acceptBBCode = acceptBBCode;
237     }
238
239     /**
240      * @return acceptHTML
241      */

242     public boolean getAcceptHTML() {
243         return acceptHTML;
244     }
245
246     /**
247      * @param acceptHTML the new acceptHTML value
248      */

249     public void setHTMLAccepted(boolean acceptHTML) {
250         this.acceptHTML = acceptHTML;
251     }
252
253     /**
254      * @return signatureShown
255      */

256     public boolean getShowSignature() {
257         return showSignature;
258     }
259
260     /**
261      * @param showSignature the new showSignature value
262      */

263     public void setShowSignature(boolean showSignature) {
264         this.showSignature = showSignature;
265     }
266
267     /**
268      * @see java.lang.Object#toString()
269      */

270     public String JavaDoc toString() {
271         return new ToStringBuilder(this).append("idPost", getIdPost()).toString();
272     }
273
274     /**
275      * @see java.lang.Object#equals(java.lang.Object)
276      */

277     public boolean equals(Object JavaDoc other) {
278         if (!(other instanceof Post)) {
279             return false;
280         }
281
282         Post castOther = (Post) other;
283
284         return new EqualsBuilder().append(this.getIdPost(), castOther.getIdPost()).isEquals();
285     }
286
287     /**
288      * @see java.lang.Object#hashCode()
289      */

290     public int hashCode() {
291         return new HashCodeBuilder().append(getIdPost()).toHashCode();
292     }
293
294
295     /**
296      * @return Returns the sig.
297      */

298     public Integer JavaDoc getSig() {
299         return sig;
300     }
301
302     /**
303      * @param sig The sig to set.
304      */

305     public void setSig(Integer JavaDoc sig) {
306         this.sig = sig;
307     }
308
309     /**
310      * @return Returns the ip.
311      */

312     public String JavaDoc getIp() {
313         return ip;
314     }
315
316     /**
317      * @param ip The ip to set.
318      */

319     public void setIp(String JavaDoc ip) {
320         this.ip = ip;
321     }
322
323     /**
324      * @return Returns the post_state.
325      */

326     public Integer JavaDoc getPost_state() {
327         return post_state;
328     }
329
330     /**
331      * @param post_state The post_state to set.
332      */

333     public void setPost_state(Integer JavaDoc post_state) {
334         this.post_state = post_state;
335     }
336 }
337
Popular Tags