org.jSyncManager.API.Protocol.Util.StdApps

Class AddressRecord

Implemented Interfaces:
Serializable

public class AddressRecord
extends DLPRecord

A class to represent the structure and data of a record from the Address handheld application.

Field Summary

static int
ADDRESS_FLAG
A flag to denote that an address is present in this record.
static int
CITY_FLAG
A flag to denote that a cite is present is this record.
static int
COMPANY_FLAG
A flag to denote that a company name is present in this record.
static int
COUNTRY_FLAG
A flag to denote that a country is present in this record.
static int
CUSTOM1_FLAG
A flag to denote that the 1st Custom field is present in this record.
static int
CUSTOM2_FLAG
A flag to denote that the 2nd Custom field is present in this record.
static int
CUSTOM3_FLAG
A flag to denote that the 3rd Custom field is present in this record.
static int
CUSTOM4_FLAG
A flag to denote that the 4th Custom field is present in this record.
static int
EMAIL_LABEL
Denotes that this phone field is an e-mail address.
static int
FAX_LABEL
Denotes that this phone field is a facsimilie (fax) telephone number.
static int
GIVENNAME_FLAG
A flag to denote that a given name is present in this record.
static int
HOME_LABEL
Denotes that this phone field is a home telephone number.
static int
MAIN_LABEL
Denotes that this phone field is a "main" telephone number.
static int
MAX_CUSTOMFIELDS
The maximum number of custom fields allowed.
static int
MAX_DATAFLAGS
The maximum number of data flags allowed.
static int
MAX_PHONELABELS
The maximum number of phone labels allowed.
static int
MAX_PHONES
The maximum number of phone/fax/mobile/e-mail fields.
static int
MOBILE_LABEL
Denotes that this phone field is a mobile/cellular telephone number.
static int
NOTE_FLAG
A flag to denote that a note is present in this record.
static int
OTHER_LABEL
Denotes that this phone field is an "other" phone number.
static int
PAGER_LABEL
Denotes that this phone field is a pager telephone number.
static int
PHONE1_FLAG
A flag to denote that phone entry #1 is present in this record.
static int
PHONE2_FLAG
A flag to denote that phone entry #2 is present in this record.
static int
PHONE3_FLAG
A flag to denote that phone entry #3 is present in this record.
static int
PHONE4_FLAG
A flag to denote that phone entry #4 is present in this record.
static int
PHONE5_FLAG
A flag to denote that phone entry #5 is present in this record.
static int
POSTALCODE_FLAG
A flag to denote that a postal code is present in this record.
static int
PROVINCE_FLAG
A flag to denote that a province/state is present is this record.
static int
SURNAME_FLAG
A flag to denote that a sur/family name is present in this record.
static int
TITLE_FLAG
A flag to denote that a title (honourific) is present in this record.
static int
WORK_LABEL
Denotes that this phone field is a work telephone number.

Fields inherited from class org.jSyncManager.API.Protocol.Util.DLPRecord

ARCHIVED, BUSY, DATA_INCLUDED, DELETED, DELETE_ALL_IN_CATEGORY, DELETE_ALL_RECORDS, DIRTY, SECRET, SORT_DATABASE, attributes, category, data, index, inputData, recordID, recordSize

Constructor Summary

AddressRecord()
Construct a new, empty address record with null/default values.
AddressRecord(DLPRecord record)
Construct a new Address Record object based on the provided record input from the handheld.

Method Summary

