| 1 19 20 package org.lucane.applications.reminder.lookup.calendar; 21 22 import java.awt.*; 23 import java.io.*; 24 import java.util.*; 25 26 public class Event implements Serializable 27 { 28 public static final int RECUR_NONE = 0; 30 public static final int RECUR_DAY = 1; 31 public static final int RECUR_WEEK = 2; 32 public static final int RECUR_MONTH = 3; 33 34 private int id; 36 private String type; 37 private Color color; 38 private String title; 39 private String organizer; 40 private boolean isPublic; 41 private long start; 42 private long end; 43 private int recurrence; 44 private String description; 45 46 private ArrayList attendees; 47 private ArrayList resources; 48 49 52 public Event(int id, String type, String title, String organizer, boolean isPublic, 53 long start, long end, int recurence, String description) 54 { 55 this.id = id; 56 this.type = type; 57 this.title = title; 58 this.organizer = organizer; 59 this.isPublic = isPublic; 60 this.start = start; 61 this.end = end; 62 this.recurrence = recurence; 63 this.description = description; 64 this.attendees = new ArrayList(); 65 this.resources = new ArrayList(); 66 this.color = Color.BLUE; 67 } 68 69 public void setId(int id) 71 { 72 this.id = id; 73 } 74 75 public void setAttendees(ArrayList attendees) 76 { 77 this.attendees = attendees; 78 } 79 80 public void addAttendee(String user, boolean mandatory, int status) 81 { 82 this.attendees.add(new Attendee(user, mandatory, status)); 83 } 84 85 public Attendee getAttendee(String user) 86 { 87 Iterator i = getAttendees(); 88 while(i.hasNext()) 89 { 90 Attendee a = (Attendee)i.next(); 91 if(a.getUser().equals(user)) 92 return a; 93 } 94 95 return null; 96 } 97 98 public void setResources(ArrayList resources) 99 { 100 this.resources = resources; 101 } 102 103 public void addResource(String resource) 104 { 105 this.resources.add(resource); 106 } 107 108 public void setColor(Color color) 109 { 110 this.color = color; 111 } 112 113 public int getId() 115 { 116 return this.id; 117 } 118 119 public String getType() 120 { 121 return this.type; 122 } 123 124 public String getOrganizer() 125 { 126 return this.organizer; 127 } 128 129 public boolean isPublic() 130 { 131 return this.isPublic; 132 } 133 134 public long getStartTime() 135 { 136 return this.start; 137 } 138 139 public long getEndTime() 140 { 141 return this.end; 142 } 143 144 public int getRecurrence() 145 { 146 return this.recurrence; 147 } 148 149 public String getDescription() 150 { 151 return this.description; 152 } 153 154 public Iterator getAttendees() 155 { 156 return this.attendees.iterator(); 157 } 158 159 public ArrayList getAttendeeList() 160 { 161 return this.attendees; 162 } 163 164 public Iterator getResources() 165 { 166 return this.resources.iterator(); 167 } 168 169 170 172 public String getTitle() 173 { 174 return title; 175 } 176 177 public int getStartHour() 178 { 179 Calendar c = Calendar.getInstance(); 180 c.setTime(new Date(start)); 181 return c.get(Calendar.HOUR_OF_DAY); 182 } 183 184 public int getStartMinute() 185 { 186 Calendar c = Calendar.getInstance(); 187 c.setTime(new Date(start)); 188 return c.get(Calendar.MINUTE); 189 } 190 191 public int getEndHour() 192 { 193 Calendar c = Calendar.getInstance(); 194 c.setTime(new Date(end)); 195 return c.get(Calendar.HOUR_OF_DAY); 196 } 197 198 public int getEndMinute() 199 { 200 Calendar c = Calendar.getInstance(); 201 c.setTime(new Date(end)); 202 return c.get(Calendar.MINUTE); 203 } 204 205 public Color getColor() 206 { 207 return this.color; 208 } 209 210 public String toString() 211 { 212 return "[" + id + ": " + title +"]"; 213 } 214 } | Popular Tags |