|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--gov.sns.tools.data.DataTable
DataTable is internal storage resembling a database table. An instance of DataTable consists of an associated schema and a number of records. Each record must be of the same class and have the same keys.
| Nested Class Summary | |
class |
DataTable.AddRecordException
Exception thrown when attempting to add a record which causes an inconsistency. |
static class |
DataTable.NonUniqueRecordException
This exception is thrown when attempting to fetch a single record with bindings and more than one record matches the criteria. |
class |
DataTable.Schema
This class represents the schema of the table which specifies the attributes belonging to the table. |
static interface |
DataTable.TableMessage
Interface for notifying listeners of changes to the table |
| Field Summary | |
static java.lang.String |
nodeKey
|
| Constructor Summary | |
DataTable(DataAdaptor adaptor)
|
|
DataTable(java.lang.String aName,
java.util.Collection attributes)
Creates new RecordSet |
|
DataTable(java.lang.String aName,
java.util.Collection attributes,
java.lang.Class aRecordClass)
|
|
| Method Summary | |
void |
add(GenericRecord record)
Add the record to the table. |
void |
addListener(DataTable.TableMessage listener)
|
java.util.Collection |
attributes()
Return the attributes of this table from the table's schema. |
DataListener |
dataHandler()
Handle reading and writing from a data adaptor |
java.lang.Class |
getRecordClass()
convienience method for user to detect record class |
java.util.List |
getRecords(java.util.Map bindings,
SortOrdering ordering)
Fetch the records with matching key/value pair bindings and sort them according to the sort ordering. |
java.util.List |
getRecords(SortOrdering ordering)
Fetch all records held in the table and sort them according to the sort ordering. |
java.util.List |
getRecords(java.lang.String key,
java.lang.Object value,
SortOrdering ordering)
Fetch the records with a matching key/value pair binding and sort them according to the sort ordering. |
java.util.Collection |
getUniquePrimaryKeyValues(java.lang.String key)
Get the unique values of the specified primary key column. |
boolean |
hasRecord(GenericRecord record)
Determine if this table contains the specified record |
java.util.Collection |
keys()
Get all keys for this table. |
java.lang.String |
name()
Get the name of this table. |
java.util.List |
orderRecords(java.util.Collection records,
SortOrdering ordering)
Order the records according to the specified sort ordering. |
java.util.Collection |
primaryKeys()
Get the primary keys for the table. |
GenericRecord |
record(java.util.Map bindings)
Fetch the record with matching key/value pair bindings. |
GenericRecord |
record(java.lang.String key,
java.lang.Object value)
Fetch the record with a matching key/value pair binding. |
GenericRecord |
recordForNode(java.lang.String nodeId)
Fetch the record with a matching nodeId. |
java.util.Collection |
records()
Fetch all records held in the table |
java.util.Collection |
records(java.util.Map bindings)
Fetch the records with matching key/value pair bindings. |
java.util.Collection |
records(java.lang.String key,
java.lang.Object value)
Fetch the records with a matching key/value pair binding. |
java.util.Collection |
recordsForNode(java.lang.String nodeId)
Fetch the records with a matching nodeId. |
void |
remove(GenericRecord record)
Remove the specified record from this table. |
void |
removeListener(DataTable.TableMessage listener)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String nodeKey
| Constructor Detail |
public DataTable(java.lang.String aName,
java.util.Collection attributes)
public DataTable(java.lang.String aName,
java.util.Collection attributes,
java.lang.Class aRecordClass)
public DataTable(DataAdaptor adaptor)
| Method Detail |
public void addListener(DataTable.TableMessage listener)
public void removeListener(DataTable.TableMessage listener)
public java.lang.Class getRecordClass()
public DataListener dataHandler()
throws MissingPrimaryKeyException
MissingPrimaryKeyExceptionpublic java.lang.String name()
public java.util.Collection keys()
public java.util.Collection primaryKeys()
public boolean hasRecord(GenericRecord record)
record - The record to test for membership in this table
public void add(GenericRecord record)
throws DataTable.AddRecordException
DataTable.AddRecordExceptionpublic void remove(GenericRecord record)
public java.util.Collection attributes()
public java.util.List orderRecords(java.util.Collection records,
SortOrdering ordering)
ordering - The sort ordering used to sort the record.
public java.util.Collection records()
public java.util.List getRecords(SortOrdering ordering)
ordering - The sort ordering used to sort the records.
public GenericRecord record(java.util.Map bindings)
throws DataTable.NonUniqueRecordException
DataTable.NonUniqueRecordException
public GenericRecord record(java.lang.String key,
java.lang.Object value)
throws DataTable.NonUniqueRecordException
DataTable.NonUniqueRecordExceptionpublic java.util.Collection records(java.util.Map bindings)
bindings - The map of key/value pairs where the keys correspond to a subset of primary keys and the values are the ones we want to match.
public java.util.List getRecords(java.util.Map bindings,
SortOrdering ordering)
bindings - The map of key/value pairs where the keys correspond to a subset of primary keys and the values are the ones we want to match.ordering - The sort ordering used to sort the records.
public java.util.Collection records(java.lang.String key,
java.lang.Object value)
key - A primary key to fetch against.value - The value of the primary key to match.
public java.util.List getRecords(java.lang.String key,
java.lang.Object value,
SortOrdering ordering)
key - A primary key to fetch against.value - The value of the primary key to match.ordering - The sort ordering used to sort the records.
public GenericRecord recordForNode(java.lang.String nodeId)
throws DataTable.NonUniqueRecordException
DataTable.NonUniqueRecordExceptionpublic java.util.Collection recordsForNode(java.lang.String nodeId)
public final java.util.Collection getUniquePrimaryKeyValues(java.lang.String key)
key - The primary key column whose unique values we want to fetch.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||