boolean
checkFlags(int flags)
Check flags input integer and return whether the flags are set or not.
protected void
generateData()
Generates a byte array representation of this object, storing it in this objects data byte array.
String
getAddress()
Gets the address information from this record, if present.
String
getCity()
Gets the city information from this record, if present.
String
getCompany()
Gets the company information from this record, if present.
String
getCountry()
Gets the country information from this record, if present.
java.lang.String
getCustomField(int i)
Gets the specified custom field information from this record, if present.
java.lang.String[]
getCustomFields()
Gets the custom field information from this record, if present.
int
getDisplayForList()
Returns the value of the "Display For List" flagset.
String
getGivenName()
Gets the given (first) name information from this record, if present.
String
getNote()
Gets the note information from this record, if present.
int
getPhoneField(int i)
Gets the specified phone field type.
String
getPhoneFieldTitle(int fieldID)
Gets the title for the specified phone field.
int[]
getPhoneFields()
Gets the phone field type information.
java.lang.String[]
getPhones()
Gets all telephone data in this record, as Strings.
java.lang.String
getPhones(int i)
Get the phone information for the specified field.
String
getPostalCode()
Gets the postal (zip) code information from this record, if present.
String
getProvince()
Gets the province information from this record, if present.
String
getState()
Gets the state information from this record, if present.
String
getSurname()
Gets the surname (family name) information from this record, if present.
String
getTitle()
Gets the title (honourific) information from this record, if present.
protected void
parseFields()
Parses the data array into a series of fields.
void
setAddress(String newValue)
Sets the address line for this record.
void
setCity(String newValue)
Sets the city line for this record.
void
setCompany(String newValue)
Sets the company line for this record.
void
setCountry(String newValue)
Sets the country line for this record.
void
setCustomField(java.lang.String newValue, int num)
Sets the specified custom field to the specified data.
void
setCustomFields(newValue[] )
Sets the custom fields for this record.
void
setDisplayForList(int newValue)
Sets the display for list bitmap to the specified value.
void
setFlags(int flags, boolean value)
This method allows for the manual setting of the contents bitmap for this address record.
void
setGivenName(String newValue)
Sets the given name field for this record.
void
setNote(String newValue)
Sets the note for this record.
void
setPhone(java.lang.String newValue, int num)
Sets the specified phone field to the specified value.
void
setPhoneField(int num, int newValue)
Deprecated. use setPhoneType (changed parameter sequence matching setPhone to avoid confusion).
void
setPhoneFields(tmpOrders[] )
Sets the telephone fields for this record.
void
setPhoneType(int newValue, int num)
Sets the type of a phone field.
void
setPhones(newValue[] )
Set the phone data array to the specified value.
void
setPostalCode(String newValue)
Sets the postal (zip) code line for this record.
void
setProvince(String newValue)
Sets the province line for this record.
void
setState(String newValue)
Sets the state line for this record.
void
setSurname(String newValue)
Sets the surname (family name) line for this record.
void
setTitle(String newValue)
Sets the title (honourific) line for this record.
String
toString()
Converts this address record to a human-readable String.
String
toString(AddressAppBlock appBlock)
Converts this address record to a human-readable String, using the specified Address Application Block object.

Methods inherited from class org.jSyncManager.API.Protocol.Util.DLPRecord

addAttribute, checkAttribute, clearAttribute, generateData, getAttributes, getCategory, getData, getIndex, getRecordID, getRecordSize, parseFields, setAttributes, setCategory, setData, setIndex, setRecordID, setRecordSize, toString

Field Details

ADDRESS_FLAG

public static final int ADDRESS_FLAG
A flag to denote that an address is present in this record.
Field Value:
256

CITY_FLAG

public static final int CITY_FLAG
A flag to denote that a cite is present is this record.
Field Value:
512

COMPANY_FLAG

public static final int COMPANY_FLAG
A flag to denote that a company name is present in this record.
Field Value:
4

COUNTRY_FLAG

public static final int COUNTRY_FLAG
A flag to denote that a country is present in this record.
Field Value:
4096

CUSTOM1_FLAG

public static final int CUSTOM1_FLAG
A flag to denote that the 1st Custom field is present in this record.
Field Value:
16384

CUSTOM2_FLAG

public static final int CUSTOM2_FLAG
A flag to denote that the 2nd Custom field is present in this record.
Field Value:
32768

CUSTOM3_FLAG

public static final int CUSTOM3_FLAG
A flag to denote that the 3rd Custom field is present in this record.
Field Value:
65536

CUSTOM4_FLAG

public static final int CUSTOM4_FLAG
A flag to denote that the 4th Custom field is present in this record.
Field Value:
131072

EMAIL_LABEL

public static final int EMAIL_LABEL
Denotes that this phone field is an e-mail address.
Field Value:
4

FAX_LABEL

public static final int FAX_LABEL
Denotes that this phone field is a facsimilie (fax) telephone number.
Field Value:
2

GIVENNAME_FLAG

public static final int GIVENNAME_FLAG
A flag to denote that a given name is present in this record.
Field Value:
2

HOME_LABEL

public static final int HOME_LABEL
Denotes that this phone field is a home telephone number.
Field Value:
1

MAIN_LABEL

public static final int MAIN_LABEL
Denotes that this phone field is a "main" telephone number.
Field Value:
5

MAX_CUSTOMFIELDS

public static final int MAX_CUSTOMFIELDS
The maximum number of custom fields allowed.
Field Value:
4

MAX_DATAFLAGS

public static final int MAX_DATAFLAGS
The maximum number of data flags allowed.
Field Value:
32

MAX_PHONELABELS

public static final int MAX_PHONELABELS
The maximum number of phone labels allowed.
Field Value:
8

MAX_PHONES

public static final int MAX_PHONES
The maximum number of phone/fax/mobile/e-mail fields.
Field Value:
5

MOBILE_LABEL

public static final int MOBILE_LABEL
Denotes that this phone field is a mobile/cellular telephone number.
Field Value:
7

NOTE_FLAG

public static final int NOTE_FLAG
A flag to denote that a note is present in this record.
Field Value:
262144

