com.motorola.iden.udm
Class DateBook

java.lang.Object
  extended bycom.motorola.iden.udm.DateBook
All Implemented Interfaces:
UDMList

public class DateBook
extends java.lang.Object
implements UDMList

Represents a DateBook list containing DateBook event elements.


MOTOROLA and the Stylized M Logo are registered trademarks of Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© Copyright 2003-2005 Motorola, Inc. All Rights Reserved.


Field Summary
static int NUM_OF_NON_REPEAT_EVENTS
          NUM_OF_NON_REPEAT_EVENTS Total non repeat events in the DateBook native database.
static int NUM_OF_REPEAT_EVENTS
          NUM_OF_REPEAT_EVENTS Total repeat events in the DateBook native database.
static int TOTAL_AVAILABLE
          TOTAL_AVAILABLE Total available slots in the DateBook native database.
static int TOTAL_INUSE
          TOTAL_INUSE Total inuse slots in the DateBook native database.
 
Method Summary
 void close()
          Closes the list, releasing any resources for this list.
 DateBookEvent createDateBookEvent()
          Factory method to create a DateBookEvent for this DateBookEvent list.
 void deleteAllDateBookEvents()
          Removes all DateBookEvents from the list.
 java.util.Enumeration elements()
          Return an Enumeration of all elements in the list.
 java.util.Enumeration elements(long startDate, long endDate)
          Return an Enumeration of all elements in the list.
 int[] getAvailableStorage()
          Returns an integer array the amount of slots available on the native database.
 int[] getEventCount()
          Returns an integer array of the number of used and empty slots in the DateBook native database.
 int getNumOfEntries()
          Returns the amount of entries (not individual numbers) in the list.
 int[] getSupportedFields()
          Returns an int array containing all field IDs supported by this list.
 int[] getSupportedTypes(int fieldID)
          Returns an integer array containing the supported type ids for the given field ID.
 DateBookEvent importDateBookEvent(DateBookEvent element)
          Imports the given DateBookEvent into this DateBookEvent list by making a new DateBookEvent for the list and filling its information with as much information as it can from the provided DateBookEvent.
static boolean isCurrent()
          Returns a flag indicating whether or not a DateBook object has been created since the last native Date Book update.
 boolean isSupportedField(int fieldID)
          Indicates whether or not the given fieldID is supported in this UDM list.
 void removeDateBookEvent(DateBookEvent element)
          Removes a specific DateBookEvent from the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOTAL_AVAILABLE

public static final int TOTAL_AVAILABLE
TOTAL_AVAILABLE Total available slots in the DateBook native database. This field is not supported on Gemini product.

Value 0 is assigned to TOTAL_AVAILABLE.

See Also:
Constant Field Values

TOTAL_INUSE

public static final int TOTAL_INUSE
TOTAL_INUSE Total inuse slots in the DateBook native database. This field is not supported on Gemini product.

Value 1 is assigned to TOTAL_INUSE.

See Also:
Constant Field Values

NUM_OF_REPEAT_EVENTS

public static final int NUM_OF_REPEAT_EVENTS
NUM_OF_REPEAT_EVENTS Total repeat events in the DateBook native database.

Value 0 is assigned to NUM_OF_REPEAT_EVENTS.

See Also:
Constant Field Values

NUM_OF_NON_REPEAT_EVENTS

public static final int NUM_OF_NON_REPEAT_EVENTS
NUM_OF_NON_REPEAT_EVENTS Total non repeat events in the DateBook native database.

Value 1 is assigned to NUM_OF_NON_REPEAT_EVENTS.

See Also:
Constant Field Values
Method Detail

createDateBookEvent

public DateBookEvent createDateBookEvent()
                                  throws UDMException
Factory method to create a DateBookEvent for this DateBookEvent list. Note that creation of the DateBookEvent does not add the DateBookEvent to the list from which the element was created; a specific call to UDMEntry.commit() must be made to commit the element and its data to the list.

Returns:
a newly created DateBookEvent.
Throws:
UDMException - if the element cannot be created (e.g. "there are not enough slots") or the list is no longer accessible or closed.

importDateBookEvent

public DateBookEvent importDateBookEvent(DateBookEvent element)
                                  throws UDMException
Imports the given DateBookEvent into this DateBookEvent list by making a new DateBookEvent for the list and filling its information with as much information as it can from the provided DateBookEvent. If the input DateBookEvent is already in the list, a new DateBookEvent is still created with information similar to the input element (but not necessarily identical). Note that not all data from the input DateBookEvent may be supported in the new DateBookEvent due to field restrictions for the list instance. In this case, data fields not supported are not transferred to the new DateBookEvent object. This call does not write it to the native database. Commit() must be used for instead.

Parameters:
element - the DateBookEvent to import into the list.
Returns:
a newly created DateBookEvent after it has been persisted to the database.
Throws:
UDMException - If an error occurs or there is not enough space or the list is no longer accessible or closed.
java.lang.IllegalArgumentException - If the DateBookEvent is null.
java.lang.SecurityException - if the application is not given permission to write to the DateBookEvent list.

