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 Classes
    Modifier and Type
    Class
    Description
    static class 
    We'll use this to parameterize some of the behaviour
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected IcalCallback
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor:
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addIcalTimezones(net.fortuna.ical4j.model.Calendar cal, Collection<EventInfo> vals)
     
    void
    addOverride(EventInfo ei, javax.xml.bind.JAXBElement<? extends ietf.params.xml.ns.icalendar_2.BaseComponentType> comp)
    Add an override as part of an update
    static String
    freebusyToIcalString(int methodType, BwEvent ent)
    Make a new Calendar with the freebusy object
    fromIcal(BwCalendar col, ietf.params.xml.ns.icalendar_2.IcalendarType ical)
    Convert the Icalendar object to a Collection of Calendar objects
    Convert the Icalendar reader to a Collection of Calendar objects
    fromIcal(BwCalendar col, Reader rdr, String contentType, boolean mergeAttendees)
    Convert the Icalendar reader to a Collection of Calendar objects.
    org.bedework.util.logging.BwLogger
     
    static String
    getMethod(net.fortuna.ical4j.model.Calendar val)
    Get the method for the calendar
    protected static void
     
    net.fortuna.ical4j.model.Calendar
    toIcal(Collection<EventInfo> vals, int methodType)
    Turn a collection of events into a calendar
    net.fortuna.ical4j.model.Calendar
    toIcal(EventInfo val, int methodType)
    turn a single event with possible overrides into a calendar
    net.fortuna.ical4j.model.TimeZone
    Get a TimeZone object from a VCALENDAR string definition

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods 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

  • Constructor Details

    • IcalTranslator

      public IcalTranslator(IcalCallback cb)
      Constructor:
      Parameters:
      cb - IcalCallback object for retrieval of entities
  • Method Details

    • freebusyToIcalString

      public static String freebusyToIcalString(int methodType, BwEvent ent)
      Make a new Calendar with the freebusy object
      Parameters:
      methodType - scheduling method
      ent - 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 - event
      methodType - 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 events
      methodType - int value fromIcalendar
      Returns:
      Calendar
      Throws:
      CalFacadeException - on fatal error
    • tzFromTzdef

      public net.fortuna.ical4j.model.TimeZone tzFromTzdef(String val) throws CalFacadeException
      Get a TimeZone object from a VCALENDAR string definition
      Parameters:
      val - VCALENDAR string definition
      Returns:
      TimeZone
      Throws:
      CalFacadeException - on fatal error
    • fromIcal

      public Icalendar fromIcal(BwCalendar col, Reader rdr) throws CalFacadeException
      Convert the Icalendar reader to a Collection of Calendar objects
      Parameters:
      col - collection the entities will live in - possibly null
      rdr - 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 null
      ical - 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 null
      rdr - Icalendar reader
      contentType - "application/calendar+xml" etc
      mergeAttendees - 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 - event
      comp - XML representation of override
      Throws:
      CalFacadeException - on fatal error
    • getMethod

      public static String getMethod(net.fortuna.ical4j.model.Calendar val)
      Get the method for the calendar
      Parameters:
      val - Calendar object
      Returns:
      String method
    • addIcalTimezones

      protected void addIcalTimezones(net.fortuna.ical4j.model.Calendar cal, Collection<EventInfo> vals)
    • setSystemProperties

      protected static void setSystemProperties()
    • getLogger

      public org.bedework.util.logging.BwLogger getLogger()
      Specified by:
      getLogger in interface org.bedework.util.logging.Logged