com.funambol.common.pim.vcalendar
Class BasicVCalendarFormatter

java.lang.Object
  extended by com.funambol.common.pim.vcalendar.BasicVCalendarFormatter
Direct Known Subclasses:
ICalendarFormatter, XVCalendarFormatter

public abstract class BasicVCalendarFormatter
extends java.lang.Object

This class implements the basic vCalendar formatter listener which manages the formatting of common properties shared by the vCalendar 1.0 and iCalendar (vCalendar 2.0) formats.

NOTE: Implementations of the iCalendar and vCalendar formatters should extend this class.


Field Summary
protected  VAlarm alarm
           
protected  java.lang.String defaultCharset
           
protected  PimUtils pimUtils
           
 
Constructor Summary
BasicVCalendarFormatter()
           
BasicVCalendarFormatter(java.lang.String defaultCharset)
          Create a new BasicVCalendarFormatter using the provided default charset
 
Method Summary
protected  java.lang.String encodeField(java.lang.String value)
          Encode a field value if it requires encoding
protected  long fixEndDate(long endDate)
          Add a day factor to the end date (used for allday events)
 void format(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
          Format the vCalendar item.
protected abstract  void formatAlarm(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatAttendees(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatCategories(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatClass(PIMItem pimItem, int pimField, java.io.OutputStream os, boolean allFields)
           
protected  void formatCompleted(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected abstract  void formatDateTimeField(java.io.OutputStream os, PIMItem pimItem, int pimField, java.lang.String vCalField, boolean checkAllDay, boolean checkTimezone, boolean allFields)
          Format a date-time field.
protected  void formatDTEnd(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatDTStart(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatDue(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatEvent(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
          Format the Event common properties
protected  void formatFunambolAllday(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatLocation(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatNote(PIMItem pimItem, int pimField, java.io.OutputStream os, boolean allFields)
           
protected  void formatPriority(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatRevision(PIMItem pimItem, int pimField, java.io.OutputStream os, boolean allFields)
           
protected  void formatRRule(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatSimpleField(PIMItem pimItem, int pimField, java.lang.String vCalField, java.io.OutputStream os, boolean checkEncode, boolean allFields)
          Format a simple field.
protected  void formatStatus(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
           
protected  void formatSummary(PIMItem pimItem, int pimField, java.io.OutputStream os, boolean allFields)
          Sigle field formatters
protected abstract  void formatTimezone(PIMItem pimItem, java.io.OutputStream os)
           
protected  void formatToDo(PIMItem pimItem, java.io.OutputStream os, boolean allFields)
          Format the ToDo common properties
protected  void formatUID(PIMItem pimItem, int pimField, java.io.OutputStream os, boolean allFields)
           
protected  int getTaskAlarmInterval(PIMItem pimItem)
           
protected abstract  java.lang.String getVersion()
          Get the version property string (e.g.
protected  boolean isAllDay(PIMItem pimItem)
           
protected  boolean isSupported(PIMItem pimItem, int pimField)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultCharset

protected java.lang.String defaultCharset

pimUtils

protected PimUtils pimUtils

alarm

protected VAlarm alarm
Constructor Detail

BasicVCalendarFormatter

public BasicVCalendarFormatter(java.lang.String defaultCharset)
Create a new BasicVCalendarFormatter using the provided default charset

Parameters:
defaultCharset -

BasicVCalendarFormatter

public BasicVCalendarFormatter()
Method Detail

format

public void format(PIMItem pimItem,
                   java.io.OutputStream os,
                   boolean allFields)
            throws PIMException
Format the vCalendar item.

Parameters:
pimItem - the PIMItem to format
os - the output stream
Throws:
javax.microedition.pim.PIMException
PIMException

formatEvent

protected void formatEvent(PIMItem pimItem,
                           java.io.OutputStream os,
                           boolean allFields)
                    throws PIMException
Format the Event common properties

Parameters:
pimItem - the PIMItem to format
os - the output stream
Throws:
javax.microedition.pim.PIMException
PIMException

formatToDo

protected void formatToDo(PIMItem pimItem,
                          java.io.OutputStream os,
                          boolean allFields)
                   throws PIMException
Format the ToDo common properties

Parameters:
pimItem - the PIMItem to format
os - the output stream
Throws:
javax.microedition.pim.PIMException
PIMException

getVersion

protected abstract java.lang.String getVersion()
Get the version property string (e.g. VERSION:1.0)

Returns:

formatSummary

protected void formatSummary(PIMItem pimItem,
                             int pimField,
                             java.io.OutputStream os,
                             boolean allFields)
                      throws PIMException
Sigle field formatters

Throws:
PIMException

formatNote

protected void formatNote(PIMItem pimItem,
                          int pimField,
                          java.io.OutputStream os,
                          boolean allFields)
                   throws PIMException
Throws:
PIMException

formatLocation

protected void formatLocation(PIMItem pimItem,
                              java.io.OutputStream os,
                              boolean allFields)
                       throws PIMException
Throws:
PIMException

formatUID

protected void formatUID(PIMItem pimItem,
                         int pimField,
                         java.io.OutputStream os,
                         boolean allFields)
                  throws PIMException
Throws:
PIMException

formatPriority

protected void formatPriority(PIMItem pimItem,
                              java.io.OutputStream os,
                              boolean allFields)
                       throws PIMException
Throws:
PIMException

formatStatus

protected void formatStatus(PIMItem pimItem,
                            java.io.OutputStream os,
                            boolean allFields)
                     throws PIMException
Throws:
PIMException

formatCategories

protected void formatCategories(PIMItem pimItem,
                                java.io.OutputStream os,
                                boolean allFields)
                         throws PIMException
Throws:
PIMException

formatClass

protected void formatClass(PIMItem pimItem,
                           int pimField,
                           java.io.OutputStream os,
                           boolean allFields)
                    throws PIMException
Throws:
PIMException

formatDTStart

protected void formatDTStart(PIMItem pimItem,
                             java.io.OutputStream os,
                             boolean allFields)
                      throws PIMException
Throws:
PIMException

formatDTEnd

protected void formatDTEnd(PIMItem pimItem,
                           java.io.OutputStream os,
                           boolean allFields)
                    throws PIMException
Throws:
PIMException

formatDue

protected void formatDue(PIMItem pimItem,
                         java.io.OutputStream os,
                         boolean allFields)
                  throws PIMException
Throws:
PIMException

formatRevision

protected void formatRevision(PIMItem pimItem,
                              int pimField,
                              java.io.OutputStream os,
                              boolean allFields)
                       throws PIMException
Throws:
PIMException

formatCompleted

protected void formatCompleted(PIMItem pimItem,
                               java.io.OutputStream os,
                               boolean allFields)
                        throws PIMException
Throws:
PIMException

formatRRule

protected void formatRRule(PIMItem pimItem,
                           java.io.OutputStream os,
                           boolean allFields)
                    throws PIMException
Throws:
PIMException

formatFunambolAllday

protected void formatFunambolAllday(PIMItem pimItem,
                                    java.io.OutputStream os,
                                    boolean allFields)
                             throws PIMException
Throws:
PIMException

formatAttendees

protected void formatAttendees(PIMItem pimItem,
                               java.io.OutputStream os,
                               boolean allFields)
                        throws PIMException
Throws:
PIMException

getTaskAlarmInterval

protected int getTaskAlarmInterval(PIMItem pimItem)

formatAlarm

protected abstract void formatAlarm(PIMItem pimItem,
                                    java.io.OutputStream os,
                                    boolean allFields)
                             throws PIMException
Throws:
PIMException

formatTimezone

protected abstract void formatTimezone(PIMItem pimItem,
                                       java.io.OutputStream os)
                                throws PIMException
Throws:
PIMException

formatSimpleField

protected void formatSimpleField(PIMItem pimItem,
                                 int pimField,
                                 java.lang.String vCalField,
                                 java.io.OutputStream os,
                                 boolean checkEncode,
                                 boolean allFields)
                          throws PIMException
Format a simple field.

Parameters:
pimItem - the PIMItem that contains the field value
pimField - the PIMItem field index
vCalField - the vCalendar field name
os - the output stream
checkEncode - check whether the field value shall be encoded
Throws:
javax.microedition.pim.PIMException
PIMException

formatDateTimeField

protected abstract void formatDateTimeField(java.io.OutputStream os,
                                            PIMItem pimItem,
                                            int pimField,
                                            java.lang.String vCalField,
                                            boolean checkAllDay,
                                            boolean checkTimezone,
                                            boolean allFields)
                                     throws PIMException
Format a date-time field.

Parameters:
os - The output stream to print the field in.
pimItem - The PIMItem
pimField - The pim field index.
vCalField - The vCalendar field name
checkAllDay - Check whether the allday property shall be updated
checkTimezone - Check whether the TZID param shall be added (only for iCalendar implementations)
Throws:
javax.microedition.pim.PIMException
PIMException

isAllDay

protected boolean isAllDay(PIMItem pimItem)

encodeField

protected java.lang.String encodeField(java.lang.String value)
                                throws PIMException
Encode a field value if it requires encoding

Parameters:
value - the field value
Returns:
null if it doesn't require encoding
Throws:
javax.microedition.pim.PIMException
PIMException

isSupported

protected boolean isSupported(PIMItem pimItem,
                              int pimField)

fixEndDate

protected long fixEndDate(long endDate)
Add a day factor to the end date (used for allday events)

Parameters:
endDate -


Copyright © 2001-2009 Funambol.