net.sourceforge.jpalm.mobiledb
Class DatabaseInfo

java.lang.Object
  extended by net.sourceforge.jpalm.DataBlock
      extended by net.sourceforge.jpalm.palmdb.ApplicationInfo
          extended by net.sourceforge.jpalm.mobiledb.DatabaseInfo

public class DatabaseInfo
extends ApplicationInfo

The database info block in a MobileDB database.

See Also:
ApplicationInfo.getApplicationData(), ApplicationInfo.setApplicationData(byte[])

Field Summary
static int DATA_LENGTH
          The length of this DataBlock in bytes.
152
static net.sourceforge.juint.UInt8 LOCKED_COLUMN_NONE
          No locked columns.
static net.sourceforge.juint.UInt8 PASSWORD_PROTECTION_LOCK
          Database is completely locked.
static net.sourceforge.juint.UInt8 PASSWORD_PROTECTION_NONE
          No password protection.
static net.sourceforge.juint.UInt8 PASSWORD_PROTECTION_READ_ONLY
          Database is read-only.
 
Fields inherited from class net.sourceforge.jpalm.palmdb.ApplicationInfo
applicationData, categoryLabels, categoryUniqueIds, lastUniqueId, padding, renamedCategories
 
Constructor Summary
DatabaseInfo()
          Creates a new database info block.
DatabaseInfo(byte[] data)
          Creates a new database info block from the byte array.
 
Method Summary
 void deserialize(byte[] data)
          Populate class properties from a byte array.
 boolean equals(java.lang.Object object)
           
 FilterCriterion getFilter1()
          Gets the first filter criterion.
 FilterCriterion getFilter2()
          Gets the second filter criterion.
 FilterCriterion getFilter3()
          Gets the third filter criterion.
 net.sourceforge.juint.UInt8 getLockedColumn()
          Gets the locked column.
 net.sourceforge.juint.UInt32 getPasswordHash()
          Gets the password hash.
 net.sourceforge.juint.UInt8 getPasswordProtection()
          Gets the type of password protection.
 byte[] getReserved()
          Gets the reserved bytes.
 SortCriterion getSort1()
          Gets the first sort criterion.
 SortCriterion getSort2()
          Gets the second sort criterion.
 SortCriterion getSort3()
          Gets the third sort criterion.
 net.sourceforge.juint.UInt16 getVersion()
          Gets the header version.
 net.sourceforge.juint.UInt32 hashPassword(java.lang.String password)
          Creates a password hash for locking the database.
 boolean isDisplayLongDates()
          Gets the display long dates flag.
 boolean isEditOnSelect()
          Gets the edit on select flag.
 boolean isSearchOnGlobalFind()
          Gets the search on global find flag.
 byte[] serialize()
          Create a byte array of the class properties.
 void setDisplayLongDates(boolean displayLongDates)
          Sets the display long dates flag.
 void setEditOnSelect(boolean editOnSelect)
          Sets the edit on select flag.
 void setFilter1(FilterCriterion filter)
          Sets the first filter criterion.
 void setFilter2(FilterCriterion filter)
          Sets the second filter criterion.
 void setFilter3(FilterCriterion filter)
          Sets the third filter criterion.
 void setLockedColumn(net.sourceforge.juint.UInt8 lockedColumn)
          Sets the locked column.
 void setPasswordHash(net.sourceforge.juint.UInt32 passwordHash)
          Sets the password hash.
 void setPasswordProtection(net.sourceforge.juint.UInt8 passwordProtection)
          Sets the type of password protection.
 void setReserved(byte[] reserved)
          Sets the reserved bytes.
 void setSearchOnGlobalFind(boolean searchOnGlobalFind)
          Sets the search on global find flag.
 void setSort1(SortCriterion sort)
          Sets the first sort criterion.
 void setSort2(SortCriterion sort)
          Sets the second sort criterion.
 void setSort3(SortCriterion sort)
          Sets the third sort criterion.
 void setVersion(net.sourceforge.juint.UInt16 version)
          Sets the header version.
 
Methods inherited from class net.sourceforge.jpalm.palmdb.ApplicationInfo
getApplicationData, getCategoryLabels, getCategoryUniqueIds, getLastUniqueId, getPadding, getRenamedCategories, setApplicationData, setCategoryLabels, setCategoryUniqueIds, setLastUniqueId, setPadding, setRenamedCategories
 
Methods inherited from class net.sourceforge.jpalm.DataBlock
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DATA_LENGTH

public static final int DATA_LENGTH
The length of this DataBlock in bytes.
152

See Also:
Constant Field Values

LOCKED_COLUMN_NONE

public static net.sourceforge.juint.UInt8 LOCKED_COLUMN_NONE
No locked columns.


PASSWORD_PROTECTION_NONE

public static net.sourceforge.juint.UInt8 PASSWORD_PROTECTION_NONE
No password protection.


PASSWORD_PROTECTION_READ_ONLY

public static net.sourceforge.juint.UInt8 PASSWORD_PROTECTION_READ_ONLY
Database is read-only.


PASSWORD_PROTECTION_LOCK

public static net.sourceforge.juint.UInt8 PASSWORD_PROTECTION_LOCK
Database is completely locked.

Constructor Detail

DatabaseInfo

public DatabaseInfo()
Creates a new database info block.


DatabaseInfo

public DatabaseInfo(byte[] data)
Creates a new database info block from the byte array.

Parameters:
data - the byte array
See Also:
deserialize(byte[])
Method Detail

