Class IcalUtils
java.lang.Object
org.apache.openmeetings.service.calendar.caldav.IcalUtils
Class which provides iCalendar Utilities.
This class's functions could be made static, as they are not instantiated anyway.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTimetoDate(Date date, int field, int amount) Adds a specified amount of time to a Date.net.fortuna.ical4j.model.CalendarparseAppointmentstoCalendar(List<Appointment> appointments, Long ownerId) Parses a List of Appointments into a VCALENDAR component.net.fortuna.ical4j.model.CalendarparseAppointmenttoCalendar(Appointment appointment) Methods to parse Appointment to iCalendar according RFC 2445parseCalendartoAppointment(net.fortuna.ical4j.model.Calendar calendar, String href, String etag, OmCalendar omCalendar) Parses the Calendar from the CalDAV server, to a new Appointment.parseCalendartoAppointment(Appointment a, net.fortuna.ical4j.model.Calendar calendar, String etag) Updating Appointments which already exist, by parsing the Calendar.parseCalendartoAppointments(net.fortuna.ical4j.model.Calendar calendar, Long ownerId) Parses a Calendar with multiple VEvents into AppointmentsAdapted from DateUtils to support Timezones, and parse ical dates intoDate.Convenience function to parse date fromPropertytoDateparseTimeZone(net.fortuna.ical4j.model.Calendar calendar, User owner) Parses the VTimezone Component of the given Calendar.
-
Field Details
-
PROD_ID
- See Also:
-
-
Constructor Details
-
IcalUtils
public IcalUtils()
-
-
Method Details
-
parseCalendartoAppointment
public Appointment parseCalendartoAppointment(net.fortuna.ical4j.model.Calendar calendar, String href, String etag, OmCalendar omCalendar) Parses the Calendar from the CalDAV server, to a new Appointment.- Parameters:
calendar- iCalendar Representation.href- Location of the Calendar on the serveretag- ETag of the calendar.omCalendar- The Parent OmCalendar, to which the Appointment belongs.- Returns:
- Appointment after parsing.
-
parseCalendartoAppointments
public List<Appointment> parseCalendartoAppointments(net.fortuna.ical4j.model.Calendar calendar, Long ownerId) Parses a Calendar with multiple VEvents into Appointments- Parameters:
calendar- Calendar to ParseownerId- Owner of the Appointments- Returns:
Listof Appointments
-
parseCalendartoAppointment
public Appointment parseCalendartoAppointment(Appointment a, net.fortuna.ical4j.model.Calendar calendar, String etag) Updating Appointments which already exist, by parsing the Calendar. And updating etag. Doesn't work with complex Recurrences. Note: Hasn't been tested to acknowledge DST, timezones should acknowledge this.- Parameters:
a- Appointment to be updated.calendar- iCalendar Representation.etag- The ETag of the calendar.- Returns:
- Updated Appointment.
-
parseTimeZone
Parses the VTimezone Component of the given Calendar. If no, VTimezone component is found the User Timezone is used- Parameters:
calendar- Calendar to parseowner- Owner of the Calendar- Returns:
- Parsed TimeZone
-
parseDate
Convenience function to parse date fromPropertytoDate- Parameters:
dt- DATE-TIME Property from which we parse.timeZone- Timezone of the Date.- Returns:
Daterepresentation of the iCalendar value.
-
parseDate
Adapted from DateUtils to support Timezones, and parse ical dates intoDate. Note: Replace FastDateFormat to java.time, when shifting to Java 8 or higher.- Parameters:
str- Date representation in String.inTimeZone- Timezone of the Date.- Returns:
java.util.Daterepresentation of string ornullif the Date could not be parsed.
-
addTimetoDate
Adds a specified amount of time to a Date.- Parameters:
date- Date to which time is addedfield- Date Field to which the Amount is addedamount- Amount to be Added- Returns:
- New Date
-
parseAppointmenttoCalendar
Methods to parse Appointment to iCalendar according RFC 2445- Parameters:
appointment- to be converted to iCalendar- Returns:
- iCalendar representation of the Appointment
-
parseAppointmentstoCalendar
public net.fortuna.ical4j.model.Calendar parseAppointmentstoCalendar(List<Appointment> appointments, Long ownerId) Parses a List of Appointments into a VCALENDAR component.- Parameters:
appointments- List of Appointments for the CalendarownerId- Owner of the Appointments- Returns:
- VCALENDAR representation of the Appointments
-