semorg.sql.tables
Class Lecturer

java.lang.Object
  extended by semorg.sql.tables.AbstractTable
      extended by semorg.sql.tables.Person
          extended by semorg.sql.tables.Lecturer
All Implemented Interfaces:
SimpleIDKey

public class Lecturer
extends Person

Models a person in the role of a lecturer.


Field Summary
private  String bio
          The biography of the lecturer.
private static String conductQueryString
          SQL query to get all lecturer who conduct a certain presentation.
private static String createTableSQLString
          SQL statement for creating the table "lecturer" (if not exists).
private  Float dailyFee
          The daily fee.
private  Float hourlyFee
          The hourly fee.
private static String instructQueryString
          SQL query to get all lecturer who instruct a certain presentation.
private static String lecturerInsertString
          SQL query to insert a lecturer record.
private static String lecturerUpdateString
          SQL query to update a lecturer record.
private static String queryString
          SQL query to get all lecturer records from the database.
private static String superviseQueryString
          SQL query to get all lecturer who supervise a certain presentation.
private static String tableName
          The name of the corresponding db table.
 
Fields inherited from class semorg.sql.tables.Person
annex, birthday, city, country, email, fax, firstContact, firstname, id, lockedIds, mobile, name, notices, personInsertString, personUpdateString, phone, salutation, shortinfo, street, title, zipCode
 
Fields inherited from class semorg.sql.tables.AbstractTable
creationDate, modificationDate, NULL_ID
 
Constructor Summary
Lecturer(int id, String salutation, String title, String firstname, String name, String street, String zipCode, String city, String country, String annex, String phone, String mobile, String fax, String email, Date birthday, Date firstContact, String bio, Float dailyFee, Float hourlyFee, String shortinfo, String notices, Timestamp creationDate, Timestamp modificationDate)
          Creates an instance of the class Lecturer with the given parameters.
 
Method Summary
static void createLecturerTable(Statement statement)
          Creates the table "lecturer" if it does not exist.
 String getBio()
           
static Vector<DBColumn> getColumns()
          Returns a vector of DBColumn instances according to the properties of the tables "person" and "lecturer".
 Float getDailyFee()
           
 Float getHourlyFee()
           
static DistinctVector<Lecturer> getLectConducting(int seminarTypeId)
          Provides for a given presentation id all lecturers who conduct the presentation according to the given id.
static DistinctVector<Lecturer> getLectInstructing(int presentationId)
          Provides for a given presentation id all lecturers who instruct the presentation according to the given id.
static DistinctVector<Lecturer> getLectSupervising(int presentationId)
          Provides for a given presentation id all lecturers who supervise the presentation according to the given id.
static Lecturer getNext(int lecturerId)
          Returns for a DB-ID the Lecturer instance according to the record which has the next bigger id.
static Lecturer getPrevious(int lecturerId)
          Returns for a DB-ID the Lecturer instance according to the record which has the next smaller id.
private static DistinctVector<Lecturer> getVector(ResultSet resultSet)
          Creates for each element in a given ResultSet instance an Lecturer object and returns a vector with the resulting Lecturer instances.
static DistinctVector<Lecturer> getVectorFromDB(Vector<DBConstraint> additionalConstraints, String sortString)
          Creates a PreparedStatement instance with the given parameters, executes the query and returns a vector of Lecturer instances corresponding to the ResultSet of the query.
 int insertIntoDB()
          Inserts a lecturer record into the db.
 void setBio(String bio)
           
 void setDailyFee(Float dailyFee)
           
 void setHourlyFee(Float hourlyFee)
           
static boolean tableOK()
          Checks if the according DB table exists.
 void updateDB()
          Updates a lecturer record in the database.
 
Methods inherited from class semorg.sql.tables.Person
createPersonTable, equals, getAnnex, getBirthday, getCity, getCountry, getEmail, getFax, getFirstContact, getFirstname, getId, getMobile, getName, getNotices, getPhone, getSalutation, getShortinfo, getStreet, getTitle, getZipCode, hashCode, removeFromDB, setAnnex, setBirthday, setCity, setCountry, setEmail, setFax, setFirstContact, setFirstname, setMobile, setName, setNotices, setNumber, setPhone, setSalutation, setShortinfo, setStreet, setTitle, setZipCode
 
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, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bio

private String bio
The biography of the lecturer.


dailyFee

private Float dailyFee
The daily fee.


hourlyFee

private Float hourlyFee
The hourly fee.


tableName

private static String tableName
The name of the corresponding db table.


queryString

private static String queryString
SQL query to get all lecturer records from the database. (delives also the inherited attributes)


instructQueryString

private static String instructQueryString
SQL query to get all lecturer who instruct a certain presentation.


superviseQueryString

private static String superviseQueryString
SQL query to get all lecturer who supervise a certain presentation.


conductQueryString

private static String conductQueryString
SQL query to get all lecturer who conduct a certain presentation.


lecturerInsertString

private static String lecturerInsertString
SQL query to insert a lecturer record.


lecturerUpdateString

private static String lecturerUpdateString
SQL query to update a lecturer record.


