1 package org.javabb.vo; 2 3 import java.io.Serializable ; 4 import java.util.Date ; 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 25 26 31 public class Post extends VOObject implements Serializable { 32 33 34 private Date postDate; 35 36 37 private String subject; 38 39 40 private String postBody; 41 42 43 private User user; 44 45 46 private Topic topic; 47 48 49 private Integer sig; 50 51 52 private String ip; 53 54 55 private Integer 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 75 public Post(Long idPost, Date postDate, String subject, String 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 topicId, Integer pageLastPost, Long postId, String titleTopic, 89 Long forumId, String forumName, Date postDate, Long userId, String userName, 90 Integer replies, Integer 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 121 public Post() { 122 } 124 125 public Post(Long id) { 126 setIdPost(id); 127 } 128 129 135 public Post(Long id, User user, Topic topic) { 136 setId(id); 137 this.user = user; 138 this.topic = topic; 139 } 140 141 144 public Long getIdPost() { 145 return getId(); 146 } 147 148 151 public void setIdPost(Long idPost) { 152 this.setId(idPost); 153 } 154 155 158 public Date getPostDate() { 159 return this.postDate; 160 } 161 162 165 public void setPostDate(Date postDate) { 166 this.postDate = postDate; 167 } 168 169 172 public String getSubject() { 173 return this.subject; 174 } 175 176 179 public void setSubject(String subject) { 180 this.subject = subject; 181 } 182 183 186 public String getPostBody() { 187 return this.postBody; 188 } 189 190 193 public void setPostBody(String postBody) { 194 this.postBody = postBody; 195 } 196 197 200 public User getUser() { 201 return this.user; 202 } 203 204 207 public void setUser(User user) { 208 this.user = user; 209 } 210 211 214 public Topic getTopic() { 215 return this.topic; 216 } 217 218 221 public void setTopic(Topic topic) { 222 this.topic = topic; 223 } 224 225 228 public boolean getAcceptBBCode() { 229 return acceptBBCode; 230 } 231 232 235 public void setAcceptBBCode(boolean acceptBBCode) { 236 this.acceptBBCode = acceptBBCode; 237 } 238 239 242 public boolean getAcceptHTML() { 243 return acceptHTML; 244 } 245 246 249 public void setHTMLAccepted(boolean acceptHTML) { 250 this.acceptHTML = acceptHTML; 251 } 252 253 256 public boolean getShowSignature() { 257 return showSignature; 258 } 259 260 263 public void setShowSignature(boolean showSignature) { 264 this.showSignature = showSignature; 265 } 266 267 270 public String toString() { 271 return new ToStringBuilder(this).append("idPost", getIdPost()).toString(); 272 } 273 274 277 public boolean equals(Object 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 290 public int hashCode() { 291 return new HashCodeBuilder().append(getIdPost()).toHashCode(); 292 } 293 294 295 298 public Integer getSig() { 299 return sig; 300 } 301 302 305 public void setSig(Integer sig) { 306 this.sig = sig; 307 } 308 309 312 public String getIp() { 313 return ip; 314 } 315 316 319 public void setIp(String ip) { 320 this.ip = ip; 321 } 322 323 326 public Integer getPost_state() { 327 return post_state; 328 } 329 330 333 public void setPost_state(Integer post_state) { 334 this.post_state = post_state; 335 } 336 } 337 | Popular Tags |