01: package org.claros.intouch.calendar.models;
02:
03: import java.sql.Timestamp;
04:
05: /**
06: * @author Umut Gokbayrak
07: */
08: public class CalendarObjectWrap extends CalendarObject implements
09: Comparable, Cloneable {
10: private Timestamp occuringDate;
11:
12: /**
13: *
14: */
15: public CalendarObjectWrap(CalendarObject item) {
16: if (item != null) {
17: this .setDescription(item.getDescription());
18: this .setId(item.getId());
19: this .setRecordDate(item.getRecordDate());
20: this .setEndDate(item.getEndDate());
21: this .setReminderDays(item.getReminderDays());
22: this .setRepeatType(item.getRepeatType());
23: this .setUsername(item.getUsername());
24: this .setColor(item.getColor());
25: this .setLocation(item.getLocation());
26: this .setReminderMethod(item.getReminderMethod());
27: this .setRemindedBefore(item.getRemindedBefore());
28: this .setLastDismissedAt(item.getLastDismissedAt());
29: }
30: }
31:
32: /* (non-Javadoc)
33: * @see java.lang.Comparable#compareTo(java.lang.Object)
34: */
35: public int compareTo(Object o) {
36: if (o == null) {
37: return -1;
38: } else {
39: CalendarObjectWrap app = (CalendarObjectWrap) o;
40: Timestamp occur = app.getOccuringDate();
41: if (occur.after(occuringDate)) {
42: return 1;
43: } else if (occur.equals(occuringDate)) {
44: return 0;
45: } else if (occur.before(occuringDate)) {
46: return -1;
47: }
48: }
49: return -1;
50: }
51:
52: /**
53: * @return
54: */
55: public Timestamp getOccuringDate() {
56: return occuringDate;
57: }
58:
59: /**
60: * @param timestamp
61: */
62: public void setOccuringDate(Timestamp timestamp) {
63: occuringDate = timestamp;
64: }
65:
66: public CalendarObject getUnwrapped() {
67: return (CalendarObject) this;
68: }
69: }
|