javatools.db
Class DbFixedAbstractTable

java.lang.Object
  |
  +--javatools.db.DbAbstractTable
        |
        +--javatools.db.DbFixedAbstractTable
All Implemented Interfaces:
DbTableUser
Direct Known Subclasses:
AnalyzerClass, Author, AuthorTelephoneNo, Container, ContainerType, Contains, Data, DataSet, Editor, EditorTelephoneNo, FatherOf, FileType, Genre, Includes, InstalledProgram, Marks, MountPoint, NeedsExecutionOf, PreviewerClass, Published, Realized, Session, Volume, VolumeType

public abstract class DbFixedAbstractTable
extends DbAbstractTable

It represents a real database table. It's a base class to build derived classes representing real tables.


Field Summary
protected  java.util.HashMap colNameMap
          A map containing all column names.
protected  DbColumn[] columns
          The array containing all the columns of the table.
protected  java.lang.Object[] defaultValues
          Array containing the default values.
 
Fields inherited from class javatools.db.DbAbstractTable
db, displaySize, names, tableName, types
 
Constructor Summary
DbFixedAbstractTable(DbDatabase db)
          Creates new DbFixedAbstractTable
 
Method Summary
protected  void buildUp()
          Performs building of static lists.
protected  void catchDefaults()
          Finds defaults.
 DbDeleter deleter()
          Returns a deleter for this table.
 DbColumn getColumn(int index)
          Get the column of the given index.
 DbColumn getColumn(java.lang.String name)
          Get the DbColumn representing the column with this name.
 int getColumnCount()
          Returns the number of contained columns.
 java.lang.Object getDefault(int index)
          Returns the default value for the requested column.
 java.lang.Object getDefault(java.lang.String name)
          Returns the default value for a given column.
 DbInserter inserter()
          Return an inserter for inserting new data in the database.
 DbInserter inserter(DbSelector selector)
          Return an inserter for inserting new data in the database.
protected  void loadStructure()
          Loads table structure from a file: localConfigPath/TABLENAME.table.
protected  void saveStructure()
          Saves table structure into a file: localConfigPath/TABLENAME.table.
 DbUpdater updater()
          Returns an updater for this table.
 
Methods inherited from class javatools.db.DbAbstractTable
equals, getConstraint, getDatabase, getFullTableName, setTableName, simpleDeleter, simpleInserter, simpleInserter, simpleUpdater, usesTables
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

columns

protected DbColumn[] columns
The array containing all the columns of the table.


colNameMap

protected java.util.HashMap colNameMap
A map containing all column names.


defaultValues

protected java.lang.Object[] defaultValues
Array containing the default values.

Constructor Detail

DbFixedAbstractTable

public DbFixedAbstractTable(DbDatabase db)
                     throws DbException
Creates new DbFixedAbstractTable

Parameters:
db - The database that will be used.
Throws:
DbException - If something goes wrong.
Method Detail

getColumn

public DbColumn getColumn(int index)
                   throws DbException
Get the column of the given index. Index is a zero based array.

Specified by:
getColumn in class DbAbstractTable
Parameters:
index - The index for the requested column.
Returns:
The column value
Throws:
DbException - If something goes wrong.

getColumn

public DbColumn getColumn(java.lang.String name)
                   throws DbException
Get the DbColumn representing the column with this name.

Specified by:
getColumn in class DbAbstractTable
Parameters:
name - The name of the requested column.
Returns:
The column value
Throws:
DbException - If something goes wrong.

getColumnCount

public int getColumnCount()
Returns the number of contained columns.

Specified by:
getColumnCount in class DbAbstractTable
Returns:
The column count.

getDefault

public java.lang.Object getDefault(int index)
                            throws DbException
Returns the default value for the requested column.

Specified by:
getDefault in class DbAbstractTable
Parameters:
index - The index for the requested column.
Returns:
The requested default value.
Throws:
DbException - If something goes wrong.

getDefault

public java.lang.Object getDefault(java.lang.String name)
                            throws DbException
Returns the default value for a given column.

Specified by:
getDefault in class DbAbstractTable
Parameters:
name - The name of the requested column.
Returns:
The requested default value.
Throws:
DbException - If something goes wrong.

inserter

public DbInserter inserter(DbSelector selector)
                    throws DbException
Return an inserter for inserting new data in the database. This method is for SQL of the form INSERT INTO table(...) SELECT ...

Overrides:
inserter in class DbAbstractTable
Parameters:
selector - The selector that will be used to build this inserter.
Returns:
The brand new inserter.
Throws:
DbException - If something goes wrong.

inserter

public DbInserter inserter()
                    throws DbException
Return an inserter for inserting new data in the database. This method is for SQL of the form INSERT INTO table(...) VALUES(...)

Overrides:
inserter in class DbAbstractTable
Returns:
The brand new inserter.
Throws:
DbException - If something goes wrong.

updater

public DbUpdater updater()
                  throws DbException
Returns an updater for this table.

Overrides:
updater in class DbAbstractTable
Returns:
The brand new updater.
Throws:
DbException - If something goes wrong.

deleter

public DbDeleter deleter()
                  throws DbException
Returns a deleter for this table.

Overrides:
deleter in class DbAbstractTable
Returns:
The brand new deleter.
Throws:
DbException - If something goes wrong.

buildUp

protected void buildUp()
                throws DbException
Performs building of static lists.

Throws:
DbException - If something goes wrong.

catchDefaults

protected void catchDefaults()
                      throws DbException
Finds defaults.

Throws:
DbException - If something goes wrong.

loadStructure

protected void loadStructure()
                      throws DbException
Loads table structure from a file: localConfigPath/TABLENAME.table.

Throws:
DbException - If something goes wrong.

saveStructure

protected void saveStructure()
                      throws DbException
Saves table structure into a file: localConfigPath/TABLENAME.table.

Throws:
DbException - If something goes wrong.