org.jSyncManager.API.Protocol.Util

Class DLPRecord

Implemented Interfaces:
Serializable
Known Direct Subclasses:
AddressRecord, ContactRecord, DateBookRecord, ExpenseRecord, MailRecord, MemoRecord, NotepadRecord, ToDoListRecord, vObject

public class DLPRecord
extends java.lang.Object
implements Serializable

A class to hold a handheld record of information. This class holds a single record of data.

Field Summary

static byte
ARCHIVED
A flag to denote that this record is flagged for archival.
static byte
BUSY
A flag to denote that this record is busy.
static byte
DATA_INCLUDED
A flag to denote that this record includes data.
static byte
DELETED
A flag to denote that this record has been deleted.
static byte
DELETE_ALL_IN_CATEGORY
A flag to signify that all records in the specified category of the specified database should be deleted during a record delete operation.
static byte
DELETE_ALL_RECORDS
A flag to signify that all records in the specified database should be deleted during a record delete operation.
static byte
DIRTY
A flag to denote that this record is dirty.
static byte
SECRET
A flag to denote that this record is secret.
static byte
SORT_DATABASE
A flag to denote that the database is sorted.
protected byte
attributes
A field to store this records attributes bitmap.
protected byte
category
A field to store this records category ID.
protected byte[]
data
A field to store this records data array.
protected char
index
A field to store this records index within its database.
protected byte[]
inputData
A byte array to hold the input data array.
protected int
recordID
A field to store this records unique ID number.
protected char
recordSize
A field to store the size of this record.

Constructor Summary

DLPRecord()
Empty constructor.
DLPRecord(inputData[] )
Create a new DLPRecord object from an array of bytes.
DLPRecord(DLPRecord dlp)
Create a new DLPRecord object from another DLPRecord type.

Method Summary

void
addAttribute(byte flag)
Adds an attribute to the attributes bitmap.
boolean
checkAttribute(byte value)
Checks wether or not the specified attribute is present in this record.
void
clearAttribute(byte flag)
Clears the specified attribute.
protected void
generateData()
Gererates a data array from a set of object fields.
byte
getAttributes()
Retreives the attributes for this record.
byte
getCategory()
Retreives the category ID for this record.
byte[]
getData()
Retreives the data for this record.
char
getIndex()
Retreives the index for this record.
int
getRecordID()
Retreives the record ID for this record.
char
getRecordSize()
Retreives the reported size for this record.
protected void
parseFields()
Parses the record data array into a set of fields.
void
setAttributes(byte flags)
Set the attributes to the specified value.
void
setCategory(byte categoryID)
Set the category ID for this record.
void
setData(inputData[] )
Set the data byte array for this record.
void
setIndex(char i)
Set the index for this record.
void
setRecordID(int id)
Set the unique record ID for this record.
void
setRecordSize(char size)
Set the record size for this record.
String
toString()
Converts this record to a human-readable hexdump String.

Field Details

ARCHIVED

public static final byte ARCHIVED
A flag to denote that this record is flagged for archival.
Field Value:
8

BUSY

public static final byte BUSY
A flag to denote that this record is busy.
Field Value:
32

DATA_INCLUDED

public static final byte DATA_INCLUDED
A flag to denote that this record includes data. This flag is included for compatibility with old handhelds. Typically you won't need to set this if your record includes data.
Field Value:
-128

DELETED

public static final byte DELETED
A flag to denote that this record has been deleted.
Field Value:
-128

DELETE_ALL_IN_CATEGORY

public static final byte DELETE_ALL_IN_CATEGORY
A flag to signify that all records in the specified category of the specified database should be deleted during a record delete operation.
Field Value:
64

DELETE_ALL_RECORDS

public static final byte DELETE_ALL_RECORDS
A flag to signify that all records in the specified database should be deleted during a record delete operation.
Field Value:
-128

DIRTY

public static final byte DIRTY
A flag to denote that this record is dirty. Dirty records are those that have been added, modified, or deleted since the last synchronization. To test to see if it's been deleted, check the deleted attribute.
Field Value:
64

SECRET

public static final byte SECRET
A flag to denote that this record is secret.
Field Value:
16

SORT_DATABASE

public static final byte SORT_DATABASE
A flag to denote that the database is sorted.
Field Value:
-128

attributes

protected byte attributes
A field to store this records attributes bitmap.

category

protected byte category
A field to store this records category ID.

data

protected byte[] data
A field to store this records data array.

index

protected char index
A field to store this records index within its database.

inputData

protected byte[] inputData
A byte array to hold the input data array.

recordID

protected int recordID
A field to store this records unique ID number.

recordSize

protected char recordSize
A field to store the size of this record.

Constructor Details

DLPRecord

public DLPRecord()
Empty constructor. This is useful for creating a new record entry.

DLPRecord

public DLPRecord(inputData[] )
            throws DLPFunctionCallException
Create a new DLPRecord object from an array of bytes.
Parameters:

DLPRecord

public DLPRecord(DLPRecord dlp)
Create a new DLPRecord object from another DLPRecord type.
Parameters:
dlp - the DLP record to make a copy object of.

Method Details

addAttribute

public void addAttribute(byte flag)
Adds an attribute to the attributes bitmap.
Parameters:
flag - the flag to add.

checkAttribute

public boolean checkAttribute(byte value)
Checks wether or not the specified attribute is present in this record.
Parameters:
value - the attribute to be tested.
Returns:
true if the specified flag is present, false otherwise.

clearAttribute

public void clearAttribute(byte flag)
Clears the specified attribute.
Parameters:
flag - the attribute flag to clear.

generateData

protected void generateData()
Gererates a data array from a set of object fields. Subclasses that parse record data should implement this method so they can reconstruct the data byte array from their object fields so it can be written back to the handheld. In this class, this method has a null implementation.

getAttributes

public byte getAttributes()
Retreives the attributes for this record.
Returns:
the attributes for this record.

getCategory

public byte getCategory()
Retreives the category ID for this record.
Returns:
the category ID for this record.

getData

public final byte[] getData()
Retreives the data for this record.
Returns:
the data for this record, as an array of bytes.

getIndex

public char getIndex()
Retreives the index for this record.
Returns:
the index for this record.

getRecordID

public int getRecordID()
Retreives the record ID for this record.
Returns:
the record ID for this record.

getRecordSize

public char getRecordSize()
Retreives the reported size for this record. Due to the need for byte alignment, the value reported here and the number of bytes in the data array may differ.
Returns:
the reported size for this record.

parseFields

protected void parseFields()
            throws ParseException
Parses the record data array into a set of fields. This method should be implemented by subclasses. For this class, it uses a null implementation, as we don't have anything to parse.
Throws:
ParseException - thrown if we are unable to parse the data correctly.

setAttributes

public void setAttributes(byte flags)
Set the attributes to the specified value.
Parameters:
flags - the attribute bitmap to use.

setCategory

public void setCategory(byte categoryID)
Set the category ID for this record.
Parameters:
categoryID - the category ID for this record.

setData

public void setData(inputData[] )
            throws ParseException
Set the data byte array for this record.
Parameters:
Throws:
ParseException - if the data cannot be parsed correctly.

setIndex

public void setIndex(char i)
Set the index for this record.
Parameters:
i - the index for this record.

setRecordID

public void setRecordID(int id)
Set the unique record ID for this record.
Parameters:
id - the unique record ID for this record.

setRecordSize

public void setRecordSize(char size)
Set the record size for this record.
Parameters:
size - the record size for this record.

toString

public String toString()
Converts this record to a human-readable hexdump String.
Returns:
this record as a human-readable hexdump String.