com.funambol.common.pim.model.common
Class BaseFormatter

java.lang.Object
  extended by com.funambol.common.pim.model.common.BaseFormatter
Direct Known Subclasses:
VCardFormatter

public abstract class BaseFormatter
extends java.lang.Object

Represent a converter base class. Provides some common methods.


Field Summary
protected  java.lang.String charset
           
static java.lang.String CHARSET_UTF7
           
static java.lang.String CHARSET_UTF8
           
static java.lang.String ENCODING_B64
           
static java.lang.String ENCODING_QP
           
protected  boolean forceClientLocalTime
           
static java.lang.String PLAIN_CHARSET
           
protected  java.util.Vector<java.lang.String> supportedFields
          Specifies the list of supported fields
protected  java.util.TimeZone timezone
           
 
Constructor Summary
BaseFormatter(java.util.TimeZone timezone, java.lang.String charset)
          Deprecated.  
BaseFormatter(java.util.TimeZone timezone, java.lang.String charset, boolean forceDeviceLocalTime)
           
 
Method Summary
 java.lang.StringBuffer composeICalTextComponent(Property property, java.lang.String field)
          Deprecated. Unused since version 6.5, replaced by methods in #com.funambol.common.pim.converter.CalendarContentConverter
protected  java.lang.StringBuffer composeRemainingFields()
          Compose the remaining fields from the supportedFields Vector.
 java.lang.StringBuffer composeVCardComponent(java.lang.String propertyValue, java.util.ArrayList properties, java.lang.String field)
          This method compose the single component of vCard and in particular: 1) encode value with the proper encoding 2) handle the params 3) create a representation of the specificated vCard field
 java.lang.StringBuffer composeVCardComponent(java.lang.String propertyValue, java.util.ArrayList properties, java.lang.String field, boolean excludeCharset)
          This method compose the single component of vCard and in particular: 1) encode value with the proper encoding 2) handle the params 3) create a representation of the specificated vCard field
 java.lang.String encode(java.lang.String value, java.lang.String encoding, java.lang.String charset)
          Replace values with proper encoding
 java.lang.String escapeSeparator(java.lang.String value)
          A SEMI-COLON in a property value MUST be escaped with a '\' character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCODING_QP

public static final java.lang.String ENCODING_QP
See Also:
Constant Field Values

CHARSET_UTF8

public static final java.lang.String CHARSET_UTF8
See Also:
Constant Field Values

CHARSET_UTF7

public static final java.lang.String CHARSET_UTF7
See Also:
Constant Field Values

ENCODING_B64

public static final java.lang.String ENCODING_B64
See Also:
Constant Field Values

PLAIN_CHARSET

public static final java.lang.String PLAIN_CHARSET
See Also:
Constant Field Values

timezone

protected java.util.TimeZone timezone

charset

protected java.lang.String charset

forceClientLocalTime

protected boolean forceClientLocalTime

supportedFields

protected java.util.Vector<java.lang.String> supportedFields
Specifies the list of supported fields

Constructor Detail

BaseFormatter

@Deprecated
public BaseFormatter(java.util.TimeZone timezone,
                                java.lang.String charset)
Deprecated. 

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 - the timezone to use in the conversion
charset - the charset to use in the conversion

BaseFormatter

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

encode

public java.lang.String encode(java.lang.String value,
                               java.lang.String encoding,
                               java.lang.String charset)
                        throws FormatterException
Replace values with proper encoding

Parameters:
value - the value to apply the replacement
encoding - the encoding to use (default is QUOTED-PRINTABLE)
charset - the charset to use (default is UTF-8)
Returns:
String the value replaced
Throws:
FormatterException

composeVCardComponent

public java.lang.StringBuffer composeVCardComponent(java.lang.String propertyValue,
                                                    java.util.ArrayList properties,
                                                    java.lang.String field)
                                             throws FormatterException
This method compose the single component of vCard and in particular: 1) encode value with the proper encoding 2) handle the params 3) create a representation of the specificated vCard field

Parameters:
propertyValue - the value of vCard field
properties - a vector of params
field - the filed name
Returns:
String the representation of the specificated vCard field
Throws:
com.funambol.common.pim.converter.FormatterException - if an error occurs
FormatterException

composeVCardComponent

public java.lang.StringBuffer composeVCardComponent(java.lang.String propertyValue,
                                                    java.util.ArrayList properties,
                                                    java.lang.String field,
                                                    boolean excludeCharset)
                                             throws FormatterException
This method compose the single component of vCard and in particular: 1) encode value with the proper encoding 2) handle the params 3) create a representation of the specificated vCard field

Parameters:
propertyValue - the value of vCard field
properties - a vector of params
field - the filed name
excludeCharset - must the charset be not set ?
Returns:
String the representation of the given vCard field
Throws:
com.funambol.common.pim.converter.FormatterException - if an error occurs
FormatterException

composeICalTextComponent

public java.lang.StringBuffer composeICalTextComponent(Property property,
                                                       java.lang.String field)
                                                throws FormatterException
Deprecated. Unused since version 6.5, replaced by methods in #com.funambol.common.pim.converter.CalendarContentConverter

This method compose the single component of iCalendar and in particular: 1) encode value with the proper encoding 2) handle the params 3) create a representation of the specificated iCalendar field

Parameters:
value - the value of iCalendar field
properties - a vector of params
field - the field name
Returns:
the representation of the specificated iCalendar field as a StringBuffer object
Throws:
FormatterException

composeRemainingFields

protected java.lang.StringBuffer composeRemainingFields()
Compose the remaining fields from the supportedFields Vector.

Returns:

escapeSeparator

public java.lang.String escapeSeparator(java.lang.String value)
A SEMI-COLON in a property value MUST be escaped with a '\' character. A BACKSLASH in a property value MUST be escaped with a '\' character.

Parameters:
value - the value in which replaced the ; and the \


Copyright © 2001-2009 Funambol.