Package net.fortuna.ical4j.connector.dav
Class CalDavCalendarCollection
- java.lang.Object
-
- net.fortuna.ical4j.connector.dav.AbstractDavObjectCollection<Calendar>
-
- net.fortuna.ical4j.connector.dav.CalDavCalendarCollection
-
- All Implemented Interfaces:
CalendarCollection
,ObjectCollection<Calendar>
public class CalDavCalendarCollection extends AbstractDavObjectCollection<Calendar> implements CalendarCollection
$Id$ Created on 24/02/2008
-
-
Field Summary
-
Fields inherited from class net.fortuna.ical4j.connector.dav.AbstractDavObjectCollection
properties
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addCalendar(String uri, Calendar calendar)
Stores the specified calendar in this collection, using the specified URI.void
addCalendar(Calendar calendar)
Add a new calendar object in the collection.Calendar[]
doFreeBusyQuery()
TODO: implement free-busy-queryCalendar
export()
Exports the entire collection as a single calendar object.Calendar
getCalendar(String uid)
Returns the calendar object with the specified UID.Calendar
getCalendarFromUri(String uri)
Returns the calendar object located at the specified URI.Calendar[]
getCalendars()
Deprecated.Use the getEvents() methodString
getColor()
Calendar[]
getComponents()
Returns all objects stored in the collection.Calendar[]
getComponentsByType(String componentType)
String
getDescription()
Provides a human-readable description of the calendar collection.String
getDisplayName()
Human-readable name of the collection.Calendar[]
getEvents()
List<Calendar>
getEventsForTimePeriod(DateTime startTime, DateTime endTime)
Get a list of calendar objects of VEVENT type for a specific time period.Integer
getMaxAttendeesPerInstance()
Provides a numeric value indicating the maximum number of ATTENDEE properties in any instance of a calendar object resource stored in a calendar collection.String
getMaxDateTime()
Provides a DATE-TIME value indicating the latest date and time (in UTC) that the server is willing to accept for any DATE or DATE-TIME value in a calendar object resource stored in a calendar collection.Integer
getMaxInstances()
Provides a numeric value indicating the maximum number of recurrence instances that a calendar object resource stored in a calendar collection can generate.long
getMaxResourceSize()
Provides a numeric value indicating the maximum size of a resource in octets that the server is willing to accept when a calendar object resource is stored in a calendar collection.String
getMinDateTime()
Provides a DATE-TIME value indicating the earliest date and time (in UTC) that the server is willing to accept for any DATE or DATE-TIME value in a calendar object resource stored in a calendar collection.Calendar[]
getObjectsByMultiget(ArrayList<URI> hrefs, Element calData)
TODO: implement calendar-multiget to fetch objects based on hrefint
getOrder()
String[]
getSupportedComponentTypes()
Get the list of calendar components (VEVENT, VTODO, etc.) that this collection supports.Calendar[]
getTasks()
Calendar
getTimeZone()
The CALDAV:calendar-timezone property is used to specify the time zone the server should rely on to resolve "date" values and "date with local time" values (i.e., floating time) to "date with UTC time" values.void
merge(Calendar calendar)
Merges the specified calendar object with this collecton.static org.apache.jackrabbit.webdav.property.DavPropertyNameSet
propertiesForFetch()
Calendar
removeCalendar(String uid)
Calendar
removeCalendarFromUri(String uri)
String
toString()
void
updateCalendar(String uri, Calendar calendar)
Update a calendar object in the collection.void
updateCalendar(Calendar calendar)
Update a calendar object in the collection.void
writeCalendarOnServer(String uri, Calendar calendar, boolean isNew)
void
writeCalendarOnServer(Calendar calendar, boolean isNew)
-
Methods inherited from class net.fortuna.ical4j.connector.dav.AbstractDavObjectCollection
delete, exists, getId, getOwnerHref, getOwnerName, getPath, getProperty, getQuotaAvailableBytes, getQuotaUsedBytes, getResourceTypes, getStore, getSupportedMediaTypes, isReadOnly, setReadOnly
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.fortuna.ical4j.connector.CalendarCollection
getSupportedMediaTypes
-
-
-
-
Method Detail
-
getCalendars
@Deprecated public Calendar[] getCalendars()
Deprecated.Use the getEvents() method- Returns:
- an array of calendar objects
- See Also:
ObjectCollection.getComponents()
-
getEvents
public Calendar[] getEvents()
- Returns:
- and array of calendar objects
-
getTasks
public Calendar[] getTasks()
- Returns:
- and array of calendar objects
-
getComponentsByType
public Calendar[] getComponentsByType(String componentType)
- Parameters:
componentType
- the type of component- Returns:
- and array of calendar objects
-
getDescription
public String getDescription()
Provides a human-readable description of the calendar collection.- Specified by:
getDescription
in interfaceObjectCollection<Calendar>
- Returns:
- the collection description
-
getDisplayName
public String getDisplayName()
Human-readable name of the collection.- Specified by:
getDisplayName
in interfaceObjectCollection<Calendar>
- Returns:
- the collection name
-
getMaxAttendeesPerInstance
public Integer getMaxAttendeesPerInstance()
Provides a numeric value indicating the maximum number of ATTENDEE properties in any instance of a calendar object resource stored in a calendar collection.- Specified by:
getMaxAttendeesPerInstance
in interfaceCalendarCollection
- Returns:
- a numeric value indicating the maximum number of ATTENDEE properties in any instance of a calendar object resource stored in a calendar collection.
-
getMaxDateTime
public String getMaxDateTime()
Provides a DATE-TIME value indicating the latest date and time (in UTC) that the server is willing to accept for any DATE or DATE-TIME value in a calendar object resource stored in a calendar collection.- Specified by:
getMaxDateTime
in interfaceCalendarCollection
- Returns:
- a DATE-TIME value indicating the latest date and time (in UTC) that the server is willing to accept for any DATE or DATE-TIME value in a calendar object resource stored in a calendar collection.
-
getMaxInstances
public Integer getMaxInstances()
Provides a numeric value indicating the maximum number of recurrence instances that a calendar object resource stored in a calendar collection can generate.- Specified by:
getMaxInstances
in interfaceCalendarCollection
- Returns:
- a numeric value indicating the maximum number of recurrence instances that a calendar object resource stored in a calendar collection can generate.
-
getMaxResourceSize
public long getMaxResourceSize()
Provides a numeric value indicating the maximum size of a resource in octets that the server is willing to accept when a calendar object resource is stored in a calendar collection. 0 = no limits.- Specified by:
getMaxResourceSize
in interfaceCalendarCollection
- Returns:
- a numeric value indicating the maximum size of a resource in octets that the server is willing to accept when a calendar object resource is stored in a calendar collection.
-
getMinDateTime
public String getMinDateTime()
Provides a DATE-TIME value indicating the earliest date and time (in UTC) that the server is willing to accept for any DATE or DATE-TIME value in a calendar object resource stored in a calendar collection.- Specified by:
getMinDateTime
in interfaceCalendarCollection
- Returns:
- a DATE-TIME value indicating the earliest date and time (in UTC) that the server is willing to accept for any DATE or DATE-TIME value in a calendar object resource stored in a calendar collection.
-
getSupportedComponentTypes
public String[] getSupportedComponentTypes()
Get the list of calendar components (VEVENT, VTODO, etc.) that this collection supports.- Specified by:
getSupportedComponentTypes
in interfaceCalendarCollection
- Returns:
- an array of component names indicating the type of components supported by the collection.
-
getTimeZone
public Calendar getTimeZone()
The CALDAV:calendar-timezone property is used to specify the time zone the server should rely on to resolve "date" values and "date with local time" values (i.e., floating time) to "date with UTC time" values.- Specified by:
getTimeZone
in interfaceCalendarCollection
- Returns:
- an iCalendar object with exactly one VTIMEZONE component.
-
getColor
public String getColor()
-
getOrder
public int getOrder()
-
addCalendar
public void addCalendar(Calendar calendar) throws ObjectStoreException, ConstraintViolationException
Add a new calendar object in the collection. Creation will be done on the server right away.- Specified by:
addCalendar
in interfaceCalendarCollection
- Parameters:
calendar
- a calendar object instance to be added to the collection- Throws:
ObjectStoreException
- when an unexpected error occurs (implementation-specific)ConstraintViolationException
- if the specified calendar has no single unique identifier (UID)
-
addCalendar
public void addCalendar(String uri, Calendar calendar) throws ObjectStoreException
Stores the specified calendar in this collection, using the specified URI.- Parameters:
uri
- the URI (relative to this collection's path) where the calendar is to be storedcalendar
- a calendar object instance to be added to the collection- Throws:
ObjectStoreException
- when an unexpected error occurs (implementation-specific)
-
updateCalendar
public void updateCalendar(Calendar calendar) throws ObjectStoreException, ConstraintViolationException
Update a calendar object in the collection. Update will be send to the server right away.- Parameters:
calendar
-- Throws:
ObjectStoreException
ConstraintViolationException
-
updateCalendar
public void updateCalendar(String uri, Calendar calendar) throws ObjectStoreException
Update a calendar object in the collection. Update will be send to the server right away.- Parameters:
calendar
-- Throws:
ObjectStoreException
-
writeCalendarOnServer
public void writeCalendarOnServer(Calendar calendar, boolean isNew) throws ObjectStoreException, ConstraintViolationException
-
writeCalendarOnServer
public void writeCalendarOnServer(String uri, Calendar calendar, boolean isNew) throws ObjectStoreException
- Throws:
ObjectStoreException
-
getCalendar
public Calendar getCalendar(String uid) throws ObjectNotFoundException
Returns the calendar object with the specified UID.- Specified by:
getCalendar
in interfaceCalendarCollection
- Parameters:
uid
- the UID associated with the returned calendar- Returns:
- a calendar object or null if no calendar with the specified UID exists
- Throws:
ObjectNotFoundException
-
getCalendarFromUri
public Calendar getCalendarFromUri(String uri) throws ObjectNotFoundException
Returns the calendar object located at the specified URI.- Parameters:
uri
- the URI (relative to this collection's path) where the calendar is to be found- Returns:
- a calendar object or null if no calendar exists under the specified URI
- Throws:
ObjectNotFoundException
-
removeCalendar
public Calendar removeCalendar(String uid) throws FailedOperationException, ObjectStoreException, ObjectNotFoundException
- Specified by:
removeCalendar
in interfaceCalendarCollection
- Parameters:
uid
- the UID of the calendar to remove- Returns:
- the calendar that was successfully removed from the collection
- Throws:
ObjectStoreException
- where an unexpected error occursFailedOperationException
ObjectNotFoundException
-
removeCalendarFromUri
public Calendar removeCalendarFromUri(String uri) throws FailedOperationException, ObjectStoreException, ObjectNotFoundException
- Parameters:
uri
- the URI (relative to this collection's path) where the calendar is to be found- Returns:
- the calendar that was successfully removed from the collection
- Throws:
ObjectStoreException
- where an unexpected error occursFailedOperationException
ObjectNotFoundException
-
merge
public final void merge(Calendar calendar) throws FailedOperationException, ObjectStoreException
Merges the specified calendar object with this collecton. This is done by decomposing the calendar object into a set of objects per unique identifier (UID) and adding these objects to the collection.- Specified by:
merge
in interfaceCalendarCollection
- Parameters:
calendar
- a calendar object instance to merge into the collection- Throws:
FailedOperationException
- where the merge operation failsObjectStoreException
-
export
public Calendar export() throws ObjectStoreException
Exports the entire collection as a single calendar object.- Specified by:
export
in interfaceCalendarCollection
- Returns:
- a calendar object instance that contains all calendars in the collection
- Throws:
ObjectStoreException
- where an unexpected error occurs
-
getComponents
public Calendar[] getComponents() throws ObjectStoreException
Returns all objects stored in the collection.- Specified by:
getComponents
in interfaceObjectCollection<Calendar>
- Returns:
- an array of collection objects
- Throws:
ObjectStoreException
- where an unexpected error occurs
-
getEventsForTimePeriod
public List<Calendar> getEventsForTimePeriod(DateTime startTime, DateTime endTime) throws IOException, org.apache.jackrabbit.webdav.DavException, ParserConfigurationException, ParserException
Get a list of calendar objects of VEVENT type for a specific time period.- Parameters:
startTime
-endTime
-- Returns:
- Throws:
IOException
org.apache.jackrabbit.webdav.DavException
ParserConfigurationException
ParserException
-
getObjectsByMultiget
public Calendar[] getObjectsByMultiget(ArrayList<URI> hrefs, Element calData) throws IOException, org.apache.jackrabbit.webdav.DavException, ParserConfigurationException, ParserException
TODO: implement calendar-multiget to fetch objects based on href- Parameters:
hrefs
-calData
-- Returns:
- Throws:
IOException
org.apache.jackrabbit.webdav.DavException
ParserConfigurationException
ParserException
-
doFreeBusyQuery
public Calendar[] doFreeBusyQuery()
TODO: implement free-busy-query- Returns:
-
propertiesForFetch
public static final org.apache.jackrabbit.webdav.property.DavPropertyNameSet propertiesForFetch()
-
-