1 package org.columba.calendar.model; 19 20 import java.net.URL ; 21 import java.util.Calendar ; 22 import java.util.Iterator ; 23 24 import org.columba.calendar.base.UUIDGenerator; 25 import org.columba.calendar.model.api.IEvent; 26 import org.columba.calendar.model.api.IRecurrence; 27 28 public class Event extends Component implements IEvent { 29 30 private Calendar dtStart; 31 32 private Calendar dtEnd; 33 34 private String transsp; 35 36 private String summary; 37 38 private String description; 39 40 private String location; 41 42 private String priority; 43 44 private String eventClass; 45 46 private String status; 47 48 private boolean allDayEvent; 49 50 private IRecurrence recurrence; 51 52 private URL url; 53 54 private CategoryList categoryList = new CategoryList(); 55 56 public Event() { 57 super(TYPE.EVENT); 58 59 dtStart = Calendar.getInstance(); 60 dtEnd = Calendar.getInstance(); 61 } 62 63 public Event(String id) { 64 super(id, TYPE.EVENT); 65 66 dtStart = Calendar.getInstance(); 67 dtEnd = Calendar.getInstance(); 68 } 69 70 public Event(Calendar dtStart, Calendar dtEnd, String summary) { 71 super(TYPE.EVENT); 72 73 if (dtStart == null) 74 throw new IllegalArgumentException ("dtStart == null"); 75 76 if (dtEnd == null) 77 throw new IllegalArgumentException ("dtEnd == null"); 78 79 if (summary == null) 80 throw new IllegalArgumentException ("summary == null"); 81 82 this.dtStart = dtStart; 83 this.dtEnd = dtEnd; 84 this.summary = summary; 85 86 } 87 88 public Calendar getDtEnd() { 89 return dtEnd; 90 } 91 92 public String getLocation() { 93 return location; 94 } 95 96 public String getTranssp() { 97 return transsp; 98 } 99 100 public Calendar getDtStart() { 101 return dtStart; 102 } 103 104 public String getPriority() { 105 return priority; 106 } 107 108 public String getSummary() { 109 return summary; 110 } 111 112 public String getDescription() { 113 return description; 114 } 115 116 public URL getUrl() { 117 return url; 118 } 119 120 public String getEventClass() { 121 return eventClass; 122 } 123 124 public void addCategory(String category) { 125 categoryList.addCategory(category); 126 } 127 128 public void removeCategory(String category) { 129 categoryList.removeCategory(category); 130 } 131 132 public Iterator <String > getCategoryIterator() { 133 return categoryList.getCategoryIterator(); 134 } 135 136 public String getCategories() { 137 return categoryList.getCategories(); 138 } 139 140 public void setCategories(String categories) { 141 categoryList.setCategories(categories); 142 } 143 144 148 public void setDescription(String description) { 149 this.description = description; 150 } 151 152 156 public void setDtEnd(Calendar dtEnd) { 157 this.dtEnd = dtEnd; 158 } 159 160 164 public void setDtStart(Calendar dtStart) { 165 this.dtStart = dtStart; 166 } 167 168 172 public void setEventClass(String eventClass) { 173 this.eventClass = eventClass; 174 } 175 176 180 public void setLocation(String location) { 181 this.location = location; 182 } 183 184 188 public void setPriority(String priority) { 189 this.priority = priority; 190 } 191 192 196 public void setSummary(String summary) { 197 this.summary = summary; 198 } 199 200 204 public void setTranssp(String transsp) { 205 this.transsp = transsp; 206 } 207 208 212 public void setUrl(URL url) { 213 this.url = url; 214 } 215 216 219 @Override 220 protected Object clone() throws CloneNotSupportedException { 221 Event event = new Event(new UUIDGenerator().newUUID()); 223 225 event.setDtStart(getDtStart()); 226 event.setDtEnd(getDtEnd()); 227 event.setDtStamp(getDtStamp()); 228 event.setSummary(getSummary()); 229 event.setLocation(getLocation()); 230 event.setCalendar(getCalendar()); 231 232 event.setAllDayEvent(isAllDayEvent()); 233 234 event.setRecurrence(getRecurrence()); 235 236 return event; 237 } 238 239 public boolean isAllDayEvent() { 240 return allDayEvent; 241 } 242 243 public void setAllDayEvent(boolean allDayEventFlag) { 244 this.allDayEvent = allDayEventFlag; 245 } 246 247 public IRecurrence getRecurrence() { 248 return recurrence; 249 } 250 251 public void setRecurrence(IRecurrence recurrence) { 252 this.recurrence = recurrence; 253 } 254 255 public String getStatus() { 256 return status; 257 } 258 259 public void setStatus(String status) { 260 this.status = status; 261 } 262 263 } 264 | Popular Tags |