com.funambol.common.pim.model.converter
Class VCalendarContentConverter

java.lang.Object
  extended by com.funambol.common.pim.model.converter.BaseConverter
      extended by com.funambol.common.pim.model.converter.VCalendarConverter
          extended by com.funambol.common.pim.model.converter.VCalendarContentConverter

public class VCalendarContentConverter
extends VCalendarConverter

This object is a converter from CalendarContent (Event or Task) to VCalendar and from VCalendar to CalendarContent.

Version:
$Id: VCalendarContentConverter.java,v 1.23 2008-08-29 12:21:02 mauro Exp $
See Also:
Converter

Field Summary
 
Fields inherited from class com.funambol.common.pim.model.converter.BaseConverter
charset, CHARSET_UTF7, CHARSET_UTF8, ENCODING_B64, ENCODING_QP, forceClientLocalTime, PLAIN_CHARSET, supportedFields, timezone
 
Constructor Summary
VCalendarContentConverter(java.util.TimeZone timezone, java.lang.String charset)
          Deprecated. forceClientLocalTime argument should also be specified
VCalendarContentConverter(java.util.TimeZone timezone, java.lang.String charset, boolean forceClientLocalTime)
           
 
Method Summary
 VCalendarContent cc2vcc(CalendarContent cc)
           
 VCalendarContent cc2vcc(CalendarContent cc, boolean xv)
          Performs the CalendarContent-to-VCalendarContent conversion.
 long[] extractInterval(VCalendarContent vcc)
          Extracts roughly a time interval large enough to contain the whole event/task and, in case it's a recurrent one, all its occurrences.
static RecurrencePattern getRecurrencePattern(java.lang.String startDate, java.lang.String endDate, java.lang.String rrule, java.util.TimeZone recurrenceTZ, boolean xv)
           
 void isAllDayCheckingDuration(CalendarContent cc)
          Checks if the given dates are of an all day event checking if the duration is a multiple of 24 hour.
 CalendarContent vcc2cc(VCalendarContent vcc, boolean xv)
          Performs the VCalendarContent-to-CalendarContent conversion.
protected  CalendarContent vcc2cc(VCalendarContent vcc, boolean xv, java.util.TimeZone dtStartTimeZone, java.util.TimeZone dtEndTimeZone, java.util.TimeZone reminderTimeZone)
          Performs the VCalendarContent-to-CalendarContent conversion.
 
Methods inherited from class com.funambol.common.pim.model.converter.VCalendarConverter
addCRBeforeEachLF, addXParams, calendar2vcalendar, composeDateTimeField, composeDateTimeField, composeField, convert, decodeDateTimeField, decodeField, decodeShortField, getParameters, getXParams, iCalEscape, isComplexProperty, isQPProperty, vcalendar2calendar, vCalEscape, vCalEscapeButKeepNewlines, vCalUnescape
 
Methods inherited from class com.funambol.common.pim.model.converter.BaseConverter
composeICalTextComponent, composeRemainingFields, composeVCardComponent, composeVCardComponent, encode, escapeSeparator, handleConversionAcrossTimeZones, handleConversionToAllDayDate, handleConversionToAllDayDate, handleConversionToLocalDate, handleConversionToUTCDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VCalendarContentConverter

@Deprecated
public VCalendarContentConverter(java.util.TimeZone timezone,
                                            java.lang.String charset)
Deprecated. forceClientLocalTime argument should also be specified

This constructor is deprecated because to handle the date is need to know timezone but also if the dates must be converted in local time.

Parameters:
timezone -
charset -

VCalendarContentConverter

public VCalendarContentConverter(java.util.TimeZone timezone,
                                 java.lang.String charset,
                                 boolean forceClientLocalTime)
Parameters:
timezone - the timezone to use in the conversion
charset - the charset
forceClientLocalTime - true if the date must be converted in the client local time, false otherwise.
Method Detail

cc2vcc

public VCalendarContent cc2vcc(CalendarContent cc)
                        throws ConverterException
Throws:
ConverterException

cc2vcc

public VCalendarContent cc2vcc(CalendarContent cc,
                               boolean xv)
                        throws ConverterException
Performs the CalendarContent-to-VCalendarContent conversion.

Parameters:
cc - the CalendarContent object to be converted
xv - true if the VCalendarContent must be in text/x-vcalendar format
Returns:
a VCalendarContent object
Throws:
com.funambol.common.pim.converter.ConverterException
ConverterException

vcc2cc

public CalendarContent vcc2cc(VCalendarContent vcc,
                              boolean xv)
                       throws ConverterException
Performs the VCalendarContent-to-CalendarContent conversion.

Parameters:
vcc - the VCalendarContent object to be converted
xv - true if the text/x-vcalendar format must be used while generating some properties of the VCalendar output object
Returns:
a CalendarContent object
Throws:
com.funambol.common.pim.converter.ConverterException
ConverterException

vcc2cc

protected CalendarContent vcc2cc(VCalendarContent vcc,
                                 boolean xv,
                                 java.util.TimeZone dtStartTimeZone,
                                 java.util.TimeZone dtEndTimeZone,
                                 java.util.TimeZone reminderTimeZone)
                          throws ConverterException
Performs the VCalendarContent-to-CalendarContent conversion.

Parameters:
vcc - the VCalendarContent object to be converted
xv - true if the text/x-vcalendar format must be used while generating some properties of the VCalendar output object
dtStartTimeZone -
dtEndTimeZone -
reminderTimeZone -
Returns:
a CalendarContent object
Throws:
com.funambol.common.pim.converter.ConverterException
ConverterException

getRecurrencePattern

public static RecurrencePattern getRecurrencePattern(java.lang.String startDate,
                                                     java.lang.String endDate,
                                                     java.lang.String rrule,
                                                     java.util.TimeZone recurrenceTZ,
                                                     boolean xv)
                                              throws ConverterException
Throws:
ConverterException

isAllDayCheckingDuration

public void isAllDayCheckingDuration(CalendarContent cc)
                              throws java.lang.Exception
Checks if the given dates are of an all day event checking if the duration is a multiple of 24 hour. The main problem is the end time is something like 23:59:59 so the difference is not 24 hour but 24 hour - 1 second. Another problem is about the day of the event because the date can be shifted because we may not have the timezone of the device. BTW, in order to find the day, we don't need the timezone but we need to know just if the timezone is with an offset positive or negative. And to know it, we check the time of the dtEnd.
If an all day event is detected, the properties are set in the given calendar. KNOW ISSUE: this method fails with the timezone with an offset greater than 12 hours

Parameters:
cc -
Throws:
java.lang.Exception - if an error occurs

extractInterval

public long[] extractInterval(VCalendarContent vcc)
Extracts roughly a time interval large enough to contain the whole event/task and, in case it's a recurrent one, all its occurrences. To be used just with iCalendar (vCalendar 2.0) items.

Parameters:
vcc - the VCalendarContent object to be quickly parsed
Returns:
an array of long integers, the first one being the lower end of the interval and the other one the upper end


Copyright © 2001-2009 Funambol.