1 19 package org.lucane.applications.forum.model; 20 21 import java.io.Serializable ; 22 import java.util.Date ; 23 24 public class ForumMessage implements Serializable 25 { 26 private int id; 27 private int idref; 28 private String title; 29 private Date date; 30 private String author; 31 private String content; 32 private boolean visible; 33 34 public ForumMessage(int id, int idref, String title, Date date, 35 String author, String content, boolean visible) 36 { 37 this.id = id; 38 this.idref = idref; 39 this.title = title; 40 this.date = date; 41 this.author = author; 42 this.content = content.replaceAll(" \\/\\>", ">"); 43 this.visible = visible; 44 } 45 46 public ForumMessage(int idref, String title, String author, String content) 47 { 48 this(-1, idref, title, new Date (), author, content, true); 49 } 50 51 public String toString() 52 { 53 return title; 54 } 55 56 public boolean equals(Object o) 57 { 58 if(o instanceof ForumMessage) 59 { 60 ForumMessage fm = (ForumMessage)o; 61 return fm.title.equals(title) && fm.date.equals(date) && fm.author.equals(author); 62 } 63 64 return false; 65 } 66 67 public int hashCode() 68 { 69 return title.hashCode() + date.hashCode() + author.hashCode(); 70 } 71 72 75 public String getAuthor() { 76 return author; 77 } 78 79 82 public String getContent() { 83 return content; 84 } 85 86 89 public Date getDate() { 90 return date; 91 } 92 93 96 public int getId() { 97 return id; 98 } 99 100 103 public int getIdRef() { 104 return idref; 105 } 106 107 110 public String getTitle() { 111 return title; 112 } 113 114 public boolean isVisible() 115 { 116 return visible; 117 } 118 119 public void setVisible(boolean value) 120 { 121 this.visible = value; 122 } 123 } 124 | Popular Tags |