OTHER_LABEL

public static final int OTHER_LABEL
Denotes that this phone field is an "other" phone number.
Field Value:
3

PAGER_LABEL

public static final int PAGER_LABEL
Denotes that this phone field is a pager telephone number.
Field Value:
6

PHONE1_FLAG

public static final int PHONE1_FLAG
A flag to denote that phone entry #1 is present in this record.
Field Value:
8

PHONE2_FLAG

public static final int PHONE2_FLAG
A flag to denote that phone entry #2 is present in this record.
Field Value:
16

PHONE3_FLAG

public static final int PHONE3_FLAG
A flag to denote that phone entry #3 is present in this record.
Field Value:
32

PHONE4_FLAG

public static final int PHONE4_FLAG
A flag to denote that phone entry #4 is present in this record.
Field Value:
64

PHONE5_FLAG

public static final int PHONE5_FLAG
A flag to denote that phone entry #5 is present in this record.
Field Value:
128

POSTALCODE_FLAG

public static final int POSTALCODE_FLAG
A flag to denote that a postal code is present in this record.
Field Value:
2048

PROVINCE_FLAG

public static final int PROVINCE_FLAG
A flag to denote that a province/state is present is this record.
Field Value:
1024

SURNAME_FLAG

public static final int SURNAME_FLAG
A flag to denote that a sur/family name is present in this record.
Field Value:
1

TITLE_FLAG

public static final int TITLE_FLAG
A flag to denote that a title (honourific) is present in this record.
Field Value:
8192

WORK_LABEL

public static final int WORK_LABEL
Denotes that this phone field is a work telephone number.
Field Value:
0

Constructor Details

AddressRecord

public AddressRecord()
Construct a new, empty address record with null/default values.

AddressRecord

public AddressRecord(DLPRecord record)
            throws ParseException
Construct a new Address Record object based on the provided record input from the handheld.
Parameters:
record - a DLPRecord object containing an Address record byte array.

Method Details

checkFlags

public boolean checkFlags(int flags)
Check flags input integer and return whether the flags are set or not.
Parameters:
flags - the flag to test.
Returns:
true if this flag is set, false otherwise.

generateData

protected void generateData()
Generates a byte array representation of this object, storing it in this objects data byte array.
Overrides:
generateData in interface DLPRecord

getAddress

public String getAddress()
Gets the address information from this record, if present. If address data is not present, null will be returned.
Returns:
the information from the address field, or null if it's not present.

getCity

public String getCity()
Gets the city information from this record, if present. If city data is not present, null will be returned.
Returns:
the information from the city field, or null if it's not present.

getCompany

public String getCompany()
Gets the company information from this record, if present. If company data is not present, null will be returned.
Returns:
the information from the company field, or null if it's not present.

getCountry

public String getCountry()
Gets the country information from this record, if present. If country data is not present, null will be returned.
Returns:
the information from the country field, or null if it's not present.

getCustomField

public java.lang.String getCustomField(int i)
Gets the specified custom field information from this record, if present. If the specified custom field data is not present, null will be returned.
Parameters:
i - the custom field to retreive data from.
Returns:
the information from the specified custom field, or null if it's not present.

getCustomFields

public java.lang.String[] getCustomFields()
Gets the custom field information from this record, if present.
Returns:
the custom field information from this record, if present.

getDisplayForList

public int getDisplayForList()
Returns the value of the "Display For List" flagset. This flagset is used to determine which fields should be displayed as a part of the phone list.
Returns:
the value of the "Display For List" flagset.

getGivenName

public String getGivenName()
Gets the given (first) name information from this record, if present. If given name data is not present, null will be returned.
Returns:
the information from the given name field, or null if it's not present.

getNote

public String getNote()
Gets the note information from this record, if present. If note data is not present, null will be returned.
Returns:
the information from the note, or null if it's not present.

getPhoneField

public int getPhoneField(int i)
Gets the specified phone field type.
Parameters:
i - the index of the phone field tyte to query.
Returns:
the phone field type indentifier.

getPhoneFieldTitle

public String getPhoneFieldTitle(int fieldID)
Gets the title for the specified phone field. This method will check the phone field type for the selected field ID, and will return the name of this field.
Parameters:
fieldID - the ID of the field to retreive the name for.
Returns:
the title for the specified phone field.

getPhoneFields

public int[] getPhoneFields()
Gets the phone field type information. This method returns an array listing the phone fields in use for this record, in order.
Returns:
the phone field information.

getPhones

public java.lang.String[] getPhones()
Gets all telephone data in this record, as Strings.
Returns:
all telephone data in this record, as Strings.

getPhones

public java.lang.String getPhones(int i)
Get the phone information for the specified field.
Parameters:
i - the index of the phone field to query.
Returns:
the phone information for the specified field.

getPostalCode

