semorg.sql.tables
Class Supervisor

java.lang.Object
  extended by semorg.sql.tables.AbstractTable
      extended by semorg.sql.tables.Supervisor

public class Supervisor
extends AbstractTable

Models the association "Supervisor" between the classes Lecturer and Presentation: a Lecturer is an Supervisor of a Presentation (association has a * cardinality).


Field Summary
private static String createTableSQLString
          SQL statement for creating the table "supervisor" (if not exists).
protected  int lecturerId
          The id of the lecturer.
static List<KeyPair> lockedIds
          A list of id-pairs of locked records.
protected  int presentationId
          The id of the presentation.
protected static String supervisorDeleteString
          SQL query to delete a supervisor record.
protected static String supervisorInsertString
          SQL query to insert a supervisor record.
private static String tableName
          The name of the corresponding table in the database.
 
Fields inherited from class semorg.sql.tables.AbstractTable
creationDate, modificationDate, NULL_ID
 
Constructor Summary
Supervisor(int lecturerId, int presentationId, Timestamp creationDate, Timestamp modificationDate)
          Creates an instance of the class Supervisor with the given parameters.
 
Method Summary
static void createSupervisorTable(Statement statement)
          Creates the table "supervisor" if it does not exist.
 void deleteFromDB()
          Delets a supervisor record from the db using the supervisorDeleteString.
static Vector<DBColumn> getColumns()
          Returns a vector of DBColumn instances according to the properties of the table "supervisor".
 int getLecturerId()
           
 int getPresentationId()
           
 void insertIntoDB()
          Inserts a supervisor record into the db using the supervisorInsertString.
static boolean tableOK()
          Checks if the according DB table exists.
 
Methods inherited from class semorg.sql.tables.AbstractTable
addDBTableChangedListener, createExtendedQueryString, fireTableChangedEvent, getColumns, getCreationDate, getModificationDate, getNext, getPrevious, removeDBTableChangedListener, setModificationDate, tableOK
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lockedIds

public static List<KeyPair> lockedIds
A list of id-pairs of locked records. This list is meant to prevent the manipulation / deletion of records whose association is currently edited.


lecturerId

protected int lecturerId
The id of the lecturer.


presentationId

protected int presentationId
The id of the presentation.


tableName

private static String tableName
The name of the corresponding table in the database.


supervisorInsertString

protected static String supervisorInsertString
SQL query to insert a supervisor record.


supervisorDeleteString

protected static String supervisorDeleteString
SQL query to delete a supervisor record.


createTableSQLString

private static String createTableSQLString
SQL statement for creating the table "supervisor" (if not exists).

Constructor Detail

Supervisor

public Supervisor(int lecturerId,
                  int presentationId,
                  Timestamp creationDate,
                  Timestamp modificationDate)
Creates an instance of the class Supervisor with the given parameters.

Method Detail

tableOK

public static boolean tableOK()
Checks if the according DB table exists.

Returns:
true, if the table is ok, false otherwise.
See Also:
AbstractTable.tableOK(String)

createSupervisorTable

public static void createSupervisorTable(Statement statement)
                                  throws SQLException
Creates the table "supervisor" if it does not exist.

Parameters:
statement - instance of the class Statement, which is used for executing the SQL statement createTableSQLString.
Throws:
SQLException - If the execution or closing of the given statement fails.

insertIntoDB

public void insertIntoDB()
                  throws SQLException
Inserts a supervisor record into the db using the supervisorInsertString. Finally it fires a TableChangedEvent-Listener with the appropriate type.

Throws:
SQLException - If the creation, manipulation, execution or closing of a PreparedStatement instance used for querying the database fails.
See Also:
- overview of all listener types

deleteFromDB

public void deleteFromDB()
                  throws SQLException
Delets a supervisor record from the db using the supervisorDeleteString. Finally it fires a TableChangedEvent-Listener with the appropriate type.

Throws:
SQLException - If the creation, manipulation, execution or closing of a PreparedStatement instance used for querying the database fails.
See Also:
- overview of all listener types

getColumns

public static Vector<DBColumn> getColumns()
Returns a vector of DBColumn instances according to the properties of the table "supervisor".

Returns:
the vector of DBColumn instances according to the properties of the class Supervisor.
See Also:
AbstractTable.getColumns(String tableAbbreviation)

getLecturerId

public int getLecturerId()

getPresentationId

public int getPresentationId()