All Packages This Package Class Hierarchy Class Search Index
Class com.syncbuilder.storage.Database
java.lang.Object
|
+----com.syncbuilder.storage.Database
public class Database
extends java.lang.Object
{
// Fields 4
public static final int OPEN_DEFAULT;
public static final int OPEN_EXCLUSIVE;
public static final int OPEN_READ;
public static final int OPEN_WRITE;
// Constructors 1
public Database(Link, int, Char4, String, int, int);
// Methods 39
public synchronized void close() throws DlpException;
public AppBlock createAppBlock();
public Pref createPref(int);
public Pref createPref(int, int, boolean);
public Record createRecord();
public Record createRecord(RecordID);
public Resource createResource();
public Resource createResource(Char4, int);
public SortBlock createSortBlock();
public void deleteCategory(int) throws DlpException;
public void deleteRecord(RecordID) throws DlpException;
public void deleteRecords() throws DlpException;
public void deleteResource(Char4, int) throws DlpException;
public void deleteResources() throws DlpException;
public AppBlock getAppBlock() throws DlpException;
public Record getNextModRecord() throws DlpException;
public Record getNextModRecord(int) throws DlpException;
public Record getNextRecord(int) throws DlpException;
public Pref getPref(int) throws DlpException, IOException;
public Pref getPref(int, boolean) throws DlpException, NoCreatorException, IOException;
public Record getRecord(RecordID) throws DlpException;
public Record getRecord(int) throws DlpException;
public int getRecordCount() throws DlpException;
public RecordID[] getRecordIDs() throws DlpException;
public RecordID[] getRecordIDs(boolean) throws DlpException;
public RecordID[] getRecordIDs(boolean, int) throws DlpException;
public RecordID[] getRecordIDs(boolean, int, int) throws DlpException;
public Resource getResource(Char4, int) throws DlpException;
public Resource getResource(int) throws DlpException;
public SortBlock getSortBlock() throws DlpException;
public void moveCategory(int, int) throws DlpException;
public void purgeRecords() throws DlpException;
public void putRecord(Record) throws DlpException;
public void putResource(Resource) throws DlpException;
public void resetFlags() throws DlpException;
public void resetNext() throws DlpException;
public void setAppBlock(AppBlock) throws DlpException;
public void setPref(Pref) throws DlpException, NoCreatorException, IOException;
public void setSortBlock(SortBlock) throws DlpException;
}
A representation of an open database.
Database is assisted by DatabaseImpl, which provides the neccessary knowledge to
treat databases from different applications properly. This is a delegation-/bridge pattern.
Database-objects are supposed to be obtained through the methods of the Dlp
class (such as openDB(), openStockDB(), createDB()).
See Also:
Dlp, DatabaseImpl
- Returned By:
- Dlp.createDB(), Dlp.createDB(), Dlp.openDB(), Dlp.openDB(), Dlp.openDB(), Dlp.openDB(), Dlp.openStockDB()
public static final int OPEN_READ
Opened for read access
public static final int OPEN_WRITE
Opened for write access
public static final int OPEN_EXCLUSIVE
Opened for exclusive access
public static final int OPEN_DEFAULT
Opened with default settings (read/write, exclusive)
public Database(Link link,
int handle,
Char4 creator,
String dbname,
int dbmode,
int dbcard)
Construct a Database object.
!!! This constructor shall only be used by Dlp!!!
This constructor tries to figure out the proper version of DatabaseImpl
by querying the DatabaseImplFactory.
Parameter | Description |
link | an instance of Link |
handle | a database-handle as returned by DlpImpl.openDB |
creator | the creator ID of the database |
dbname | the name of the database |
dbmode | the mode of the database, use the Database.OPEN_XXX-flags |
dbcard | the card on which the database is located. |
public AppBlock getAppBlock() throws DlpException
public void setAppBlock(AppBlock appblock) throws DlpException
public AppBlock createAppBlock()
public SortBlock getSortBlock() throws DlpException
public void setSortBlock(SortBlock sortblock) throws DlpException
public SortBlock createSortBlock()
public Record getRecord(int index) throws DlpException
public Record getRecord(RecordID id) throws DlpException
public Record getNextRecord(int category) throws DlpException
public Record getNextModRecord() throws DlpException
public Record getNextModRecord(int category) throws DlpException
public void putRecord(Record record) throws DlpException
Writes a record to the database.
If the Record had an unspecified RecordID (0) before
it will be assigned a valid RecordID.
public Record createRecord()
Create a new Record with an unspecified RecordID (0).
public Record createRecord(RecordID id)
Create a new Record with the specified RecordID.
public void deleteRecord(RecordID uid) throws DlpException
Delete the record with the specified UID from the database.
Parameter | Description |
uid | the UID (not the index!) of the record |
public void deleteRecords() throws DlpException
Delete ALL records in the database.
Use with caution!
public RecordID[] getRecordIDs() throws DlpException
public RecordID[] getRecordIDs(boolean sort) throws DlpException
public RecordID[] getRecordIDs(boolean sort,
int start) throws DlpException
public RecordID[] getRecordIDs(boolean sort,
int start,
int max) throws DlpException
public void purgeRecords() throws DlpException
Deletes all records which are marked as archived or deleted
public Resource createResource()
public Resource createResource(Char4 type,
int id)
public Resource getResource(int index) throws DlpException
public Resource getResource(Char4 type,
int id) throws DlpException
public void putResource(Resource resource) throws DlpException
public void deleteResource(Char4 type,
int id) throws DlpException
public void deleteResources() throws DlpException
Delete ALL resources.
Use with caution!
public void deleteCategory(int category) throws DlpException
public void moveCategory(int from,
int to) throws DlpException
public Pref getPref(int id) throws DlpException, IOException
public Pref getPref(int id,
boolean backup) throws DlpException, NoCreatorException, IOException
Get one of the preferences which are associated with the same app as the database.
public void setPref(Pref pref) throws DlpException, NoCreatorException, IOException
public Pref createPref(int id)
public Pref createPref(int id,
int version,
boolean backup)
public synchronized void close() throws DlpException
Closes the database.
The Database-object shall no longer be used after the invocation of this method!
public void resetFlags() throws DlpException
For record databases, reset all dirty flags. For both record and
resource databases, set the last sync time to now.
public void resetNext() throws DlpException
public int getRecordCount() throws DlpException
Return the number of records in the Database
All Packages This Package Class Hierarchy Class Search Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7