|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsemorg.sql.tables.AbstractTable
public abstract class AbstractTable
Super class for all table classes. Encapsulates all properties and methods, which have all table classes in common.
Field Summary | |
---|---|
protected Timestamp |
creationDate
Date of creation of a table record. |
protected Timestamp |
modificationDate
Date of modification of a table record. |
static int |
NULL_ID
ID for a not existing tupel (NULL-tupel). |
private static Set<DBTableChangedListener> |
tableChangedListeners
A set of listeners, which react on table changes. |
Constructor Summary | |
---|---|
AbstractTable(Timestamp creationDate,
Timestamp modificationDate)
Creates an AbstractTable instance. |
Method Summary | |
---|---|
static void |
addDBTableChangedListener(DBTableChangedListener listener)
Inserts a listener into a set of listeners. |
protected static PreparedStatement |
createExtendedQueryString(String queryString,
Vector<DBConstraint> additionalConstraints,
String sortString)
Extends a SQL statement string with additional db constraints and / or an ORDER-BY statement and returns the appropriate PreparedStatement object. |
protected static void |
fireTableChangedEvent(int type)
Iterates over the set of listeners, which react on changes of the table and fires the one according to the wanted type. |
protected static Vector<DBColumn> |
getColumns(String tableAbbreviation)
Creates for creationDate and modificationDate two
DBColumn instances and returns them. |
Timestamp |
getCreationDate()
Returns the date of creation. |
Timestamp |
getModificationDate()
Returns the date of modification. |
protected static ResultSet |
getNext(String queryString,
DBColumn sortColumn,
int currentKey)
Returns for a data record the following one, i.e. the record whose key is the next bigger to the key of the given record or, if it does not exists, the record with the smallest key. |
protected static ResultSet |
getPrevious(String queryString,
DBColumn sortColumn,
int currentKey)
Returns for a data record the previous one, i.e. the record whose key is the next smaller to the key of the given record or, if it does not exists, the record with the biggest key. |
static void |
removeDBTableChangedListener(DBTableChangedListener listener)
Removes a listener from a set of listeners. |
void |
setModificationDate(Timestamp modificationDate)
Sets the date of modification. |
protected static boolean |
tableOK(String tableName)
Checks, whether a table exists or not. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static Set<DBTableChangedListener> tableChangedListeners
public static final int NULL_ID
protected Timestamp creationDate
protected Timestamp modificationDate
Constructor Detail |
---|
public AbstractTable(Timestamp creationDate, Timestamp modificationDate)
creationDate
- the creationDate of a table record.modificationDate
- the modificationDate of a table record.Method Detail |
---|
public Timestamp getCreationDate()
public Timestamp getModificationDate()
public void setModificationDate(Timestamp modificationDate)
modificationDate
- the new modificationDate.protected static PreparedStatement createExtendedQueryString(String queryString, Vector<DBConstraint> additionalConstraints, String sortString) throws SQLException
queryString
- SQL query string to be extendedadditionalConstraints
- additional conditions of the WHERE-clause.sortString
- sort string with the following structure
ORDER BY attribute [ASC|DSC]
.
SQLException
protected static Vector<DBColumn> getColumns(String tableAbbreviation)
creationDate
and modificationDate
two
DBColumn instances and returns them.
tableAbbreviation
- The abbreviation (used as prefix) for the name of the
table.
protected static boolean tableOK(String tableName)
true
, if the DESCRIBE statement can be executed
for the table, false
otherwise.protected static ResultSet getNext(String queryString, DBColumn sortColumn, int currentKey)
Hint: The mentioned behavior is only ensured, if the ID-column is
used as the sortColumn
.
queryString
- the sql statement to be executed.sortColumn
- the property which is used for sorting the result set of
the sql statement.currentKey
- the current key.
null
if the table is empty.protected static ResultSet getPrevious(String queryString, DBColumn sortColumn, int currentKey)
Hint: The mentioned behavior is only ensured, if the ID-column is
used as the sortColumn
.
queryString
- the sql statement to be executed.sortColumn
- the property which is used for sorting the result set of
the sql statement.currentKey
- the current key.
null
if the table is empty.protected static void fireTableChangedEvent(int type)
type
- type of the listener, which should be fired.public static void addDBTableChangedListener(DBTableChangedListener listener)
listener
- DBTableChangedListener instance, which should be inserted.public static void removeDBTableChangedListener(DBTableChangedListener listener)
listener
- DBTableChangedListener instance, which is to be removed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |