com.motorola.iden.udm
Interface UDMEntry

All Known Implementing Classes:
DateBookEvent, PhoneBookEntry

public interface UDMEntry

Represents the common interfaces of an element for a UDM database. A UDM element is a container that references its data through fields. A UDM element is created from a particular UDM list and is associated with that list for the life of the element. The element takes on the field characteristics of the list that is it created or retrieved from; that is, the list dictates what fields that this element contains.

UDM elements can have its data imported and exported using standard byte based formats. Each implementing class defines what formats can be imported and exported for that element.


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


Field Summary
static int DATE
          DATE Data type ID indicating data is a Date.
static int INT
          INT Data type ID indicating data is an Integer.
static int STRING
          STRING Data type ID indicating data is a String.
static int TYPED_STRING
          TYPED_STRING Data type ID indicating data is a String with a further qualifying integer type.
 
Method Summary
 void commit()
          This method commits that data to the underlying data storage for the list.
 long getDate(int fieldID)
          Get a Date field from the Element.
 int getFieldDataType(int fieldID)
          Returns an int representing the data type of the data associated with the given field ID.
 java.lang.String getFieldLabel(int fieldID)
          Returns a String label associated with the given field ID.
 int[] getFields()
          Returns all field IDs in the element that have data stored for them.
 int getInt(int fieldID)
          Get an integer field from the Element.
 java.lang.String getString(int fieldID)
          Get a String field from the Element.
 java.lang.String getTypedString(int fieldID, int typeID)
          Get a String field with a specific type in the element.
 UDMList getUDMList()
          Returns the UDMList associated with this element.
 boolean isModified()
          This method returns a boolean indicating whether any of this element's fields have been modified since the element was retrieved or last committed.
 void setDate(int fieldID, long value)
          Set a Date field in the Element.
 void setInt(int fieldID, int value)
          Set an integer field in the Element.
 void setString(int fieldID, java.lang.String value)
          Set a String field in the Element.
 void setTypedString(int fieldID, int typeID, java.lang.String value)
          Set a String field with a specific type ID in the element.
 

Field Detail

DATE

public static final int DATE
DATE Data type ID indicating data is a Date. Data associated with it is retrieved via getDate() and set via setDate().

Value 1 is assigned to DATE

See Also:
Constant Field Values

INT

public static final int INT
INT Data type ID indicating data is an Integer. Data associated with it is retrieved via getInt() and set via setInt().

Value 2 is assigned to INT

See Also:
Constant Field Values

STRING

public static final int STRING
STRING Data type ID indicating data is a String. Data associated with it is retrieved via getString() and set via setString().

Value 3 is assigned to STRING

See Also:
Constant Field Values

TYPED_STRING

public static final int TYPED_STRING
TYPED_STRING Data type ID indicating data is a String with a further qualifying integer type. Data associated with it is retrieved via getTypedString() and set via setTypedString().

Value 4 is assigned to TYPED_STRING

See Also:
Constant Field Values
Method Detail

getUDMList

public UDMList getUDMList()
Returns the UDMList associated with this element.

Returns:
UDMList associated with this element.

commit

public void commit()
            throws UDMException
This method commits that data to the underlying data storage for the list. This will lock the native database, write the data, and then free the lock.

Throws:
UDMException - if the commit encounters an error and cannot complete.
java.lang.SecurityException - if the application has not been granted write access to the UDM list.

isModified

public boolean isModified()
This method returns a boolean indicating whether any of this element's fields have been modified since the element was retrieved or last committed.

Returns:
boolean true if any fields have been modified since the element was last retrieved or committed, false otherwise.

getFieldDataType

public int getFieldDataType(int fieldID)
                     throws UDMException
Returns an int representing the data type of the data associated with the given field ID. This method is useful for some field IDs that may have different types of data per element.

Parameters:
fieldID - The ID of the field for which the data type is being queried.
Returns:
int representing the type of the data associated with the field.
Throws:
java.lang.IllegalArgumentException - if the field ID is not valid for the derived class.
UDMException - if the field ID is not supported in the implementing instance of the class.

