jSyncManager

org.jSyncManager.API.Protocol.Util
Class DLPRecord

java.lang.Object
  |
  +--org.jSyncManager.API.Protocol.Util.DLPRecord
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
AddressRecord, DateBookRecord, ExpenseRecord, MailRecord, MemoRecord, NotepadRecord, ToDoListRecord

public class DLPRecord
extends java.lang.Object
implements java.io.Serializable

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

Version:
$Revision: 1.22 $
Author:
Brad BARCLAY <bbarclay@jsyncmanager.org>
Last modified by: $Author: yaztromo $ on $Date: 2003/05/14 03:51:27 $.
See Also:
Serialized Form

Field Summary
static byte ARCHIVED
          A flag to denote that this record is flagged for archival.
protected  byte attributes
          A field to store this records attributes bitmap.
static byte BUSY
          A flag to denote that this record is busy.
protected  byte category
          A field to store this records category ID.
protected  byte[] data
          A field to store this records data array.
static byte DATA_INCLUDED
          A flag to denote that this record includes data.
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 DELETED
          A flag to denote that this record has been deleted.
static byte DIRTY
          A flag to denote that this record is dirty.
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.
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.
 
Constructor Summary
DLPRecord()
          Empty constructor.
DLPRecord(byte[] 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
 boolean checkAttribute(byte value)
          Checks wether or not the specified attribute is present in this record.
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(byte[] 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.
 java.lang.String toString()
          Converts this record to a human-readable hexdump String.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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.

index

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

recordSize

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

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.

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.

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.

SORT_DATABASE

public static final byte SORT_DATABASE
A flag to denote that the database is sorted.

DELETED

public static final byte DELETED
A flag to denote that this record has been deleted.

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.

BUSY

public static final byte BUSY
A flag to denote that this record is busy.

SECRET

public static final byte SECRET
A flag to denote that this record is secret.

ARCHIVED

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

DATA_INCLUDED

public static final byte DATA_INCLUDED
A flag to denote that this record includes data.
Constructor Detail

DLPRecord

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

DLPRecord

public DLPRecord(DLPRecord dlp)
Create a new DLPRecord object from another DLPRecord type.

DLPRecord

public DLPRecord(byte[] inputData)
          throws DLPFunctionCallException
Create a new DLPRecord object from an array of bytes.
Parameters:
inputData - the array of bytes from the handheld representing a record to be parsed.
Method Detail

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.
See Also:
DELETED, DIRTY, BUSY, SECRET, ARCHIVED

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()
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.

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(byte[] inputData)
Set the data byte array for this record.
Parameters:
inputData - the data byte array for this record.

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 java.lang.String toString()
Converts this record to a human-readable hexdump String.
Overrides:
toString in class java.lang.Object
Returns:
this record as a human-readable hexdump String.

jSyncManager

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