createTableSQLString

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

Constructor Detail

Lecturer

public Lecturer(int id,
                String salutation,
                String title,
                String firstname,
                String name,
                String street,
                String zipCode,
                String city,
                String country,
                String annex,
                String phone,
                String mobile,
                String fax,
                String email,
                Date birthday,
                Date firstContact,
                String bio,
                Float dailyFee,
                Float hourlyFee,
                String shortinfo,
                String notices,
                Timestamp creationDate,
                Timestamp modificationDate)
Creates an instance of the class Lecturer with the given parameters.

Method Detail

getVector

private static DistinctVector<Lecturer> getVector(ResultSet resultSet)
Creates for each element in a given ResultSet instance an Lecturer object and returns a vector with the resulting Lecturer instances.

Parameters:
resultSet - given ResultSet instance.
Returns:
a DistinctVector instance filled with the created Lecturer instances.

getVectorFromDB

public static DistinctVector<Lecturer> getVectorFromDB(Vector<DBConstraint> additionalConstraints,
                                                       String sortString)
                                                throws SQLException
Creates a PreparedStatement instance with the given parameters, executes the query and returns a vector of Lecturer instances corresponding to the ResultSet of the query.

Parameters:
additionalConstraints - additional conditions of the WHERE-clause
sortString - sort string with the following structure ORDER BY attribute [ASC|DSC]
Returns:
a DistinctVector instance filled with the created Lecturer instances.
Throws:
SQLException - If the PreparedStatement can't be created or the execution of the query fails this exception is thrown.

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)

createLecturerTable

public static void createLecturerTable(Statement statement)
                                throws SQLException
Creates the table "lecturer" 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 int insertIntoDB()
                 throws SQLException
Inserts a lecturer record into the db. To do so, it first inserts a record into the table "person", secondly a record into the table "lecturer". These two records are linked by a PK-FK-association.

Overrides:
insertIntoDB in class Person
Returns:
the id of the inserted lecturer record.
Throws:
SQLException - If the auto-generated id can't resolved from the db, i.e. it hasnt been generated, or the PreparedStatement instance can't be created or executed etc.
See Also:
Person.insertIntoDB()

updateDB

public void updateDB()
              throws SQLException
Updates a lecturer record in the database. To do so, it firstly updates the corresponding record in the "person" table and secondly the record in the "lecturer" table.

Overrides:
updateDB in class Person
Throws:
SQLException - If the PreparedStatement instance can't be created or executed, this exception is thrown.
See Also:
Person.updateDB()

getColumns

public static Vector<DBColumn> getColumns()
Returns a vector of DBColumn instances according to the properties of the tables "person" and "lecturer".

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

getBio

public String getBio()

setBio

public void setBio(String bio)

getDailyFee

public Float getDailyFee()

setDailyFee

public void setDailyFee(Float dailyFee)

getHourlyFee

public Float getHourlyFee()

setHourlyFee

public void setHourlyFee(Float hourlyFee)

getNext

public static Lecturer getNext(int lecturerId)
Returns for a DB-ID the Lecturer instance according to the record which has the next bigger id.

Parameters:
lecturerId - the key of the current record
Returns:
the Lecturer instance corresponding to the next record in the table "lecturer" or if it does not exist the Lecturer instance with the smallest id.
See Also:
AbstractTable.getNext(String, DBColumn, int)

getPrevious

public static Lecturer getPrevious(int lecturerId)
Returns for a DB-ID the Lecturer instance according to the record which has the next smaller id.

Parameters:
lecturerId - the key of the current record
Returns:
the Lecturer instance corresponding to the previous record in the table "lecturer" or if it does not exist the Lecturer instance with the biggest id.
See Also:
AbstractTable.getPrevious(String, DBColumn, int)

getLectInstructing

public static DistinctVector<Lecturer> getLectInstructing(int presentationId)
                                                   throws SQLException
Provides for a given presentation id all lecturers who instruct the presentation according to the given id.

Parameters:
presentationId - the id of a presentation
Returns:
DistinctVector instance containing all Lecturer instances which meets the conditions mentioned above.
Throws:
SQLException - If the creation, manipulation, execution or closing of a PreparedStatement instance used for querying the database fails.

getLectSupervising

public static DistinctVector<Lecturer> getLectSupervising(int presentationId)
                                                   throws SQLException
Provides for a given presentation id all lecturers who supervise the presentation according to the given id.

Parameters:
presentationId - the id of a presentation
Returns:
DistinctVector instance containing all Lecturer instances which meets the conditions mentioned above.
Throws:
SQLException - If the creation, manipulation, execution or closing of a PreparedStatement instance used for querying the database fails.

getLectConducting

public static DistinctVector<Lecturer> getLectConducting(int seminarTypeId)
                                                  throws SQLException
Provides for a given presentation id all lecturers who conduct the presentation according to the given id.

Parameters:
seminarTypeId - the id of a presentation
Returns:
DistinctVector instance containing all Lecturer instances which meets the conditions mentioned above.
Throws:
SQLException - If the creation, manipulation, execution or closing of a PreparedStatement instance used for querying the database fails.