01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/calendar/tags/sakai_2-4-1/calendar-api/api/src/java/org/sakaiproject/calendar/api/RecurrenceRule.java $
03: * $Id: RecurrenceRule.java 8050 2006-04-20 17:39:55Z ggolden@umich.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.calendar.api;
21:
22: import java.util.List;
23: import java.util.Stack;
24: import java.util.TimeZone;
25:
26: import org.sakaiproject.time.api.Time;
27: import org.sakaiproject.time.api.TimeRange;
28: import org.w3c.dom.Document;
29: import org.w3c.dom.Element;
30:
31: /**
32: * <p>RecurrenceRule is the interface for objects which add or remove multiple occurrences of timeranges.</p>
33: */
34: public interface RecurrenceRule {
35: /**
36: * Take values from this xml element
37: * @param el The xml element.
38: */
39: void set(Element el);
40:
41: /**
42: * Serialize the resource into XML, adding an element to the doc under the top of the stack element.
43: * @param doc The DOM doc to contain the XML (or null for a string return).
44: * @param stack The DOM elements, the top of which is the containing element of the new "resource" element.
45: * @return The newly added element.
46: */
47: Element toXml(Document doc, Stack stack);
48:
49: /**
50: * Return a List of all RecurrenceInstance objects generated by this rule within the given time range, based on the
51: * prototype first range, in time order.
52: * @param prototype The prototype first TimeRange.
53: * @param range A time range to limit the generated ranges.
54: * @return a List of RecurrenceInstance generated by this rule in this range.
55: */
56: List generateInstances(TimeRange prototype, TimeRange range,
57: TimeZone timeZone);
58:
59: /**
60: * Remove from the ranges list any RecurrenceInstance excluded by this rule.
61: * @param ranges The list (RecurrenceInstance) of ranges.
62: */
63: void excludeInstances(List ranges);
64:
65: /**
66: * Access a short text describing the rule's frequency.
67: * @return A frequency description.
68: */
69: String getFrequencyDescription();
70:
71: /**
72: * Access the end time for recurring events.
73: * @return The end time for recurring events.
74: */
75: Time getUntil();
76:
77: /**
78: * Access the number of times that this event should repeat.
79: * @return The number of times that this event should repeat.
80: */
81: int getCount();
82:
83: /**
84: * Access the number of natural frequency units between repeats.
85: * @return The number of natural frequency units between repeats.
86: */
87: int getInterval();
88: }
|