public String getPostalCode()
Gets the postal (zip) code information from this record, if present. If postal code data is not present, null will be returned.
Returns:
the information from the postal code field, or null if it's not present.

getProvince

public String getProvince()
Gets the province information from this record, if present. If province data is not present, null will be returned.
Returns:
the information from the province field, or null if it's not present.

getState

public String getState()
Gets the state information from this record, if present. If state data is not present, null will be returned. Note that this method is identical to calling getProvince().
Returns:
the information from the state field, or null if it's not present.

getSurname

public String getSurname()
Gets the surname (family name) information from this record, if present. If surname data is not present, null will be returned.
Returns:
the information from the surname field, or null if it's not present.

getTitle

public String getTitle()
Gets the title (honourific) information from this record, if present. If title data is not present, null will be returned.
Returns:
the information from the title field, or null if it's not present.

parseFields

protected void parseFields()
            throws ParseException
Parses the data array into a series of fields.
Overrides:
parseFields in interface DLPRecord
Throws:
ParseException - if the data cannot be parsed correctly.

setAddress

public void setAddress(String newValue)
Sets the address line for this record.
Parameters:
newValue - the address line for this record.

setCity

public void setCity(String newValue)
Sets the city line for this record.
Parameters:
newValue - the city line for this record.

setCompany

public void setCompany(String newValue)
Sets the company line for this record.
Parameters:
newValue - the company line for this record.

setCountry

public void setCountry(String newValue)
Sets the country line for this record.
Parameters:
newValue - the country line for this record.

setCustomField

public void setCustomField(java.lang.String newValue,
                           int num)
Sets the specified custom field to the specified data.
Parameters:
newValue - the data to set in the specified custom field.
num - the custom field index to write the data to.

setCustomFields

public void setCustomFields(newValue[] )
Sets the custom fields for this record.
Parameters:

setDisplayForList

public void setDisplayForList(int newValue)
Sets the display for list bitmap to the specified value.
Parameters:
newValue - the new value for the display for list bitmap.

setFlags

public void setFlags(int flags,
                     boolean value)
This method allows for the manual setting of the contents bitmap for this address record. The content bitmap is used to flag which elements of an address record are present in this record. When converting this object to a PalmOS-compatible buffer, elements flagged in the bitmap will be included, while those not flagged are ignored. If value == true, all flags are set to 1 (true) in contentFlags, otherwise they are are set to 0 (false).
Parameters:
flags - the flags which should be set / reset
value - Boolean value of flags to be set / reset. (true -> set, false -> reset).

setGivenName

public void setGivenName(String newValue)
Sets the given name field for this record.
Parameters:
newValue - the given name field for this record.

setNote

public void setNote(String newValue)
Sets the note for this record.
Parameters:
newValue - the note for this record.

setPhone

public void setPhone(java.lang.String newValue,
                     int num)
Sets the specified phone field to the specified value.
Parameters:
newValue - the data to write to the specified phone entry.
num - the index of the phone entry to write the specified data to.

setPhoneField

public void setPhoneField(int num,
                          int newValue)

Deprecated. use setPhoneType (changed parameter sequence matching setPhone to avoid confusion).

Sets the type of a phone.
Parameters:
num - the phone entry index to set.
newValue - the new type for the given phone entry.

setPhoneFields

public void setPhoneFields(tmpOrders[] )
Sets the telephone fields for this record.
Parameters:

setPhoneType

public void setPhoneType(int newValue,
                         int num)
Sets the type of a phone field.
Parameters:
newValue - the new type for the given phone entry.
num - the index number for the phone type to set.

setPhones

public void setPhones(newValue[] )
Set the phone data array to the specified value.
Parameters:

setPostalCode

public void setPostalCode(String newValue)
Sets the postal (zip) code line for this record.
Parameters:
newValue - the postal code line for this record.

setProvince

public void setProvince(String newValue)
Sets the province line for this record.
Parameters:
newValue - the province line for this record.

setState

public void setState(String newValue)
Sets the state line for this record. Note that this method is functionally identical to setProvince().
Parameters:
newValue - the state line for this record.

setSurname

public void setSurname(String newValue)
Sets the surname (family name) line for this record.
Parameters:
newValue - the surname line for this record.

setTitle

public void setTitle(String newValue)
Sets the title (honourific) line for this record.
Parameters:
newValue - the title line for this record.

toString

public String toString()
Converts this address record to a human-readable String.
Overrides:
toString in interface DLPRecord
Returns:
this address record as a human-readable String.

toString

public String toString(AddressAppBlock appBlock)
Converts this address record to a human-readable String, using the specified Address Application Block object. Calls to this toString method, with a valid Address App Block object are more specific, as we are able to retreive custom field titles, and other database-global information.
Returns:
this address record as a human-readable String.