1 43 package net.jforum.entities; 44 45 import java.io.Serializable ; 46 import java.util.Date ; 47 48 import net.jforum.view.forum.common.ViewCommon; 49 50 56 public class Post implements Serializable 57 { 58 private int id; 59 private int topicId; 60 private int forumId; 61 private String formatedTime; 62 private int userId; 63 private Date time; 64 private String text; 65 private String subject; 66 private String postUsername; 67 private boolean bbCodeEnabled = true; 68 private boolean htmlEnabled = true; 69 private boolean smiliesEnabled = true; 70 private boolean signatureEnabled = true; 71 private Date editTime; 72 private int editCount; 73 private String userIp; 74 private boolean canEdit; 75 private KarmaStatus karma; 76 private boolean hasAttachments; 77 private boolean moderate; 78 79 public Post() { } 80 81 86 public Post(Post p) 87 { 88 this.setBbCodeEnabled(p.isBbCodeEnabled()); 89 this.setCanEdit(p.getCanEdit()); 90 this.setEditCount(p.getEditCount()); 91 this.setEditTime(p.getEditTime()); 92 this.setFormatedTime(p.getFormatedTime()); 93 this.setForumId(p.getForumId()); 94 this.setHtmlEnabled(p.isHtmlEnabled()); 95 this.setId(p.getId()); 96 this.setPostUsername(p.getPostUsername()); 97 this.setSignatureEnabled(p.isSignatureEnabled()); 98 this.setSmiliesEnabled(p.isSmiliesEnabled()); 99 this.setSubject(p.getSubject()); 100 this.setText(p.getText()); 101 this.setTime(p.getTime()); 102 this.setTopicId(p.getTopicId()); 103 this.setUserId(p.getUserId()); 104 this.setUserIp(p.getUserIp()); 105 this.setKarma(new KarmaStatus(p.getKarma())); 106 this.setModerate(p.isModerationNeeded()); 107 this.hasAttachments(p.hasAttachments()); 108 } 109 110 public void setModerate(boolean status) 111 { 112 this.moderate = status; 113 } 114 115 public boolean isModerate() 116 { 117 return this.isModerationNeeded(); 118 } 119 120 public boolean isModerationNeeded() 121 { 122 return this.moderate; 123 } 124 125 public KarmaStatus getKarma() 126 { 127 return this.karma; 128 } 129 130 public void setKarma(KarmaStatus karma) 131 { 132 this.karma = karma; 133 } 134 135 140 public boolean isBbCodeEnabled() { 141 return this.bbCodeEnabled; 142 } 143 144 149 public int getEditCount() { 150 return this.editCount; 151 } 152 153 158 public Date getEditTime() { 159 return this.editTime; 160 } 161 162 167 public int getForumId() { 168 return this.forumId; 169 } 170 171 176 public boolean isHtmlEnabled() { 177 return this.htmlEnabled; 178 } 179 180 185 public int getId() { 186 return this.id; 187 } 188 189 194 public String getPostUsername() { 195 return this.postUsername; 196 } 197 198 203 public boolean isSignatureEnabled() { 204 return this.signatureEnabled; 205 } 206 207 212 public boolean isSmiliesEnabled() { 213 return this.smiliesEnabled; 214 } 215 216 221 public Date getTime() { 222 return this.time; 223 } 224 225 230 public int getTopicId() { 231 return this.topicId; 232 } 233 234 239 public int getUserId() { 240 return this.userId; 241 } 242 243 248 public String getUserIp() { 249 return this.userIp; 250 } 251 256 public void setBbCodeEnabled(boolean bbCodeEnabled) { 257 this.bbCodeEnabled = bbCodeEnabled; 258 } 259 260 265 public void setEditCount(int editCount) { 266 this.editCount = editCount; 267 } 268 269 274 public void setEditTime(Date editTime) { 275 this.editTime = editTime; 276 } 277 278 283 public void setForumId(int forumId) { 284 this.forumId = forumId; 285 } 286 287 292 public void setHtmlEnabled(boolean htmlEnabled) { 293 this.htmlEnabled = htmlEnabled; 294 } 295 296 301 public void setId(int id) { 302 this.id = id; 303 } 304 305 310 public void setPostUsername(String postUsername) { 311 this.postUsername = postUsername; 312 } 313 314 319 public void setSignatureEnabled(boolean signatureEnabled) { 320 this.signatureEnabled = signatureEnabled; 321 } 322 323 328 public void setSmiliesEnabled(boolean smiliesEnabled) { 329 this.smiliesEnabled = smiliesEnabled; 330 } 331 332 337 public void setTime(Date time) { 338 this.time = time; 339 } 340 341 public void setFormatedTime(String t) 342 { 343 this.formatedTime = t; 344 } 345 346 public String getFormatedTime() 347 { 348 if (this.formatedTime == null && this.time != null) { 349 this.formatedTime = ViewCommon.formatDate(this.time); 350 } 351 352 return this.formatedTime; 353 } 354 355 360 public void setTopicId(int topicId) { 361 this.topicId = topicId; 362 } 363 364 369 public void setUserId(int userId) { 370 this.userId = userId; 371 } 372 373 378 public String getText() { 379 return this.text; 380 } 381 382 387 public void setText(String text) { 388 this.text = text; 389 } 390 391 396 public String getSubject() { 397 return this.subject; 398 } 399 400 405 public void setSubject(String subject) { 406 this.subject = subject; 407 } 408 409 414 public void setUserIp(String userIp) { 415 this.userIp = userIp; 416 } 417 public boolean getCanEdit() { 418 return this.canEdit; 419 } 420 421 public void setCanEdit(boolean canEdit) { 422 this.canEdit = canEdit; 423 } 424 425 428 public boolean hasAttachments() 429 { 430 return this.hasAttachments; 431 } 432 433 436 public void hasAttachments(boolean hasAttachments) 437 { 438 this.hasAttachments = hasAttachments; 439 } 440 441 444 public boolean equals(Object o) 445 { 446 if (!(o instanceof Post)) { 447 return false; 448 } 449 450 return ((Post)o).getId() == this.id; 451 } 452 453 456 public int hashCode() 457 { 458 return this.id; 459 } 460 } 461 | Popular Tags |