com.funambol.email.util
Class Utility

java.lang.Object
  extended bycom.funambol.email.util.Utility

public class Utility
extends java.lang.Object

Utility class


Constructor Summary
Utility()
           
 
Method Summary
static java.lang.String convertNokiaToDefault(java.lang.String oldfolder, DefaultFolder df)
          converts the Nokia folder name in the defaul folder name
static java.lang.String convertOutboxIDToSentID(java.lang.String oldID)
          converts the id of an email in the sent folder with an ID for and email in the outbox folder
static java.lang.String convertSentIDToOutboxID(java.lang.String oldID)
          converts the id of an email in the sent folder with an ID for and email in the outbox folder
static java.lang.String decode(java.lang.String text, java.lang.String encodeType)
          Decode the given text considering it encoded with the given encode type.
static boolean defaultFolderChecker(DefaultFolder df, java.lang.String fullPath)
          the method checks if the folder is a default folder On Exchange server the Default folder are: - /Inbox - /Outbox - /Sent - /Draft - /Trash It's depend of the language (see configuration panel)
static int getComparisonTerm(java.lang.String timeFilterClause)
           
static java.lang.String getContentFromSyncItem(com.funambol.framework.engine.SyncItem syncItem)
          get content from a SyncItem
static java.lang.String getDefaultFolderId(DefaultFolder df, java.lang.String fullPath)
          the method checks if the folder is a default folder On Exchange server the Default folder are: - /Inbox - /Outbox - /Sent - /Draft - /Trash It's depend of the language (see configuration panel)
static java.lang.String getFolderCreationDate()
          set creation date of a folder
static java.lang.String getFolderNameFromFullpath(java.lang.String fullpath)
           
static java.lang.String getFolderRole(java.lang.String folderName, DefaultFolder df)
          set folder role using the name
static java.lang.String getGUID(java.lang.String FID, java.lang.String FMID)
          sets the GUID = FID + Def.SEPARATOR + FMID
static java.util.Date getHeaderDate(javax.mail.Message message, java.util.Locale loc)
          Returns an origination date in UTC format Available Date Parser pat_1: Exchange 2003 (eng): wed, 6 Oct 2005 09:46:47 +0200 pat_2: Exchange 2000 (eng): 6 Oct 2005 09:46:47 +0200 pat_3: BB client : Wed Dec 28 20:05:53 GMT 2005 before apply the pat_4 parser you have to use the private method bb7290toRFC822() pat_4: BB client 7290 : Wed Feb 01 10:49:21 Europe/Amsterdam 2006
static java.lang.String getHeaderMessageID(javax.mail.Message message)
           
static java.lang.String getHeaderMessageID(java.lang.String msg)
          get the message id from the email that the client try to send format: Message-ID: O/AAAAAK8wAAACAAAAggAAAA==@192.168.55.101
static java.lang.String getHeaderSyncLabel(javax.mail.Message message)
           
static java.lang.String getIdAfterSeparator(java.lang.String key)
           
static java.lang.String[] getIdBeforeAndAfter(com.funambol.framework.engine.SyncItem syncItem)
          the Funambol client send id in format: I/1234 the mobile phone can send the LUID not in the format : 1234
static java.lang.String getIdBeforeSeparator(java.lang.String key)
          sets the folder target id
static java.lang.String getParentFullpathFromFullpath(java.lang.String fullpath)
          gets the parent path of a folder using the full folder path
static java.lang.String getPassword(java.lang.String username, java.lang.String credentials)
          credantials format: "username:passowrd"
static java.lang.String getReceivedDate(javax.mail.Message message, java.util.Locale loc)
          Date : Thu Oct 06 09:46:47 CEST 2005 Returns a received date in UTC format
static java.lang.String getStreamFromMessage(javax.mail.Message msg, java.lang.String encodingType)
          convert Message in a String (RFC2822)
static CrcSyncItemInfo[] mergeArray(CrcSyncItemInfo[] i, CrcSyncItemInfo[] o, CrcSyncItemInfo[] d, CrcSyncItemInfo[] s, CrcSyncItemInfo[] t)
          merge arrays
static ItemFolder[] mergeArray(ItemFolder[] i, ItemFolder[] o, ItemFolder[] d, ItemFolder[] s, ItemFolder[] t)
          merge arrays
static java.lang.String[] mergeArray(java.lang.String[] i, java.lang.String[] o, java.lang.String[] d, java.lang.String[] s, java.lang.String[] t)
          merge arrays
static boolean needsFlagOptimization(char status, java.lang.String FID)
          Checks if it's possible to optimize the syncml message dimension.
static long setLastCrc(javax.mail.Message msg)
           
