com.funambol.domino.util
Class Utility

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

public class Utility
extends java.lang.Object

Utility class


Constructor Summary
Utility()
           
 
Method Summary
static java.util.Date calcAlarmDate(java.util.Date start, java.util.Date end, long offset)
           
static int calcAlarmOffsetInMinutes(java.util.Date start, java.util.Date end, java.util.Date alarm)
           
static java.lang.String calcAlarmOffsetUnit(int offset)
           
static java.lang.String convertLocalDateToUTC(java.lang.String sDate, java.util.TimeZone timezone)
          Convert the given date following this roles: if the given date is in UTC no conversion is required if the given date is not in UTC and the given timezone isn't null, the date is localizated with the timezone and then it's converted in UTC.
static java.lang.String convertUTCDateToLocal(java.lang.String sDate, java.util.TimeZone timezone)
          Convert the given date following this roles: if the given timezone isn't null, the date is localizated with the timezone and then reformatted in yyyyMMdd'T'HHmmss'Z'.
static java.sql.Timestamp dominoDateTimeToTimestamp(lotus.domino.DateTime dt)
          converts the lotus DateTime to java.sql.Timestamp used by getAllSyncItemInfo()
static java.lang.String getContentFromSyncItem(com.funambol.framework.engine.SyncItem syncItem)
          get content from a SyncItem
static java.lang.String getContentFromSyncItem(com.funambol.framework.engine.SyncItem syncItem, boolean isEncode)
          get content from a SyncItem
static lotus.domino.DateTime getDominoDateTime(lotus.domino.Document doc, java.lang.String label)
          get Date from Domino Document

if there are no related value to the input label the method getItemValueDateTimeArray returns error

static lotus.domino.DateTime getDominoNow(DominoWrapper dominoWrapper)
          used by create and update Todo
static java.lang.String getPassword(java.lang.String username, java.lang.String credentials)
          credantials format: "username:passowrd"
static boolean isAllDayFormat(java.lang.String date)
          Checks if the input String is a representation of a date respecting "yyyy-MM-dd" format.
static boolean isCalendar(java.lang.String content, java.lang.String itemFormat)
          if ICAL --> check if the content contains VEVENT or VTODO if XML --> check if the content contains or
static boolean isTask(java.lang.String content, java.lang.String itemFormat)
          if ICAL --> check if the content contains VEVENT or VTODO if XML --> check if the content contains or
static SyncItemInfo[] mergeArray(SyncItemInfo[] a, SyncItemInfo[] b)
          merge two array
