1 25 26 package com.j2biz.blogunity.pojo; 27 28 import java.io.Serializable ; 29 import java.util.Date ; 30 import java.util.Set ; 31 import java.util.TreeSet ; 32 33 import com.j2biz.blogunity.util.CommentComparator; 34 35 45 public class Comment implements Serializable { 46 47 50 private static final long serialVersionUID = 3258412850275168817L; 51 52 private Long id; 53 54 private String title; 55 56 private String rawTitle; 57 58 private String body; 59 60 private String rawBody; 61 62 private User author; 63 64 private String authorIP = "127.0.0.1"; 65 66 private Entry commentedEntry; 67 68 private Comment repliedComment; 69 70 private Date createTime = new Date (); 71 72 private Set answers = new TreeSet ( 73 new CommentComparator()); 74 75 private Userpic userpic; 76 77 80 public Comment() { 81 super(); 82 } 83 84 94 public Set getAnswers() { 95 return answers; 96 } 97 98 102 public void setAnswers(Set answers) { 103 this.answers = answers; 104 } 105 106 112 public User getAuthor() { 113 return author; 114 } 115 116 120 public void setAuthor(User author) { 121 this.author = author; 122 } 123 124 130 public String getBody() { 131 return body; 132 } 133 134 138 public void setBody(String body) { 139 this.body = body; 140 } 141 142 149 public String getRawBody() { 150 return rawBody; 151 } 152 153 157 public void setRawBody(String rawBody) { 158 this.rawBody = rawBody; 159 } 160 161 167 public Entry getCommentedEntry() { 168 return commentedEntry; 169 } 170 171 175 public void setCommentedEntry(Entry commentedEntry) { 176 this.commentedEntry = commentedEntry; 177 } 178 179 186 public Date getCreateTime() { 187 return createTime; 188 } 189 190 194 public void setCreateTime(Date createTime) { 195 this.createTime = createTime; 196 } 197 198 204 public Long getId() { 205 return id; 206 } 207 208 212 public void setId(Long id) { 213 this.id = id; 214 } 215 216 222 public Comment getRepliedComment() { 223 return repliedComment; 224 } 225 226 230 public void setRepliedComment(Comment repliedComment) { 231 this.repliedComment = repliedComment; 232 } 233 234 240 public String getTitle() { 241 return title; 242 } 243 244 248 public void setTitle(String title) { 249 this.title = title; 250 } 251 252 260 public String getRawTitle() { 261 return rawTitle; 262 } 263 264 268 public void setRawTitle(String rawTitle) { 269 this.rawTitle = rawTitle; 270 } 271 272 279 public String getAuthorIP() { 280 return authorIP; 281 } 282 283 287 public void setAuthorIP(String authorIP) { 288 this.authorIP = authorIP; 289 } 290 291 297 public Userpic getUserpic() { 298 return userpic; 299 } 300 301 305 public void setUserpic(Userpic userpic) { 306 this.userpic = userpic; 307 } 308 309 public int getLevel() { 310 if (getRepliedComment() != null) { 311 return getRepliedComment().getLevel() + 1; 312 } else 313 return 0; 314 } 315 316 } | Popular Tags |