static java.lang.String[] setNewHeader(javax.mail.Message newMsg, javax.mail.Message oldMsg)
          set a new header but keep the old Message-ID
static java.lang.String UtcFromDate(java.util.Date origDate)
           
static java.util.Date UtcToDate(java.lang.String utc)
          convert the UTC string in a Date
static java.sql.Timestamp UtcToTimestamp(java.lang.String utc)
          convert the UTC string in a Timestamp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Utility

public Utility()
Method Detail

getPassword

public static java.lang.String getPassword(java.lang.String username,
                                           java.lang.String credentials)
credantials format: "username:passowrd"

Parameters:
username - String
credentials - String
Returns:
password String

convertNokiaToDefault

public static java.lang.String convertNokiaToDefault(java.lang.String oldfolder,
                                                     DefaultFolder df)
converts the Nokia folder name in the defaul folder name

Parameters:
oldfolder - folder name in the Server String
df - DefaultFolder
Returns:
newfolder folder name in the Nokia device String

convertSentIDToOutboxID

public static java.lang.String convertSentIDToOutboxID(java.lang.String oldID)
converts the id of an email in the sent folder with an ID for and email in the outbox folder

Returns:
newfolder folder name in the Nokia device String

convertOutboxIDToSentID

public static java.lang.String convertOutboxIDToSentID(java.lang.String oldID)
converts the id of an email in the sent folder with an ID for and email in the outbox folder

Returns:
newfolder folder name in the Nokia device String

getContentFromSyncItem

public static java.lang.String getContentFromSyncItem(com.funambol.framework.engine.SyncItem syncItem)
                                               throws EntityException
get content from a SyncItem

Parameters:
syncItem - SyncItem
Returns:
content of the SyncItem String
Throws:
EntityException

getHeaderMessageID

public static java.lang.String getHeaderMessageID(javax.mail.Message message)
Parameters:
message - Message
Returns:
String

getHeaderMessageID

public static java.lang.String getHeaderMessageID(java.lang.String msg)
get the message id from the email that the client try to send format: Message-ID: O/AAAAAK8wAAACAAAAggAAAA==@192.168.55.101

Returns:
String

getHeaderSyncLabel

public static java.lang.String getHeaderSyncLabel(javax.mail.Message message)
Parameters:
message - Message
Returns:
String

getHeaderDate

public static java.util.Date getHeaderDate(javax.mail.Message message,
                                           java.util.Locale loc)
Returns an origination date in UTC format Available Date Parser pat_1: Exchange 2003 (eng): wed, 6 Oct 2005 09:46:47 +0200 pat_2: Exchange 2000 (eng): 6 Oct 2005 09:46:47 +0200 pat_3: BB client : Wed Dec 28 20:05:53 GMT 2005 before apply the pat_4 parser you have to use the private method bb7290toRFC822() pat_4: BB client 7290 : Wed Feb 01 10:49:21 Europe/Amsterdam 2006

Parameters:
message - Message
loc - Locale
Returns:
String

getReceivedDate

public static java.lang.String getReceivedDate(javax.mail.Message message,
                                               java.util.Locale loc)
Date : Thu Oct 06 09:46:47 CEST 2005 Returns a received date in UTC format

Parameters:
message - Message
loc - Locale
Returns:
String

defaultFolderChecker

public static boolean defaultFolderChecker(DefaultFolder df,
                                           java.lang.String fullPath)
                                    throws EntityException
the method checks if the folder is a default folder On Exchange server the Default folder are: - /Inbox - /Outbox - /Sent - /Draft - /Trash It's depend of the language (see configuration panel)

Parameters:
df - DefaultFolder
fullPath - String
Returns:
boolean
Throws:
EntityException

getDefaultFolderId

public static java.lang.String getDefaultFolderId(DefaultFolder df,
                                                  java.lang.String fullPath)
                                           throws EntityException
the method checks if the folder is a default folder On Exchange server the Default folder are: - /Inbox - /Outbox - /Sent - /Draft - /Trash It's depend of the language (see configuration panel)

Parameters:
df - DefaultFolder
fullPath - String
Returns:
folder id String
Throws:
EntityException

getFolderNameFromFullpath

public static java.lang.String getFolderNameFromFullpath(java.lang.String fullpath)
Parameters:
fullpath - String
Returns:
String

getFolderRole

public static java.lang.String getFolderRole(java.lang.String folderName,
                                             DefaultFolder df)
set folder role using the name

Parameters:
folderName - String
Returns:
folder role String

getFolderCreationDate

public static java.lang.String getFolderCreationDate()
set creation date of a folder

Returns:
UTC creation date String

getParentFullpathFromFullpath

public static java.lang.String getParentFullpathFromFullpath(java.lang.String fullpath)
gets the parent path of a folder using the full folder path