static java.lang.String normalizeToISO8601(java.lang.String sDate, java.util.TimeZone tz, boolean useTimeZone)
          Convert the given sDate in iso 8601 format.>> The format accepted are: yyyyMMdd'T'HHmmss'Z' (if the date is in this format and the given timezone isn't null and useTimeZone is true, the date is localized with the given timezone) yyyy-MM-dd yyyy/MM/dd all formats starts with the previous format (i.e. yyyy-MM-ddTHH:mm:ss.sss)
static lotus.domino.Document searchDominoDocument(DominoWrapper dominoWrapper, java.lang.String formula)
           
static java.lang.String setAllDayClient_StartDate(lotus.domino.DateTime dateTime)
          returns a yyyy-MM-dd format date
static lotus.domino.DateTime setAllDayDomino_Date(DominoWrapper dw, java.lang.String in)
          "in" parameter is a String with a date in DAYFORMAT: yyyy-mm-dd format (for all day event).
static lotus.domino.DateTime setAllDayDomino_EndDateTime(DominoWrapper dw, java.lang.String in)
          "in" parameter is a String with a date in DAYFORMAT: yyyy-mm-dd format (for all day event).
static lotus.domino.DateTime setAllDayDomino_EndTime(DominoWrapper dw)
          we have to create a DateTime with 08:00 PM
static lotus.domino.DateTime setAllDayDomino_StartDateTime(DominoWrapper dw, java.lang.String in)
          "in" parameter is a String with a date in DAYFORMAT: yyyy-mm-dd format (for all day event).
static lotus.domino.DateTime setAllDayDomino_StartTime(DominoWrapper dw)
          we have to create a 04:00:00 AM DateTime
static java.lang.String setClientConfidential(java.lang.String conf, java.lang.String itemFormat)
           
static java.lang.String setClientDateTime(lotus.domino.DateTime d)
          converts a Domino DateTime in a client format:
static java.lang.String setClientDateTime(lotus.domino.DateTime d, java.util.TimeZone timeZone)
           
static java.lang.String setDominoConfidential(java.lang.String conf, java.lang.String itemFormat)
           
static lotus.domino.DateTime setDominoDateTime(DominoWrapper dw, java.lang.String in)
          "in" parameter is a String with a date in UTC format: some phones could send a date in UTC format without 'Z' at the end (i.e. "20050329T110000")

The method parses the Date using "yyyyMMdd'T'HHmmss'Z'" mask.

 
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

dominoDateTimeToTimestamp

public static java.sql.Timestamp dominoDateTimeToTimestamp(lotus.domino.DateTime dt)
converts the lotus DateTime to java.sql.Timestamp used by getAllSyncItemInfo()

Parameters:
dt - DateTime
Returns:
Timestamp

calcAlarmOffsetInMinutes

public static int calcAlarmOffsetInMinutes(java.util.Date start,
                                           java.util.Date end,
                                           java.util.Date alarm)

calcAlarmDate

public static java.util.Date calcAlarmDate(java.util.Date start,
                                           java.util.Date end,
                                           long offset)

calcAlarmOffsetUnit

public static java.lang.String calcAlarmOffsetUnit(int offset)

getDominoNow

public static lotus.domino.DateTime getDominoNow(DominoWrapper dominoWrapper)
used by create and update Todo

Parameters:
dominoWrapper - DominoWrapper
Returns:
DateTime

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

getDominoDateTime

public static lotus.domino.DateTime getDominoDateTime(lotus.domino.Document doc,
                                                      java.lang.String label)
get Date from Domino Document

if there are no related value to the input label the method getItemValueDateTimeArray returns error

Parameters:
doc - Document
label - String
Returns:
DateTime

setClientDateTime

public static java.lang.String setClientDateTime(lotus.domino.DateTime d)
converts a Domino DateTime in a client format:

Parameters:
d - DateTime
Returns:
String

setClientDateTime

public static java.lang.String setClientDateTime(lotus.domino.DateTime d,
                                                 java.util.TimeZone timeZone)

setDominoConfidential

public static java.lang.String setDominoConfidential(java.lang.String conf,
                                                     java.lang.String itemFormat)
Parameters:
conf - String
itemFormat - String
Returns:
String

setDominoDateTime

public static lotus.domino.DateTime setDominoDateTime(DominoWrapper dw,
                                                      java.lang.String in)
"in" parameter is a String with a date in UTC format: some phones could send a date in UTC format without 'Z' at the end (i.e. "20050329T110000")

The method parses the Date using "yyyyMMdd'T'HHmmss'Z'" mask. The method returns a Domino DateTime

Parameters:
dw - DominoWrapper
Returns:
DateTime

setAllDayDomino_StartDateTime

public static lotus.domino.DateTime setAllDayDomino_StartDateTime(DominoWrapper dw,
                                                                  java.lang.String in)
"in" parameter is a String with a date in DAYFORMAT: yyyy-mm-dd format (for all day event). The method parses the Date using "yyyy-MM-dd" mask. The method returns a Domino DateTime

Parameters:
dw - DominoWrapper
Returns:
DateTime

setAllDayDomino_Date

public static lotus.domino.DateTime setAllDayDomino_Date(DominoWrapper dw,
                                                         java.lang.String in)
"in" parameter is a String with a date in DAYFORMAT: yyyy-mm-dd format (for all day event). The method parses the Date using "yyyy-MM-dd" mask. The method returns a Domino DateTime

Parameters:
dw - DominoWrapper
Returns:
DateTime

setAllDayDomino_StartTime

public static lotus.domino.DateTime setAllDayDomino_StartTime(DominoWrapper dw)
we have to create a 04:00:00 AM DateTime

Parameters:
dw - DominoWrapper
Returns:
DateTime

setAllDayClient_StartDate

public static java.lang.String setAllDayClient_StartDate(lotus.domino.DateTime dateTime)
returns a yyyy-MM-dd format date

Parameters:
dateTime - DateTime
Returns:
String formated like this yyyy-MM-dd

setAllDayDomino_EndDateTime

public static lotus.domino.DateTime setAllDayDomino_EndDateTime(DominoWrapper dw,
                                                                java.lang.String in)
"in" parameter is a String with a date in DAYFORMAT: yyyy-mm-dd format (for all day event). The method parses the Date using "yyyy-MM-dd" mask. The method returns a Domino DateTime

Parameters:
dw - DominoWrapper
Returns:
DateTime

setAllDayDomino_EndTime

public static lotus.domino.DateTime setAllDayDomino_EndTime(DominoWrapper dw)
we have to create a DateTime with 08:00 PM

Parameters:
dw - DominoWrapper
Returns:
DateTime

setClientConfidential

public static java.lang.String setClientConfidential(java.lang.String conf,
                                                     java.lang.String itemFormat)
Parameters:
conf - String
itemFormat - String
Returns:
String

getContentFromSyncItem

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

Throws:
EntityException

getContentFromSyncItem

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

Throws:
EntityException

searchDominoDocument

public static lotus.domino.Document searchDominoDocument(DominoWrapper dominoWrapper,
                                                         java.lang.String formula)
                                                  throws EntityException
Parameters:
dominoWrapper - DominoWrapper
formula - String
Returns:
found domino document Document
Throws:
EntityException

convertLocalDateToUTC

public static java.lang.String convertLocalDateToUTC(java.lang.String sDate,
                                                     java.util.TimeZone timezone)
                                              throws java.lang.Exception
Convert the given date following this roles:
  • if the given date is in UTC no conversion is required
  • if the given date is not in UTC and the given timezone isn't null, the date is localizated with the timezone and then it's converted in UTC.
  • the returned string is always in UTC
  • if the given timezone is null and the date isn't in UTC, the date is localizated with the default timezone
  • the given date can be in one beetwen the following formats: yyyyMMdd'T'HHmmss'Z', yyyyMMdd'T'HHmmss
  • Parameters:
    sDate - the given string date to convert
    timezone - TimeZone
    Returns:
    String
    Throws:
    java.lang.Exception

    convertUTCDateToLocal

    public static java.lang.String convertUTCDateToLocal(java.lang.String sDate,
                                                         java.util.TimeZone timezone)
                                                  throws java.lang.Exception
    Convert the given date following this roles:
  • if the given timezone isn't null, the date is localizated with the timezone and then reformatted in yyyyMMdd'T'HHmmss'Z'.
  • the returned string is always in this format yyyyMMdd'T'HHmmss'Z'
  • if the given timezone is null the date is not changed
  • Parameters:
    sDate - the given string date to convert
    timezone - TimeZone
    Returns:
    String
    Throws:
    java.lang.Exception

    normalizeToISO8601

    public static java.lang.String normalizeToISO8601(java.lang.String sDate,
                                                      java.util.TimeZone tz,
                                                      boolean useTimeZone)
                                               throws java.lang.Exception
    Convert the given sDate in iso 8601 format.>>

    The format accepted are:

  • yyyyMMdd'T'HHmmss'Z' (if the date is in this format and the given timezone isn't null and useTimeZone is true, the date is localized with the given timezone)
  • yyyy-MM-dd
  • yyyy/MM/dd
  • all formats starts with the previous format (i.e. yyyy-MM-ddTHH:mm:ss.sss)
  • Parameters:
    sDate - String
    Returns:
    the sDate in iso 8601 format
    Throws:
    java.lang.Exception

    isCalendar

    public static boolean isCalendar(java.lang.String content,
                                     java.lang.String itemFormat)
                              throws EntityException
    if ICAL --> check if the content contains VEVENT or VTODO if XML --> check if the content contains or

    Parameters:
    content - String
    itemFormat - String
    Returns:
    boolean
    Throws:
    EntityException

    isTask

    public static boolean isTask(java.lang.String content,
                                 java.lang.String itemFormat)
                          throws EntityException
    if ICAL --> check if the content contains VEVENT or VTODO if XML --> check if the content contains or

    Parameters:
    content - String
    itemFormat - String
    Returns:
    boolean
    Throws:
    EntityException

    mergeArray

    public static SyncItemInfo[] mergeArray(SyncItemInfo[] a,
                                            SyncItemInfo[] b)
    merge two array

    Parameters:
    a - SyncItemInfo[]
    b - SyncItemInfo[]
    Returns:
    SyncItemInfo[]

    isAllDayFormat

    public static boolean isAllDayFormat(java.lang.String date)
    Checks if the input String is a representation of a date respecting "yyyy-MM-dd" format.

    Parameters:
    date -
    Returns:
    boolean


    Copyright © 2003-2006 Funambol.