Package org.bedework.convert
Class IcalTranslator
java.lang.Object
org.bedework.convert.IcalTranslator
- All Implemented Interfaces:
Serializable,org.bedework.util.logging.Logged
- Direct Known Subclasses:
JcalTranslator,JSCalTranslator,XmlTranslator
public class IcalTranslator
extends Object
implements org.bedework.util.logging.Logged, Serializable
Object to provide translation between a bedework entity and an Icalendar format.
- Author:
- Mike Douglass douglm rpi.edu
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classWe'll use this to parameterize some of the behaviour -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddIcalTimezones(net.fortuna.ical4j.model.Calendar cal, Collection<EventInfo> vals) voidaddOverride(EventInfo ei, javax.xml.bind.JAXBElement<? extends ietf.params.xml.ns.icalendar_2.BaseComponentType> comp) Add an override as part of an updatestatic StringfreebusyToIcalString(int methodType, BwEvent ent) Make a new Calendar with the freebusy objectfromIcal(BwCalendar col, ietf.params.xml.ns.icalendar_2.IcalendarType ical) Convert the Icalendar object to a Collection of Calendar objectsfromIcal(BwCalendar col, Reader rdr) Convert the Icalendar reader to a Collection of Calendar objectsfromIcal(BwCalendar col, Reader rdr, String contentType, boolean mergeAttendees) Convert the Icalendar reader to a Collection of Calendar objects.org.bedework.util.logging.BwLoggerstatic StringgetMethod(net.fortuna.ical4j.model.Calendar val) Get the method for the calendarprotected static voidnet.fortuna.ical4j.model.CalendartoIcal(Collection<EventInfo> vals, int methodType) Turn a collection of events into a calendarnet.fortuna.ical4j.model.Calendarturn a single event with possible overrides into a calendarnet.fortuna.ical4j.model.TimeZonetzFromTzdef(String val) Get a TimeZone object from a VCALENDAR string definitionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.bedework.util.logging.Logged
audit, debug, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, trace, warn
-
Field Details
-
cb
-
pars
-
-
Constructor Details
-
IcalTranslator
Constructor:- Parameters:
cb- IcalCallback object for retrieval of entities
-
-
Method Details
-
freebusyToIcalString
Make a new Calendar with the freebusy object- Parameters:
methodType- scheduling methodent- freebusy object- Returns:
- String representation
- Throws:
RuntimeException- on fatal error
-
toIcal
public net.fortuna.ical4j.model.Calendar toIcal(EventInfo val, int methodType) throws CalFacadeException turn a single event with possible overrides into a calendar- Parameters:
val- eventmethodType- int value fromIcalendar- Returns:
- Calendar
- Throws:
CalFacadeException- on fatal error
-
toIcal
public net.fortuna.ical4j.model.Calendar toIcal(Collection<EventInfo> vals, int methodType) throws CalFacadeException Turn a collection of events into a calendar- Parameters:
vals- collection of eventsmethodType- int value fromIcalendar- Returns:
- Calendar
- Throws:
CalFacadeException- on fatal error
-
tzFromTzdef
Get a TimeZone object from a VCALENDAR string definition- Parameters:
val- VCALENDAR string definition- Returns:
- TimeZone
- Throws:
CalFacadeException- on fatal error
-
fromIcal
Convert the Icalendar reader to a Collection of Calendar objects- Parameters:
col- collection the entities will live in - possibly nullrdr- Icalendar reader- Returns:
- Icalendar
- Throws:
CalFacadeException- on fatal error
-
fromIcal
public Icalendar fromIcal(BwCalendar col, ietf.params.xml.ns.icalendar_2.IcalendarType ical) throws CalFacadeException Convert the Icalendar object to a Collection of Calendar objects- Parameters:
col- collection the entities will live in - possibly nullical- xCal icalendar object- Returns:
- Icalendar
- Throws:
CalFacadeException- on fatal error
-
fromIcal
public Icalendar fromIcal(BwCalendar col, Reader rdr, String contentType, boolean mergeAttendees) throws CalFacadeException Convert the Icalendar reader to a Collection of Calendar objects. Handles xCal, jCal and ics- Parameters:
col- collection the entities will live in - possibly nullrdr- Icalendar readercontentType- "application/calendar+xml" etcmergeAttendees- True if we should only update our own attendee.- Returns:
- Icalendar
- Throws:
CalFacadeException- on fatal error
-
addOverride
public void addOverride(EventInfo ei, javax.xml.bind.JAXBElement<? extends ietf.params.xml.ns.icalendar_2.BaseComponentType> comp) throws CalFacadeException Add an override as part of an update- Parameters:
ei- eventcomp- XML representation of override- Throws:
CalFacadeException- on fatal error
-
getMethod
Get the method for the calendar- Parameters:
val- Calendar object- Returns:
- String method
-
addIcalTimezones
-
setSystemProperties
protected static void setSystemProperties() -
getLogger
public org.bedework.util.logging.BwLogger getLogger()- Specified by:
getLoggerin interfaceorg.bedework.util.logging.Logged
-