deserialize

public void deserialize(byte[] data)
Description copied from class: DataBlock
Populate class properties from a byte array.

Overrides:
deserialize in class ApplicationInfo
Parameters:
data - the byte array

serialize

public byte[] serialize()
Description copied from class: DataBlock
Create a byte array of the class properties.

Overrides:
serialize in class ApplicationInfo
Returns:
the byte array

hashPassword

public net.sourceforge.juint.UInt32 hashPassword(java.lang.String password)
Creates a password hash for locking the database.

Parameters:
password - the password
Returns:
the password hash
See Also:
setPasswordHash(UInt32)

isSearchOnGlobalFind

public boolean isSearchOnGlobalFind()
Gets the search on global find flag.

Returns:
true if the database should be visible to find; false otherwise

setSearchOnGlobalFind

public void setSearchOnGlobalFind(boolean searchOnGlobalFind)
Sets the search on global find flag. Default is true.

Parameters:
searchOnGlobalFind - true if the database should be visible to find; false otherwise

isEditOnSelect

public boolean isEditOnSelect()
Gets the edit on select flag.

Returns:
true if a record should be edited when selected; false otherwise

setEditOnSelect

public void setEditOnSelect(boolean editOnSelect)
Sets the edit on select flag. Default is true.

Parameters:
editOnSelect - true if a record should be edited when selected; false otherwise

getFilter1

public FilterCriterion getFilter1()
Gets the first filter criterion.

Returns:
the first filter criterion.

setFilter1

public void setFilter1(FilterCriterion filter)
Sets the first filter criterion.

Parameters:
filter - the first filter criterion

getFilter2

public FilterCriterion getFilter2()
Gets the second filter criterion.

Returns:
the second filter criterion.

setFilter2

public void setFilter2(FilterCriterion filter)
Sets the second filter criterion.

Parameters:
filter - the second filter criterion

getFilter3

public FilterCriterion getFilter3()
Gets the third filter criterion.

Returns:
the third filter criterion.

setFilter3

public void setFilter3(FilterCriterion filter)
Sets the third filter criterion.

Parameters:
filter - the third filter criterion

getPasswordHash

public net.sourceforge.juint.UInt32 getPasswordHash()
Gets the password hash. If the hash is 0 then the database is not password protected.

Returns:
the password hash or 0

setPasswordHash

public void setPasswordHash(net.sourceforge.juint.UInt32 passwordHash)
Sets the password hash. Set this to 0 to disable password protection.

Parameters:
passwordHash - the password hash or 0
See Also:
hashPassword(String)

isDisplayLongDates

public boolean isDisplayLongDates()
Gets the display long dates flag.

Example long date: Sep 3, 2006.
Example short date: 9/3/06.

Returns:
true if long dates should be shown; false otherwise

setDisplayLongDates

public void setDisplayLongDates(boolean displayLongDates)
Sets the display long dates flag. Default is false.

Example long date: Sep 3, 2006.
Example short date: 9/3/06.

Parameters:
displayLongDates - true if long dates should be shown; false otherwise

getReserved

public byte[] getReserved()
Gets the reserved bytes. These bytes are reserved for future versions of MobileDB.

Returns:
the reserved bytes

setReserved

public void setReserved(byte[] reserved)
Sets the reserved bytes. These bytes are reserved for future versions of MobileDB.

Parameters:
reserved - the reserved bytes

getSort1

public SortCriterion getSort1()
Gets the first sort criterion.

Returns:
the first sort critrion

setSort1

public void setSort1(SortCriterion sort)
Sets the first sort criterion.

Parameters:
sort - the first sort criterion

getSort2

public SortCriterion getSort2()
Gets the second sort criterion.

Returns:
the second sort critrion

setSort2

public void setSort2(SortCriterion sort)
Sets the second sort criterion.

Parameters:
sort - the second sort criterion

getSort3

public SortCriterion getSort3()
Gets the third sort criterion.

Returns:
the third sort critrion

setSort3

public void setSort3(SortCriterion sort)
Sets the third sort criterion.

Parameters:
sort - the third sort criterion

getVersion

public net.sourceforge.juint.UInt16 getVersion()
Gets the header version. Should always be 1.

Returns:
the header version

setVersion

public void setVersion(net.sourceforge.juint.UInt16 version)
Sets the header version. Should always be 1.

Parameters:
version - the header version

getLockedColumn

public net.sourceforge.juint.UInt8 getLockedColumn()
Gets the locked column.

Returns:
the locked column number or LOCKED_COLUMN_NONE

setLockedColumn

public void setLockedColumn(net.sourceforge.juint.UInt8 lockedColumn)
Sets the locked column. A column that is locked doesn't scroll in the record list.

Parameters:
lockedColumn - the locked column number or LOCKED_COLUMN_NONE

getPasswordProtection

public net.sourceforge.juint.UInt8 getPasswordProtection()
Gets the type of password protection.

Returns:
PASSWORD_PROTECTION_LOCK, PASSWORD_PROTECTION_NONE, or PASSWORD_PROTECTION_READ_ONLY

setPasswordProtection

public void setPasswordProtection(net.sourceforge.juint.UInt8 passwordProtection)
Sets the type of password protection.

Parameters:
passwordProtection - PASSWORD_PROTECTION_LOCK, PASSWORD_PROTECTION_NONE, or PASSWORD_PROTECTION_READ_ONLY
See Also:
setPasswordHash(UInt32)

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class ApplicationInfo