Class IcalUtil

java.lang.Object
org.bedework.convert.ical.IcalUtil
Direct Known Subclasses:
BwEvent2Ical, BwFreeBusyUtil, Ical2BwEvent, VAlarmUtil, VFreeUtil

public class IcalUtil extends Object
Class to provide utility methods for ical4j classes
Author:
Mike Douglass douglm rpi.edu
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addParameter(net.fortuna.ical4j.model.Property prop, net.fortuna.ical4j.model.Parameter val)
     
    static void
    addProperty(net.fortuna.ical4j.model.Component comp, net.fortuna.ical4j.model.Property val)
     
    static void
    addXproperty(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, String name, List<BwXproperty.Xpar> pars, String val)
     
    static net.fortuna.ical4j.model.parameter.AltRep
    getAltRep(net.fortuna.ical4j.model.Property prop)
    Return the AltRep parameter if it exists
    getAttachment(net.fortuna.ical4j.model.property.Attach attProp)
     
    static BwAttendee
    getAttendee(IcalCallback cb, net.fortuna.ical4j.model.property.Attendee attProp)
     
    static org.bedework.convert.ical.IcalUtil.DurationRepeat
    getDurationRepeat(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl)
    Both or none appear once only
    static String
    getLang(net.fortuna.ical4j.model.Property p)
     
    static String
    getOptStr(net.fortuna.ical4j.model.ParameterList pl, String name)
    Return optional string parameter
    static String
    getOptStr(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, String name)
    Return optional string property
    getOrganizer(IcalCallback cb, net.fortuna.ical4j.model.property.Organizer orgProp)
    Make an organizer
    static net.fortuna.ical4j.model.Parameter
    getParameter(net.fortuna.ical4j.model.Property prop, String name)
     
    static String
    getParameterVal(net.fortuna.ical4j.model.Property prop, String name)
     
    static net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property>
    getProperties(net.fortuna.ical4j.model.Component comp, String name)
     
    static net.fortuna.ical4j.model.Property
    getProperty(net.fortuna.ical4j.model.Component comp, String name)
     
    static String
    getReqStr(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, String name)
    Return required string property
    static Iterator<?>
    getReqStrs(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, String name)
    Return an Iterator over required String attributes
    getTrigger(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, boolean absentOk)
     
    static org.bedework.util.misc.response.GetEntitiesResponse<net.fortuna.ical4j.model.component.VLocation>
     
    static BwAttendee
    getVoter(IcalCallback cb, net.fortuna.ical4j.model.property.CalendarAddress ca)
     
    static net.fortuna.ical4j.model.Component
    getXcomp(BwEvent ev, String compName)
    This is used to extract the full iCalendar representation from the x-properties.
    static BwAttendee
    initAttendeeVoter(IcalCallback cb, String val, net.fortuna.ical4j.model.ParameterList pars)
     
    static net.fortuna.ical4j.model.DateTime
    Always return a DateTime object
    makeDateTimes(net.fortuna.ical4j.model.property.DateListProperty val)
     
    static net.fortuna.ical4j.model.property.DtEnd
    Make a DtEnd from the object
    static net.fortuna.ical4j.model.property.DtEnd
    makeDtEnd(BwDateTime val, net.fortuna.ical4j.model.TimeZoneRegistry tzreg)
    Make a DtEnd from the object
    static net.fortuna.ical4j.model.property.Due
    makeDue(BwDateTime val, net.fortuna.ical4j.model.TimeZoneRegistry tzreg)
    Make a Due from the object
    static net.fortuna.ical4j.model.ParameterList
     
    static List<net.fortuna.ical4j.model.component.Participant>
     
    static Map<Integer,net.fortuna.ical4j.model.Component>
     
    static Map<String,net.fortuna.ical4j.model.component.Participant>
     
    static net.fortuna.ical4j.model.property.Attach
    make an attachment
    static net.fortuna.ical4j.model.property.Attendee
    make an attendee
    static void
    setDates(String userHref, EventInfo ei, net.fortuna.ical4j.model.property.DtStart dtStart, net.fortuna.ical4j.model.property.DtEnd dtEnd, net.fortuna.ical4j.model.property.Duration duration)
    Set the dates in an event given a start and one or none of end and duration.
    static net.fortuna.ical4j.model.property.Organizer
     
    static net.fortuna.ical4j.model.component.Participant
    make a voter
    static org.bedework.util.misc.response.GetEntityResponse<net.fortuna.ical4j.model.component.VLocation>
    toVlocation(BwLocation loc, org.bedework.convert.ical.IcalUtil.Relto relTo)
     
    static void
    xpropertiesToIcal(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, List<BwXproperty> xprops)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IcalUtil

      public IcalUtil()
  • Method Details

    • getXcomp

      public static net.fortuna.ical4j.model.Component getXcomp(BwEvent ev, String compName)
      This is used to extract the full iCalendar representation from the x-properties. This is used to avoid extending the schema to preserve extra properties specifically on attendee and attachments.
      Parameters:
      ev - with possible xprops
      compName - we want
      Returns:
      the Component or null
    • xpropertiesToIcal

      public static void xpropertiesToIcal(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, List<BwXproperty> xprops)
      Parameters:
      pl - ical4j property list
      xprops - list of bw xprops
    • makeXparlist

      public static net.fortuna.ical4j.model.ParameterList makeXparlist(List<BwXproperty.Xpar> pars)
      Parameters:
      pars - List of Xpar
      Returns:
      par list - always non-null
    • addXproperty

      public static void addXproperty(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, String name, List<BwXproperty.Xpar> pars, String val)
      Parameters:
      pl - ical4j PropertyList
      name - of xprop
      pars - List of Xpar
      val - new value
    • getLang

      public static String getLang(net.fortuna.ical4j.model.Property p)
      Parameters:
      p - ical4j Property
      Returns:
      String
    • setOrganizer

      public static net.fortuna.ical4j.model.property.Organizer setOrganizer(BwOrganizer val)
      Parameters:
      val - bw organizer object
      Returns:
      Organizer
    • getOrganizer

      public static BwOrganizer getOrganizer(IcalCallback cb, net.fortuna.ical4j.model.property.Organizer orgProp)
      Make an organizer
      Parameters:
      cb - IcalCallback object
      orgProp - ical4j Organizer
      Returns:
      BwOrganizer
    • setAttachment

      public static net.fortuna.ical4j.model.property.Attach setAttachment(BwAttachment val)
      make an attachment
      Parameters:
      val - bw attachment object
      Returns:
      Attendee
    • getAttachment

      public static BwAttachment getAttachment(net.fortuna.ical4j.model.property.Attach attProp)
      Parameters:
      attProp - Attach
      Returns:
      BwAttachment
    • setAttendee

      public static net.fortuna.ical4j.model.property.Attendee setAttendee(BwAttendee val)
      make an attendee
      Parameters:
      val - BwAttendee to build from
      Returns:
      Attendee
    • setVoter

      public static net.fortuna.ical4j.model.component.Participant setVoter(BwAttendee val)
      make a voter
      Parameters:
      val - BwAttendee to build from
      Returns:
      Attendee
    • toVlocation

      public static org.bedework.util.misc.response.GetEntityResponse<net.fortuna.ical4j.model.component.VLocation> toVlocation(BwLocation loc, org.bedework.convert.ical.IcalUtil.Relto relTo)
      Parameters:
      loc - the location
      Returns:
      A VLOCATION object.
    • getVlocations

      public static org.bedework.util.misc.response.GetEntitiesResponse<net.fortuna.ical4j.model.component.VLocation> getVlocations(BwEvent ev)
    • parseVpollVoters

      public static Map<String,net.fortuna.ical4j.model.component.Participant> parseVpollVoters(BwEvent poll)
      Parameters:
      poll - the poll entity
      Returns:
      Parsed PARTICIPANT components map - key is voter cua.
    • parseParticipants

      public static List<net.fortuna.ical4j.model.component.Participant> parseParticipants(List<BwXproperty> xprops)
      Parameters:
      xprops - String participant objects
      Returns:
      Parsed PARTICIPANT components list.
    • parseVpollCandidates

      public static Map<Integer,net.fortuna.ical4j.model.Component> parseVpollCandidates(BwEvent poll)
      Parameters:
      poll - the poll entity
      Returns:
      Parsed components.
    • getAttendee

      public static BwAttendee getAttendee(IcalCallback cb, net.fortuna.ical4j.model.property.Attendee attProp)
      Parameters:
      cb - IcalCallback object
      attProp - ical4j attendee
      Returns:
      BwAttendee
    • getVoter

      public static BwAttendee getVoter(IcalCallback cb, net.fortuna.ical4j.model.property.CalendarAddress ca)
      Parameters:
      cb - IcalCallback object
      ca - - identifies the voter
      Returns:
      BwAttendee
    • initAttendeeVoter

      public static BwAttendee initAttendeeVoter(IcalCallback cb, String val, net.fortuna.ical4j.model.ParameterList pars)
      Parameters:
      cb - IcalCallback object
      val - init attendee
      pars - par list
      Returns:
      BwAttendee
    • getTrigger

      public static BwAlarm.TriggerVal getTrigger(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, boolean absentOk)
      Parameters:
      pl - ical4j property list
      absentOk - - if true and absent returns an empty result.
      Returns:
      TriggerVal
    • getDurationRepeat

      public static org.bedework.convert.ical.IcalUtil.DurationRepeat getDurationRepeat(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl)
      Both or none appear once only
      Parameters:
      pl - ical4j property list
      Returns:
      DurationRepeat
    • makeDateTimes

      public static Collection<BwDateTime> makeDateTimes(net.fortuna.ical4j.model.property.DateListProperty val)
      Parameters:
      val - ical4j DateListProperty
      Returns:
      Collection
    • addProperty

      public static void addProperty(net.fortuna.ical4j.model.Component comp, net.fortuna.ical4j.model.Property val)
      Parameters:
      comp - ical4j Component
      val - ical4j property
    • addParameter

      public static void addParameter(net.fortuna.ical4j.model.Property prop, net.fortuna.ical4j.model.Parameter val)
      Parameters:
      prop - ical4j property
      val - ical4j parameter
    • getParameter

      public static net.fortuna.ical4j.model.Parameter getParameter(net.fortuna.ical4j.model.Property prop, String name)
      Parameters:
      prop - ical4j property
      name - of property
      Returns:
      Parameter
    • getParameterVal

      public static String getParameterVal(net.fortuna.ical4j.model.Property prop, String name)
      Parameters:
      prop - ical4j property
      name - of property
      Returns:
      Parameter value
    • getProperty

      public static net.fortuna.ical4j.model.Property getProperty(net.fortuna.ical4j.model.Component comp, String name)
      Parameters:
      comp - ical4j Component
      name - of property
      Returns:
      Property
    • getProperties

      public static net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> getProperties(net.fortuna.ical4j.model.Component comp, String name)
      Parameters:
      comp - ical4j Component
      name - of property
      Returns:
      PropertyList
    • getReqStrs

      public static Iterator<?> getReqStrs(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, String name)
      Return an Iterator over required String attributes
      Parameters:
      pl - ical4j property list
      name - of property
      Returns:
      Iterator over required String attributes
    • getReqStr

      public static String getReqStr(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, String name)
      Return required string property
      Parameters:
      pl - ical4j property list
      name - of property
      Returns:
      String
    • getOptStr

      public static String getOptStr(net.fortuna.ical4j.model.PropertyList<net.fortuna.ical4j.model.Property> pl, String name)
      Return optional string property
      Parameters:
      pl - ical4j property list
      name - of property
      Returns:
      String or null
    • getOptStr

      public static String getOptStr(net.fortuna.ical4j.model.ParameterList pl, String name)
      Return optional string parameter
      Parameters:
      pl - ical4j property list
      name - of property
      Returns:
      String
    • getAltRep

      public static net.fortuna.ical4j.model.parameter.AltRep getAltRep(net.fortuna.ical4j.model.Property prop)
      Return the AltRep parameter if it exists
      Parameters:
      prop - ical4j property
      Returns:
      AltRep
    • makeDtEnd

      public static net.fortuna.ical4j.model.property.DtEnd makeDtEnd(BwDateTime val)
      Make a DtEnd from the object
      Parameters:
      val - a BwDateTime
      Returns:
      DtEnd ical4j dtend object
    • makeDtEnd

      public static net.fortuna.ical4j.model.property.DtEnd makeDtEnd(BwDateTime val, net.fortuna.ical4j.model.TimeZoneRegistry tzreg)
      Make a DtEnd from the object
      Parameters:
      val - a BwDateTime
      tzreg - timezone registry
      Returns:
      DtEnd
    • makeDue

      public static net.fortuna.ical4j.model.property.Due makeDue(BwDateTime val, net.fortuna.ical4j.model.TimeZoneRegistry tzreg)
      Make a Due from the object
      Parameters:
      val - a BwDateTime
      tzreg - timezone registry
      Returns:
      Due
    • makeDateTime

      public static net.fortuna.ical4j.model.DateTime makeDateTime(BwDateTime dt)
      Always return a DateTime object
      Parameters:
      dt - bw date time
      Returns:
      DateTime
    • setDates

      public static void setDates(String userHref, EventInfo ei, net.fortuna.ical4j.model.property.DtStart dtStart, net.fortuna.ical4j.model.property.DtEnd dtEnd, net.fortuna.ical4j.model.property.Duration duration)
      Set the dates in an event given a start and one or none of end and duration.
      Parameters:
      userHref - for changeset
      ei - the event
      dtStart - start
      dtEnd - end
      duration - duration