1 package org.opensync.engine.server;
2
3
4 import java.io.*;
5 import java.util.*;
6
7 /***
8 * This class encapsulate the concept of an agenda in the OpenSync application
9 */
10
11 public class Agenda implements Serializable {
12
13 private boolean finish = false;
14
15 /***
16 * The name of the agenda
17 *
18 */
19 private String name;
20 /***
21 * The notification of the agenda
22 *
23 */
24 private Notification notification;
25 /***
26 * The tasks of the agenda
27 *
28 */
29 private Collection tasks = new ArrayList();
30 /***
31 * The schedules of the agenda
32 *
33 */
34 private Collection schedules = new ArrayList();
35
36 /***
37 * Construct an agenda object
38 *
39 */
40 public Agenda() {
41 }
42 /***
43 * Set the finish status of the agenda
44 *
45 * @param finish the finish status of the agenda
46 *
47 */
48 public void setFinish(boolean finish) {
49 this.finish = finish;
50 }
51 /***
52 * Get the finish status of the agenda
53 *
54 */
55 public boolean getFinish() {
56 return finish;
57 }
58 /***
59 * Set the name of the agenda
60 *
61 * @param name the name of the agenda
62 *
63 */
64 public void setName(String name) {
65 this.name = name;
66 }
67 /***
68 * Get the name of the agenda
69 *
70 */
71 public String getName() {
72 return name;
73 }
74 /***
75 * Set the notification of the agenda
76 *
77 * @param notification the notification of the agenda
78 *
79 */
80 public void setNotification(Notification notification) {
81 this.notification = notification;
82 }
83 /***
84 * Get the notification of the agenda
85 *
86 */
87 public Notification getNotification() {
88 return notification;
89 }
90 /***
91 * Get all the tasks of the agenda
92 *
93 */
94 public Collection getTasks() {
95 return tasks;
96 }
97 /***
98 * Add a task to the agenda
99 *
100 * @param task the task to add
101 *
102 */
103 public void addTask(Task task) {
104 task.setAgenda(this);
105 tasks.add(task);
106 }
107 /***
108 * Get all schedules of the agenda
109 *
110 */
111 public Collection getSchedules() {
112 return schedules;
113 }
114 /***
115 * Add a schedule to the agenda
116 *
117 * @param schedule the schedule to add
118 */
119 public void addSchedule(Schedule schedule) {
120 schedules.add(schedule);
121 }
122 /***
123 * @exception PastDateException
124 */
125
126 /***
127 * Use for debug only
128 *
129 */
130 public String toString(){
131 StringBuffer buffer = new StringBuffer();
132 buffer.append("Agenda{\n");
133 buffer.append("\tname : ").append(name).append("\n");
134 Iterator iterator;
135 if(schedules != null){
136 buffer.append("\tschedules :\n");
137 iterator = schedules.iterator();
138 while(iterator.hasNext()){
139 buffer.append(iterator.next().toString());
140 }
141 }
142 if(tasks != null){
143 buffer.append("\ttasks :\n");
144 iterator = tasks.iterator();
145 while(iterator.hasNext()){
146 buffer.append(iterator.next().toString());
147 }
148 }
149 buffer.append("}\n");
150 return buffer.toString();
151 }
152 }