getFieldLabel

public java.lang.String getFieldLabel(int fieldID)
                               throws UDMException
Returns a String label associated with the given field ID.

Returns:
String label for the field.
Throws:
java.lang.IllegalArgumentException - if the field ID is not valid for the implementing class.
UDMException - if the field ID is not supported in the implementing instance of the class.

getFields

public int[] getFields()
Returns all field IDs in the element that have data stored for them. This allows quick access to all of the data stored in the element without having to iterate through all supported fields and checking if data is stored for the field or not.

Returns:
int array of field IDs that have data stored for them.

getDate

public long getDate(int fieldID)
             throws UDMException
Get a Date field from the Element.

Parameters:
fieldID - The field ID to get.
Returns:
a Date in long ms format representing the value of the field or null to indicate the field has not been set.
Throws:
java.lang.IllegalArgumentException - if the field ID is not valid for the derived class.
UDMException - if the field ID is not supported in the implementing instance of the class.

setDate

public void setDate(int fieldID,
                    long value)
             throws UDMException
Set a Date field in the Element.

Parameters:
fieldID - The field ID to set.
value - The value to set the field to. Setting a field to 0 has the effect of clearing it.
Throws:
java.lang.IllegalArgumentException - if the field ID is not valid for the derived class or if the value is outside the range of supported by the native database.
UDMException - if the field ID is not supported in the implementing instance of the class.

getInt

public int getInt(int fieldID)
           throws UDMException
Get an integer field from the Element.

Parameters:
fieldID - The field ID to get.
Returns:
an int representing the value of the field.
Throws:
java.lang.IllegalArgumentException - if the field ID is not valid for the derived class.
UDMException - if the field ID is not supported in the implementing instance of the class.

setInt

public void setInt(int fieldID,
                   int value)
            throws UDMException
Set an integer field in the Element.

Parameters:
fieldID - The field ID to set.
value - The value to set the field to.
Throws:
java.lang.IllegalArgumentException - if the field ID is not valid for the derived class or if the value is outside the range of supported by the native database.
UDMException - if the field ID is not supported in the implementing instance of the class.

getString

public java.lang.String getString(int fieldID)
                           throws UDMException
Get a String field from the Element.

Parameters:
fieldID - The field ID to get.
Returns:
a String representing the value of the field or null to indicate the field has not been set.
Throws:
java.lang.IllegalArgumentException - if the field ID is not valid for the derived class.
UDMException - if the field ID is not supported in the implementing instance of the class.

setString

public void setString(int fieldID,
                      java.lang.String value)
               throws UDMException
Set a String field in the Element.

Parameters:
fieldID - The field ID to set.
value - The value to set the field to. Setting a field to null has the effect of clearing it.
Throws:
java.lang.IllegalArgumentException - if the field ID is not valid for the derived class or if the value is outside the range of supported by the native database.
UDMException - if the field ID is not supported in the implementing instance of the class.

getTypedString

public java.lang.String getTypedString(int fieldID,
                                       int typeID)
                                throws UDMException
Get a String field with a specific type in the element.

Parameters:
fieldID - The field ID to get.
typeID - The specific type for the field to retrieve.
Returns:
a String representing the value of the field/type or null to indicate the field/type has not been set.
Throws:
java.lang.IllegalArgumentException - if the field ID or type ID is not valid for the derived class.
UDMException - if the field ID is not supported in the implementing instance of the class.

setTypedString

public void setTypedString(int fieldID,
                           int typeID,
                           java.lang.String value)
                    throws UDMException
Set a String field with a specific type ID in the element.

Parameters:
fieldID - The field ID to set.
typeID - The type ID for the field.
value - The value to set the field to. Setting a field to null has the effect of clearing it.
Throws:
java.lang.IllegalArgumentException - if the field ID or type ID is not valid for the derived class or if the value is outside the range of supported by the native database.
UDMException - if the field ID is not supported in the implementing instance of the class.