com.ibm.notes.java.api.util
Class NotesDocumentUtil

java.lang.Object
  extended by com.ibm.notes.java.api.util.NotesDocumentUtil

public class NotesDocumentUtil
extends Object

Utility class containing static methods to assist manipulating back-end documents.


Method Summary
static void appendItemValues(Document document, Map fields)
          Append the given fields to the document.
static Calendar getCalendar(int year, int month, int day, int hour, int minutes, int seconds, int milli, TimeZone zone)
          Returns the calendar with the specified date and time set.
static Calendar getCalendarDate(int year, int month, int day)
          Returns the calendar with the specified date.
static Calendar getCalendarTime(int hour, int minutes, int seconds, int milli)
          Returns the calendar with the specified time.
static DateTime getDateTime(Session session, Calendar cal)
          Creates a DateTime object from the specified Calendar object and session.
static DateTime getDateTime(Session session, Date date)
          Creates a DateTime object from the specified Date object and session.
static boolean hasDate(Calendar calendar)
          Determines whether the given calendar contains date information.
static boolean hasTime(Calendar calendar)
          Determines whether the calendar contains time information.
static void setForm(Document document, String form)
          Sets the form value on the given document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

appendItemValues

public static void appendItemValues(Document document,
                                    Map fields)
                             throws NotesException 
Append the given fields to the document.

Parameters:
document - document to append fields to
fields - map from field name to value; the following value types will be created from the noted Objects:
Text: String
Number: Integer, Double
DateTime: Date, Calendar, DateTime
Any Item: Item
List: List of above items
Throws:
NotesException - thrown when the values cannot be appended
Since:
1.5.1

setForm

public static void setForm(Document document,
                           String form)
                    throws NotesException 
Sets the form value on the given document.

Parameters:
document - document to set form on
form - name of the form
Throws:
NotesException - thrown when the form cannot be set
Since:
1.5.1

hasTime

public static boolean hasTime(Calendar calendar)
Determines whether the calendar contains time information.

Parameters:
calendar - calendar to operate on
Returns:
true if the calendar has time, false if it doesn't
Since:
1.5.1

hasDate

public static boolean hasDate(Calendar calendar)
Determines whether the given calendar contains date information.

Parameters:
calendar - calendar to operate on
Returns:
true if the calendar has date information, false otherwise
Since:
1.5.1

getCalendarDate

public static Calendar getCalendarDate(int year,
                                       int month,
                                       int day)
Returns the calendar with the specified date.

Parameters:
year - year to set the calendar to
month - month to set the calendar to
day - day to set the calendar to
Returns:
calendar Object with the specified date
Since:
1.5.1

getCalendarTime

public static Calendar getCalendarTime(int hour,
                                       int minutes,
                                       int seconds,
                                       int milli)
Returns the calendar with the specified time.

Parameters:
hour - hour to set the calendar to
minutes - minutes to set the calendar to
seconds - seconds to set the calendar to
milli - milliseconds to set the calendar to
Returns:
calendar object with the specified time set.
Since:
1.5.1

getCalendar

public static Calendar getCalendar(int year,
                                   int month,
                                   int day,
                                   int hour,
                                   int minutes,
                                   int seconds,
                                   int milli,
                                   TimeZone zone)
Returns the calendar with the specified date and time set.

Parameters:
year - year to set the calendar to
month - month to set the calendar to
day - day to set the calendar to
hour - hour to set the calendar to
minutes - minutes to set the calendar to
seconds - seconds to set the calendar to
milli - milliseconds to set the calendar to
zone - time zone to set the calendar to
Returns:
the calendar with the specified date and time set
Since:
1.5.1

getDateTime

public static DateTime getDateTime(Session session,
                                                Date date)
                                         throws NotesException 
Creates a DateTime object from the specified Date object and session.

Parameters:
session - session to create the DateTime object from
date - date to set the DateTime object to
Returns:
DateTime object set with the specified information from the date
Throws:
NotesException - thrown when the DateTime object cannot be created from the session
Since:
1.5.1

getDateTime

public static DateTime getDateTime(Session session,
                                                Calendar cal)
                                         throws NotesException 
Creates a DateTime object from the specified Calendar object and session.

Parameters:
session - session to create the DateTime object from
cal - calendar to set the DateTime object to
Returns:
DateTime object with the specified information set from the calendar
Throws:
NotesException - thrown when the DateTime object cannot be created from the session
Since:
1.5.1