com.azalient.api.file.table
Class AbstractTableRW

java.lang.Object
  extended by com.azalient.api.file.record.TypeObject
      extended by com.azalient.api.file.record.ReaderUtilities
          extended by com.azalient.api.file.table.AbstractTable
              extended by com.azalient.api.file.table.AbstractTableW
                  extended by com.azalient.api.file.table.AbstractTableRW
All Implemented Interfaces:
ITable, ITableType, Table, TableR, TableRW, TableW

public abstract class AbstractTableRW
extends AbstractTableW
implements TableRW

A base class for a readable/writable table, in this package to use WorkBook (Can't extend AbstractTableR and AbstractTableW, so have to duplicate the methods in AbstractTableR here)


Method Summary
 Object columnNameObject(String name)
          Map a column header name to a column key.
 void finishedR(Page page)
          The reader is finished with the table, plus a a handle to the page
 void invalidate(RecordR record)
          This allows a record to remove itself, commonly from within the finished() method, afer checking its own validity
 Class[] keyTypes()
          The type and number of key columns in this table.
 void notFound(OpeningStatus ps)
          If it is mandatory that the table exists, override this and set ps.okAZA to false
 boolean open()
          read the table from model's current open file
 void open(OpeningStatus ps)
          read the store from model's current open file
abstract  RecordR row(Object[] rowKey)
          Return a reference to a Record (a row object).
abstract  boolean rowExists(Object[] rowKey)
          Return true if a record already exists with this key.
 
Methods inherited from class com.azalient.api.file.table.AbstractTableW
columnName, finishedW, format, recordArray, save, save, width
 
Methods inherited from class com.azalient.api.file.table.AbstractTable
colNameObjects, destroy, headerRows, newPage, page, pageName, pageType, tableName, toString
 
Methods inherited from class com.azalient.api.file.record.TypeObject
b, c, d, equals, equals, equalsEW, f, i, keyString, keyString, nameFromKeyString, rowKeysFromKeyString, s, t, t
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.azalient.api.file.TableW
columnName, finishedW, format, newPage, recordArray, save, save, width
 
Methods inherited from interface com.azalient.api.file.Table
destroy, headerRows
 
Methods inherited from interface com.azalient.api.a.tables.ITable
page, pageName
 
Methods inherited from interface com.azalient.api.a.tables.ITableType
colNameObjects, pageType, tableName
 

Method Detail

keyTypes

public Class[] keyTypes()
The type and number of key columns in this table. There must be at least one key column, and exactly one is common, but it may be more.

If you create a table/object defintion with more than one key column, and the uniqueness of the name depends on the key columns after the first, then the name() function should return a concatenation of the key colum objects otherwise the lookup() function will fail, the objects which have the same first column value but differ in the others will not be added to the store, as they will appear to be duplicate entries.

See TypeObject.keyString(Object[] keys)

See IRecord.name()

Specified by:
keyTypes in interface Table
Overrides:
keyTypes in class AbstractTable

columnNameObject

public Object columnNameObject(String name)
Map a column header name to a column key. The key can be the name itself, or something easier to match (like an integer) if you want to increase the performance

Specified by:
columnNameObject in interface TableR
Parameters:
name - the name of the column
Returns:
the column key, where null means the column does not exist

invalidate

public void invalidate(RecordR record)
This allows a record to remove itself, commonly from within the finished() method, afer checking its own validity

Specified by:
invalidate in interface TableR

row

public abstract RecordR row(Object[] rowKey)
Return a reference to a Record (a row object). On reading, the Record may already exist, or it may be created as a result of this call.

Specified by:
row in interface TableR

rowExists

public abstract boolean rowExists(Object[] rowKey)
Description copied from interface: TableR
Return true if a record already exists with this key. This is used to prevent duplicates from being read (particularly on base pages)

Specified by:
rowExists in interface TableR

finishedR

public void finishedR(Page page)
The reader is finished with the table, plus a a handle to the page

Specified by:
finishedR in interface TableR

notFound

public void notFound(OpeningStatus ps)
If it is mandatory that the table exists, override this and set ps.okAZA to false

Specified by:
notFound in interface TableR

open

public void open(OpeningStatus ps)
Description copied from interface: TableR
read the store from model's current open file

Specified by:
open in interface TableR

open

public boolean open()
Description copied from interface: TableR
read the table from model's current open file

Specified by:
open in interface TableR