View Javadoc

1   /*
2    * Created on 12.07.2004
3    *
4    * The DAO interface for persistent access to the ICal class
5    */
6   package net.stff.ical.persistance;
7   
8   import java.util.Date;
9   import java.util.List;
10  
11  import net.stff.ical.beans.ICal;
12  import net.stff.ical.beans.IEvent;
13  
14  import org.springframework.dao.DataAccessException;
15  
16  /***
17   * @author buntekuh
18   *
19   */
20  public interface ICalDAO {
21      
22      public static final int ALLEVENTS= 1;
23      public static final int TIMEDEVENTS= 2;
24      public static final int ALLDAYEVENTS= 3;
25      
26  
27  	/*** 
28  	 * Returns a List of all calendars
29  	 * @return 
30  	 */
31  	public List getCalendars(String user);
32  	
33  	/***
34  	 * Returns a List of all calendar keys
35  	 * @return 
36  	 */
37  	public List getCalendarNames(String user);
38  	
39  	/***
40  	 * adds a new calendar
41  	 * @param key The key name under which the calendar is to be registered
42  	 * @return
43  	 */
44  	public Long addCalendar(String key, String user);
45  	
46  	/***
47  	 *Adds an existing calendar.
48  	 * @param cal the calendar to add
49  	 * @return returns the ID under which the calendar was persisted, if it is persisted.
50  	 */
51  	public Long addCalendar(ICal cal);
52  	
53  	/***
54  	 * Returns a calendar specified by the respective key.
55  	 * @param key
56  	 * @return 
57  	 */
58  	public ICal getCalendar(String key, String user);
59  	
60  	/***
61  	 * Removes the Calendar specified by the key
62  	 * @param key The key name under which the calendar was registered
63  	 * @return The removed calendar or null if it was not found.
64  	 */
65  	public void removeCalendar(ICal cal);
66  
67  	/***
68  	 * Updates the Calendar specified by the key
69  	 * @param key The key name under which the calendar was registered
70  	 */
71  	public void updateCalendar(String key, String user);
72  
73  	/***
74  	 * Updates the Calendar specified
75  	 * @param cal The Calendar to update
76  	 */
77  	public void updateCalendar(ICal cal);
78  
79  	/***
80  	 * Returns a List of those events that start during the specified timespan. 
81  	 * @param start the start Date
82  	 * @param end the end Date
83  	 * @param which Discerns between Any event, timed events and allday events
84  	 * @return
85  	 */
86  	public List getEventsForPeriod(Date start, Date end, String user, int which);
87  	
88  	/***
89  	 * Returns the event from an calendar
90  	 * @param id
91  	 * @return
92  	 */
93  	public IEvent getEvent(String id);
94  	
95  	/***
96  	 * Removes the event from the persistent store.
97  	 * @param event the Event to remove
98  	 * @return
99  	 */
100 	public void removeEvent(IEvent event);
101 	/***
102 	 * Updates the event in the persistent store
103 	 * @param id
104 	 * @throws DataAccessException
105 	 */
106 	public void updateEvent(IEvent event);
107 }