removeDateBookEvent

public void removeDateBookEvent(DateBookEvent element)
                         throws UDMException
Removes a specific DateBookEvent from the list. The element must already exist in the list for this method to succeed.

Parameters:
element - the DateBookEvent to be removed from the list.
Throws:
UDMException - If an error occurs deleting the item or the list is no longer accessible or closed.
java.lang.IllegalArgumentException - If the DateBookEvent is null.
java.lang.SecurityException - if the application is not given permission to write to the DateBookEvent list.

deleteAllDateBookEvents

public void deleteAllDateBookEvents()
                             throws UDMException
Removes all DateBookEvents from the list.

Throws:
UDMException - If an error occurs deleting the item or the list is no longer accessible or closed.
java.lang.SecurityException - if the application is not given permission to write to the DateBookEvent list.

getEventCount

public int[] getEventCount()
                    throws UDMException
Returns an integer array of the number of used and empty slots in the DateBook native database. Each non-repeat event occupies 1 slot. Each repeat event occupies two slots. This number may differ from the amount slots in the current list if they are not committed.

Returns:
an integer array of the number of used and empty slots in the DateBook native database. The fields NUM_OF_REPEAT_EVENTS, NUM_OF_NON_REPEAT_EVENTS and NUM_OF_EVENTS are used to index into the array.
Throws:
UDMException - if the list is closed or is no longer accessible.

elements

public java.util.Enumeration elements(long startDate,
                                      long endDate)
                               throws UDMException
Return an Enumeration of all elements in the list. The order is undefined.

Parameters:
startDate - inclusively begin looking for events on this date in long ms format.
endDate - inclusively stop looking for events beyond this date in long ms format.
Returns:
an Enumeration of all Events between startDate and endDate.
Throws:
java.lang.IllegalArgumentException - if the value is outside the range supported by the native database.
UDMException - If the operation is unsupported, an error occurs, or the list is no longer accessible or closed.

close

public void close()
           throws UDMException
Closes the list, releasing any resources for this list. A UDMException is thrown for any subsequent method invocations for the class instance.

Specified by:
close in interface UDMList
Throws:
UDMException - If the list is no longer accessible.

elements

public java.util.Enumeration elements()
                               throws UDMException
Return an Enumeration of all elements in the list. The order is undefined.

Specified by:
elements in interface UDMList
Returns:
an Enumeration of all elements.
Throws:
UDMException - If an error occurs or the list is no longer accessible or closed.

isCurrent

public static boolean isCurrent()
Returns a flag indicating whether or not a DateBook object has been created since the last native Date Book update. This method is not supported on Gemini and always returns true.

Returns:
true if the last DateBook object created is current, no new object was created.

isSupportedField

public boolean isSupportedField(int fieldID)
                         throws UDMException
Indicates whether or not the given fieldID is supported in this UDM list.

Specified by:
isSupportedField in interface UDMList
Parameters:
fieldID - The fieldID to check, as defined by the UDMEntry subclasses. The acceptable fieldIDs should be DateBookEvent.START, DateBookEvent.END, DateBookEvent.ALARM, DateBookEvent.SUMMARY, DateBookEvent.LOCATION, DateBookEvent.REVISION, DateBookEvent.RINGER, DateBookEvent.STYLE, DateBookEvent.MIDLET_SUITE and DateBookEvent.MIDLET. Only START, END, SUMMARY, LOCATION and ALARM are supported on Gemini product.
Returns:
true if supported, false otherwise.
Throws:
java.lang.IllegalArgumentException - if fieldID is an invalid ID for this list.
UDMException - if the list is closed or is no longer accessible.

getSupportedFields

public int[] getSupportedFields()
                         throws UDMException
Returns an int array containing all field IDs supported by this list.

Specified by:
getSupportedFields in interface UDMList
Returns:
an int array containing all field IDs supported by this list.
Throws:
UDMException - - if the list is closed or is no longer accessible.

getSupportedTypes

public int[] getSupportedTypes(int fieldID)
                        throws UDMException
Returns an integer array containing the supported type ids for the given field ID. Some field IDs may have types associated with them to distinguish between different types of the same field. If there are no types to return, a zero length array is returned.

Specified by:
getSupportedTypes in interface UDMList
Parameters:
fieldID - the fieldID to check
Throws:
java.lang.IllegalArgumentException - if fieldID is not one of the valid field IDs for the implementing class.
UDMException - if the list is closed or is no longer accessible.

getAvailableStorage

public int[] getAvailableStorage()
                          throws UDMException
Returns an integer array the amount of slots available on the native database. This number may differ from the amount slots in the current list. This method is not supported on Gemini product.

Returns:
An array of integers representing the amount of additional slots that can be stored on the native database.
Throws:
UDMException - if the list is closed or is no longer accessible.

getNumOfEntries

public int getNumOfEntries()
                    throws UDMException
Returns the amount of entries (not individual numbers) in the list.

Specified by:
getNumOfEntries in interface UDMList
Returns:
The amount of Entry objects contained in the list
Throws:
UDMException - if the list is closed or is no longer accessible.