1 43 package net.jforum.entities; 44 45 import java.io.Serializable ; 46 import java.util.Date ; 47 48 54 public class Topic implements Serializable 55 { 56 public static final int TYPE_NORMAL = 0; 57 public static final int TYPE_STICKY = 1; 58 public static final int TYPE_ANNOUNCE = 2; 59 60 public static final int STATUS_UNLOCKED = 0; 61 public static final int STATUS_LOCKED = 1; 62 63 private int id; 64 private int forumId; 65 private int totalViews; 66 private int totalReplies; 67 private int status; 68 private int type; 69 private int firstPostId; 70 private int lastPostId; 71 private int voteId; 72 73 private boolean read = true; 74 private boolean moderated; 75 private boolean isHot; 76 private boolean hasAttach; 77 private boolean paginate; 78 79 private String firstPostTime; 80 private String lastPostTime; 81 private String title; 82 83 private Date time; 84 private Date lastPostTimeInMillis; 85 86 private Double totalPages; 87 88 private User postedBy; 89 private User lastPostBy; 90 91 public Topic() {} 92 93 public Topic(int topicId) 94 { 95 this.id = topicId; 96 } 97 98 103 public int getFirstPostId() { 104 return this.firstPostId; 105 } 106 107 112 public int getId() { 113 return this.id; 114 } 115 116 121 public int getForumId() { 122 return this.forumId; 123 } 124 125 130 public int getLastPostId() { 131 return this.lastPostId; 132 } 133 134 139 public int getStatus() { 140 return this.status; 141 } 142 143 148 public Date getTime() { 149 return this.time; 150 } 151 152 public void setFirstPostTime(String d) { 153 this.firstPostTime = d; 154 } 155 156 public void setLastPostTime(String d) { 157 this.lastPostTime = d; 158 } 159 160 165 public String getTitle() { 166 return (this.title == null ? "" : this.title); 167 } 168 169 174 public int getTotalReplies() { 175 return this.totalReplies; 176 } 177 178 183 public int getTotalViews() { 184 return this.totalViews; 185 } 186 187 public User getPostedBy() { 188 return this.postedBy; 189 } 190 191 public User getLastPostBy() { 192 return this.lastPostBy; 193 } 194 195 200 public int getType() { 201 return this.type; 202 } 203 204 209 public boolean isVote() { 210 return this.voteId != 0; 211 } 212 213 218 public int getVoteId() { 219 return this.voteId; 220 } 221 222 227 public void setFirstPostId(int firstPostId) { 228 this.firstPostId = firstPostId; 229 } 230 231 236 public void setId(int id) { 237 this.id = id; 238 } 239 240 245 public void setForumId(int idForum) { 246 this.forumId = idForum; 247 } 248 249 254 public void setLastPostId(int lastPostId) { 255 this.lastPostId = lastPostId; 256 } 257 258 263 public void setStatus(int status) { 264 this.status = status; 265 } 266 267 272 public void setTime(Date time) { 273 this.time = time; 274 } 275 276 281 public void setTitle(String title) { 282 this.title = title; 283 } 284 285 290 public void setTotalReplies(int totalReplies) { 291 this.totalReplies = totalReplies; 292 } 293 294 299 public void setTotalViews(int totalViews) { 300 this.totalViews = totalViews; 301 } 302 303 308 public void setType(int type) { 309 this.type = type; 310 } 311 312 317 public void setVoteId(int voteId) { 318 this.voteId = voteId; 319 } 320 323 public boolean isModerated() { 324 return this.moderated; 325 } 326 327 330 public void setModerated(boolean b) { 331 this.moderated = b; 332 } 333 334 public void setPostedBy(User u) { 335 this.postedBy = u; 336 } 337 338 public void setLastPostBy(User u) { 339 this.lastPostBy = u; 340 } 341 342 public String getFirstPostTime() { 343 return this.firstPostTime; 344 } 345 346 public String getLastPostTime() { 347 return this.lastPostTime; 348 } 349 350 public void setRead(boolean read) { 351 this.read = read; 352 } 353 354 public boolean getRead() { 355 return this.read; 356 } 357 358 public void setLastPostDate(Date t) { 359 this.lastPostTimeInMillis = t; 360 } 361 362 public Date getLastPostDate() { 363 return this.lastPostTimeInMillis; 364 } 365 366 public void setPaginate(boolean paginate) { 367 this.paginate = paginate; 368 } 369 370 public boolean getPaginate() { 371 return this.paginate; 372 } 373 374 public void setTotalPages(Double total) { 375 this.totalPages = total; 376 } 377 378 public Double getTotalPages() { 379 return this.totalPages; 380 } 381 382 public void setHot(boolean hot) { 383 this.isHot = hot; 384 } 385 386 public boolean isHot() { 387 return this.isHot; 388 } 389 390 public void setHasAttach(boolean b) 391 { 392 this.hasAttach = b; 393 } 394 395 public boolean hasAttach() 396 { 397 return this.hasAttach; 398 } 399 400 403 public boolean equals(Object o) 404 { 405 if (!(o instanceof Topic)) { 406 return false; 407 } 408 409 return (((Topic)o).getId() == this.id); 410 } 411 414 public int hashCode() 415 { 416 return this.id; 417 } 418 419 422 public String toString() 423 { 424 return "[" + this.id + ", " + this.title + "]"; 425 } 426 } 427 | Popular Tags |