jSyncManager

org.jSyncManager.API.Protocol.Util.StdApps
Class AddressRecord

java.lang.Object
  |
  +--org.jSyncManager.API.Protocol.Util.DLPRecord
        |
        +--org.jSyncManager.API.Protocol.Util.StdApps.AddressRecord
All Implemented Interfaces:
java.io.Serializable

public class AddressRecord
extends DLPRecord

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

Version:
$Revision: 1.24 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: yaztromo $ on $Date: 2003/05/13 17:36:09 $.
See Also:
Serialized Form

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, attributes, BUSY, category, data, DATA_INCLUDED, DELETE_ALL_IN_CATEGORY, DELETE_ALL_RECORDS, DELETED, DIRTY, index, inputData, recordID, recordSize, SECRET, SORT_DATABASE
 
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.
 java.lang.String getAddress()
          Gets the address information from this record, if present.
 java.lang.String getCity()
          Gets the city information from this record, if present.
 java.lang.String getCompany()
          Gets the company information from this record, if present.
 java.lang.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.
 java.lang.String getGivenName()
          Gets the given (first) name information from this record, if present.
 java.lang.String getNote()
          Gets the note information from this record, if present.
 int getPhoneField(int i)
          Gets the specified phone field type.
 int[] getPhoneFields()
          Gets the phone field type information.
 java.lang.String getPhoneFieldTitle(int fieldID)
          Gets the title for the specified phone field.
 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.
 java.lang.String getPostalCode()
          Gets the postal (zip) code information from this record, if present.
 java.lang.String getProvince()
          Gets the province information from this record, if present.
 java.lang.String getState()
          Gets the state information from this record, if present.
 java.lang.String getSurname()
          Gets the surname (family name) information from this record, if present.
 java.lang.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(java.lang.String newValue)
          Sets the address line for this record.
 void setCity(java.lang.String newValue)
          Sets the city line for this record.
 void setCompany(java.lang.String newValue)
          Sets the company line for this record.
 void setCountry(java.lang.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(java.lang.String[] 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)
          Sets or resets the given flags in contentFlags depending on value.
 void setGivenName(java.lang.String newValue)
          Sets the given name field for this record.
 void setNote(java.lang.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(int[] tmpOrders)
          Sets the telephone fields for this record.
 void setPhones(java.lang.String[] newValue)
          Set the phone data array to the specified value.
 void setPhoneType(int newValue, int num)
          Sets the type of a phone field.
 void setPostalCode(java.lang.String newValue)
          Sets the postal (zip) code line for this record.
 void setProvince(java.lang.String newValue)
          Sets the province line for this record.
 void setState(java.lang.String newValue)
          Sets the state line for this record.
 void setSurname(java.lang.String newValue)
          Sets the surname (family name) line for this record.
 void setTitle(java.lang.String newValue)
          Sets the title (honourific) line for this record.
 java.lang.String toString()
          Converts this address record to a human-readable String.
 java.lang.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
checkAttribute, getAttributes, getCategory, getData, getIndex, getRecordID, getRecordSize, setAttributes, setCategory, setData, setIndex, setRecordID, setRecordSize
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_PHONES

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

MAX_CUSTOMFIELDS

public static final int MAX_CUSTOMFIELDS
The maximum number of custom fields allowed.

MAX_DATAFLAGS

public static final int MAX_DATAFLAGS
The maximum number of data flags allowed.

MAX_PHONELABELS

public static final int MAX_PHONELABELS
The maximum number of phone labels allowed.

NOTE_FLAG

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

CUSTOM1_FLAG

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

CUSTOM2_FLAG

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

CUSTOM3_FLAG

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

CUSTOM4_FLAG

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

TITLE_FLAG

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

COUNTRY_FLAG

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

POSTALCODE_FLAG

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

PROVINCE_FLAG

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

CITY_FLAG

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

ADDRESS_FLAG

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

PHONE1_FLAG

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

PHONE2_FLAG

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

PHONE3_FLAG

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

PHONE4_FLAG

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

PHONE5_FLAG

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

COMPANY_FLAG

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

GIVENNAME_FLAG

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

SURNAME_FLAG

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

WORK_LABEL

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

HOME_LABEL

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

FAX_LABEL

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

OTHER_LABEL

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

EMAIL_LABEL

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

MAIN_LABEL

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

PAGER_LABEL

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

MOBILE_LABEL

public static final int MOBILE_LABEL
Denotes that this phone field is a mobile/cellular telephone number.
Constructor Detail

AddressRecord

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

AddressRecord

public AddressRecord(DLPRecord record)
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 Detail

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.

setFlags

public void setFlags(int flags,
                     boolean value)
Sets or resets the given flags in contentFlags depending on value. 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).

generateData

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

getAddress

public java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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 java.lang.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.

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.

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 java.lang.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.

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 java.lang.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 java.lang.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 java.lang.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.
See Also:
getProvince()

getSurname

public java.lang.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 java.lang.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()
Parses the data array into a series of fields.
Overrides:
parseFields in class DLPRecord

setAddress

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

setCity

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

setCompany

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

setCountry

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

setCustomFields

public void setCustomFields(java.lang.String[] newValue)
Sets the custom fields for this record.
Parameters:
newValue - an array containing the data for the custom fields.

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.
the - custom field index to write the data to.

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.

setGivenName

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

setNote

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

setPhoneFields

public void setPhoneFields(int[] tmpOrders)
Sets the telephone fields for this record.
Parameters:
tmpOrders - the new phone field orders for this object.

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.

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(java.lang.String[] newValue)
Set the phone data array to the specified value.
Parameters:
newValue - a new array containing phone data.

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.

setPostalCode

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

setProvince

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

setState

public void setState(java.lang.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.
See Also:
setProvince(java.lang.String)

setSurname

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

setTitle

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

toString

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

toString

public java.lang.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.

jSyncManager

Copyright (c) 1999 - 2003 Brad BARCLAY and others. All Rights Reserved.