Parameters:
fullpath - String
Returns:
String

getIdAfterSeparator

public static java.lang.String getIdAfterSeparator(java.lang.String key)
Parameters:
key - String
Returns:
String

UtcToTimestamp

public static java.sql.Timestamp UtcToTimestamp(java.lang.String utc)
convert the UTC string in a Timestamp

Parameters:
utc - String
Returns:
Timestamp

UtcToDate

public static java.util.Date UtcToDate(java.lang.String utc)
convert the UTC string in a Date

Parameters:
utc - String
Returns:
Date

getStreamFromMessage

public static java.lang.String getStreamFromMessage(javax.mail.Message msg,
                                                    java.lang.String encodingType)
                                             throws javax.mail.MessagingException
convert Message in a String (RFC2822)

Parameters:
msg - Message
Returns:
String
Throws:
javax.mail.MessagingException

mergeArray

public static java.lang.String[] mergeArray(java.lang.String[] i,
                                            java.lang.String[] o,
                                            java.lang.String[] d,
                                            java.lang.String[] s,
                                            java.lang.String[] t)
merge arrays

Parameters:
i - CrcSyncItemInfo[]
o - CrcSyncItemInfo[]
d - CrcSyncItemInfo[]
s - CrcSyncItemInfo[]
t - CrcSyncItemInfo[]
Returns:
CrcSyncItemInfo[]

mergeArray

public static CrcSyncItemInfo[] mergeArray(CrcSyncItemInfo[] i,
                                           CrcSyncItemInfo[] o,
                                           CrcSyncItemInfo[] d,
                                           CrcSyncItemInfo[] s,
                                           CrcSyncItemInfo[] t)
merge arrays

Parameters:
i - CrcSyncItemInfo[]
o - CrcSyncItemInfo[]
d - CrcSyncItemInfo[]
s - CrcSyncItemInfo[]
t - CrcSyncItemInfo[]
Returns:
CrcSyncItemInfo[]

mergeArray

public static ItemFolder[] mergeArray(ItemFolder[] i,
                                      ItemFolder[] o,
                                      ItemFolder[] d,
                                      ItemFolder[] s,
                                      ItemFolder[] t)
merge arrays

Parameters:
i - CrcSyncItemInfo[]
o - CrcSyncItemInfo[]
d - CrcSyncItemInfo[]
s - CrcSyncItemInfo[]
t - CrcSyncItemInfo[]
Returns:
CrcSyncItemInfo[]

setLastCrc

public static long setLastCrc(javax.mail.Message msg)
Parameters:
msg - Message
Returns:
long

setNewHeader

public static java.lang.String[] setNewHeader(javax.mail.Message newMsg,
                                              javax.mail.Message oldMsg)
                                       throws EntityException
set a new header but keep the old Message-ID

Parameters:
newMsg - Message
oldMsg - Message
Returns:
header-id and header dimension
Throws:
EntityException

getIdBeforeSeparator

public static java.lang.String getIdBeforeSeparator(java.lang.String key)
sets the folder target id

Parameters:
key - Sync Item key Value String
Returns:
String

getIdBeforeAndAfter

public static java.lang.String[] getIdBeforeAndAfter(com.funambol.framework.engine.SyncItem syncItem)
the Funambol client send id in format: I/1234 the mobile phone can send the LUID not in the format : 1234

Parameters:
syncItem - SyncItem
Returns:
FID and FMID in an array String[]

getGUID

public static java.lang.String getGUID(java.lang.String FID,
                                       java.lang.String FMID)
sets the GUID = FID + Def.SEPARATOR + FMID

Parameters:
FID - folder id String
FMID - mail id in the folder String
Returns:
String

getComparisonTerm

public static int getComparisonTerm(java.lang.String timeFilterClause)
Parameters:
timeFilterClause - String
Returns:
comparison term for time filter int

UtcFromDate

public static java.lang.String UtcFromDate(java.util.Date origDate)
Parameters:
origDate - Date
Returns:
String

decode

public static java.lang.String decode(java.lang.String text,
                                      java.lang.String encodeType)
                               throws javax.mail.MessagingException

Decode the given text considering it encoded with the given encode type.

Parameters:
text -
encodeType -
Returns:
the decoded text
Throws:
javax.mail.MessagingException

needsFlagOptimization

public static boolean needsFlagOptimization(char status,
                                            java.lang.String FID)
Checks if it's possible to optimize the syncml message dimension. For instance: an email in the inbox with only the 'read' flag updated and already on the client

Parameters:
status - status of the item; char
FID - parent id of the item: String
Returns:
true if it's possible to optimize the syncml dimension


Copyright © 2003-2006 Funambol.