| 1 19 package org.lucane.applications.notes; 20 21 import java.io.Serializable ; 22 import java.text.DateFormat ; 23 import java.util.*; 24 25 import org.lucane.client.Client; 26 27 public class Comment implements Serializable  28 { 29 private String id; 31 private String noteId; 32 33 private String author; 34 private String title; 35 private String content; 36 37 private Date creationDate; 38 39 43 public Comment(Note note, String author, String title, String content) 44 { 45 this.id = null; 46 this.noteId = note.getId(); 47 48 this.author = author; 49 this.title = title; 50 this.content = content.replaceAll(" \\/\\>", ">"); 51 52 this.creationDate = new Date(); 53 } 54 55 59 protected Comment(String id, String noteId, String author, String title, String content, String date) 60 { 61 this.id = id; 62 this.noteId = noteId; 63 64 this.author = author; 65 this.title = title; 66 this.content = content.replaceAll(" \\/\\>", ">"); 67 68 this.creationDate = new Date(Long.parseLong(date)); 69 } 70 71 public void setId(String id) 73 { 74 this.id = id; 75 } 76 77 public String getId() 78 { 79 return this.id; 80 } 81 82 public String getNoteId() 83 { 84 return this.noteId; 85 } 86 87 public String getAuthor() 88 { 89 return this.author; 90 } 91 92 public String getTitle() 93 { 94 return this.title; 95 } 96 97 public String getContent() 98 { 99 return this.content; 100 } 101 102 public Date getCreationDate() 103 { 104 return this.creationDate; 105 } 106 107 public String toString() 108 { 109 Locale locale = new Locale(Client.getInstance().getConfig().getLanguage()); 110 DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, locale); 111 return this.author + " - " + this.title + " - " + df.format(this.creationDate); 112 } 113 } 114 | Popular Tags |