001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/calendar/tags/sakai_2-4-1/calendar-api/api/src/java/org/sakaiproject/calendar/api/CalendarEvent.java $
003: * $Id: CalendarEvent.java 13515 2006-08-11 16:19:13Z bkirschn@umich.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.calendar.api;
021:
022: import java.util.Collection;
023:
024: import org.sakaiproject.entity.api.AttachmentContainer;
025: import org.sakaiproject.entity.api.Entity;
026: import org.sakaiproject.time.api.TimeRange;
027:
028: /**
029: * <p>CalendarEvent is the interface for events placed into a Calendar Service Calendar.</p>
030: * <p>Each event has a time range, and other information in the event's (Resource) properties.</p>
031: */
032: public interface CalendarEvent extends Entity, Comparable,
033: AttachmentContainer {
034: /**
035: * Access the time range
036: * @return The event time range
037: */
038: public TimeRange getRange();
039:
040: /**
041: * Access the display name property (cover for PROP_DISPLAY_NAME).
042: * @return The event's display name property.
043: */
044: public String getDisplayName();
045:
046: /**
047: * Access the description property as plain text (cover for PROP_DESCRIPTION).
048: * @return The event's description property.
049: */
050: public String getDescription();
051:
052: /**
053: * Access the description property as formatted text (cover for PROP_DESCRIPTION).
054: * @return The event's description property.
055: */
056: public String getDescriptionFormatted();
057:
058: /**
059: * Access the type (cover for PROP_CALENDAR_TYPE).
060: * @return The event's type property.
061: */
062: public String getType();
063:
064: /**
065: * Access the location property (cover for PROP_CALENDAR_LOCATION).
066: * @return The event's location property.
067: */
068: public String getLocation();
069:
070: /**
071: * Get the value of an "extra" event field.
072: * @param name The name of the field.
073: * @return the value of the "extra" event field.
074: */
075: public String getField(String name);
076:
077: /**
078: * Gets the containing calendar's reference.
079: * @return The containing calendar reference.
080: */
081: public String getCalendarReference();
082:
083: /**
084: * Gets the recurrence rule, if any.
085: * @return The recurrence rule, or null if none.
086: */
087: public RecurrenceRule getRecurrenceRule();
088:
089: /**
090: * Gets the event creator (userid), if any (cover for PROP_CREATOR).
091: * @return The event's creator property.
092: */
093: public String getCreator();
094:
095: /**
096: * Returns true if current user is thhe event's owner/creator
097: * @return boolean true or false
098: */
099: public boolean isUserOwner();
100:
101: /**
102: * Gets the event modifier (userid), if any (cover for PROP_MODIFIED_BY).
103: * @return The event's modified-by property.
104: */
105: public String getModifiedBy();
106:
107: /**
108: * <p>
109: * EventAccess enumerates different access modes for the event: site-wide or grouped.
110: * </p>
111: */
112: public class EventAccess {
113: private final String m_id;
114:
115: private EventAccess(String id) {
116: m_id = id;
117: }
118:
119: public String toString() {
120: return m_id;
121: }
122:
123: static public EventAccess fromString(String access) {
124: // if (PUBLIC.m_id.equals(access)) return PUBLIC;
125: if (SITE.m_id.equals(access))
126: return SITE;
127: if (GROUPED.m_id.equals(access))
128: return GROUPED;
129: return null;
130: }
131:
132: /** public access to the event: pubview */
133: // public static final EventAccess PUBLIC = new EventAccess("public");
134: /** site level access to the event */
135: public static final EventAccess SITE = new EventAccess("site");
136:
137: /** grouped access; only members of the getGroup() groups (authorization groups) have access */
138: public static final EventAccess GROUPED = new EventAccess(
139: "grouped");
140: }
141:
142: /**
143: * Access the groups defined for this event.
144: *
145: * @return A Collection (String) of group refs (authorization group ids) defined for this event; empty if none are defined.
146: */
147: Collection getGroups();
148:
149: /**
150: * Access the groups defined for this event, as Group objects.
151: *
152: * @return A Collection (Group) of group objects defined for this event; empty if none are defined.
153: */
154: Collection getGroupObjects();
155:
156: /**
157: * Access the groups defined for this .
158: *
159: * @return A Collection (String) of group refs (authorization group ids) defined for this event; empty if none are defined.
160: */
161: String getGroupRangeForDisplay(Calendar calendar);
162:
163: /**
164: * Access the access mode for the event - how we compute who has access to the event.
165: *
166: * @return The EventAccess access mode for the event.
167: */
168: EventAccess getAccess();
169:
170: } // CalendarEvent
|