Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## semorg.sql.tables
Class Presentation

    java.lang.Object
      semorg.sql.tables.AbstractTable
          semorg.sql.tables.Presentation

All Implemented Interfaces:
  SimpleIDKey

Direct Known Subclasses:
  CompanyInternalPresentation, PublicPresentation

    public class Presentation

extends AbstractTable
implements SimpleIDKey

The super class for all presentation classes. It encapsulates all common properties and methods of this classes.

Field Summary
`protected String` | `annex` The annex.
`protected Date` | `beginningDay` The day when the presentation begins.
`protected boolean` | `cancelled` `true` if the presentation is canceled, `false` otherwise.
`protected String` | `city` The city.
`protected String` | `country` The country.
`private static String` | `createTableSQLString` SQL statement for creating the table "presentation" (if not exists).
`protected Integer` | `duration` The duration of the presentation.
`protected Date` | `endingDay` The last day of the presentation.
`protected Time` | `endingTime` The time when the presentation ends.
`protected Time` | `firstStartingTime` The time when the presentation starts at the beginning day.
`protected int` | `id` The DB-ID.
`private static String` | `instructQueryString` SQL query to get all presentations which are instructed by certain lecturer.
`protected Time` | `lastEndingTime` The time when the presentation ends at the ending day.
`protected String` | `location` The location of the presentation (such as the room).
`static List<Integer>` | `lockedIds` A list of the ids of locked records.
`protected static String` | `presentationInsertString` SQL query to insert a presentation record.
`private static String` | `presentationQueryString` SQL query to get all presentations of a certain seminartype.
`protected static String` | `presentationUpdateString` SQL query to update a presentation record.
`private static String` | `queryString` SQL query to get all presentation records from the database.
`protected int` | `seminarTypeId` The id of the corresponding seminartype.
`protected Time` | `startingTime` The time when the presentation begins.
`protected String` | `street` The street.
`private static String` | `superviseQueryString` SQL query to get all presentations supervised by a certain lecturer.
`private static String` | `tableName` The name of the corresponding table in the db.
`protected String` | `zipCode` The zip code.

Fields inherited from class semorg.sql.tables.AbstractTable
`creationDate, modificationDate, NULL_ID`

Constructor Summary
`protected` | `Presentation(int id, int seminarTypeId, Integer duration, Date beginningDay, Date endingDay, Time startingTime, Time endingTime, Time firstStartingTime, Time lastEndingTime, String location, String street, String zipCode, String city, String country, String annex, boolean cancelled, Timestamp creationDate, Timestamp modificationDate)` Initializes the common properties of all presentations with the given parameters.

Method Summary
`static void` | `createPresentationTable(Statement statement)` Creates the table "presentation" if it does not exist.
`boolean` | `equals(Object otherPresentation)` If the given object is an instance of the Presentation class this method compares the id of the given and the actual object, otherwise it calls the equal-method of the AbstractTable class with the given object.
`String` | `getAnnex()`
`Date` | `getBeginningDay()`
`String` | `getCity()`
`static Vector<DBColumn>` | `getColumns()` Returns a vector of `DBColumn` instances according to the properties of the table "presentation".
`static Vector<DBColumn>` | `getColumnsWithSemtype()` Returns a `Vector` of `DBColumn` objects for the current `Presentation` instance.
`String` | `getCountry()`
`Integer` | `getDuration()`
`Date` | `getEndingDay()`
`Time` | `getEndingTime()`
`Time` | `getFirstStartingTime()`
`int` | `getId()` Returns the DB-ID of a database records.
`Time` | `getLastEndingTime()`
`String` | `getLocation()`
`static Presentation` | `getPresentation(int presentationId)` Returns for given id the corresponding `Presentation` object.
`static DistinctVector<Presentation>` | `getPresentationVectorFromDB(Vector<DBConstraint> additionalConstraints, String sortString)` Creates a PreparedStatement instance with the given parameters, executes the query and returns a vector of Presentation instances corresponding to the ResultSet of the query.
`static DistinctVector<Presentation>` | `getPresForSemType(int semTypeId)` Returns all presentations which possess the given seminartype.
`static DistinctVector<Presentation>` | `getPresInstructedBy(int lecturerId)` Returns all presentations which are instructed by a lecturer corresponding to the given id.
`static DistinctVector<Presentation>` | `getPresSupervisedBy(int lecturerId)` Returns all presentations which are supervised by a lecturer corresponding to the given id.
`String` | `getSeminarTypeDescription()` Returns the shortened title of the seminartype corresponding to the current `Presentation` object.
`static SeminarType` | `getSeminarTypeForPresId(int presId)` Returns the seminartype for the given presentation id.
`int` | `getSeminarTypeId()`
`String` | `getShortDescription()` Returns a String composed of the id of the current presentation and the shortened title of the corresponding seminartype.
`Time` | `getStartingTime()`
`String` | `getStreet()`
`private static DistinctVector<Presentation>` | `getVector(ResultSet resultSet)` Creates for each element in a given ResultSet instance an instance of this class and returns a vector with the resulting class objects.
`String` | `getZipCode()`
`int` | `hashCode()` Returns the id.
`int` | `insertIntoDB()` Converts the actual Presentation object into a database record and inserts it into the table presentation.
`boolean` | `isCancelled()`
`static void` | `removeFromDB(Iterable selectedElements)` Removes the given elements from the table "presentation".
`void` | `setAnnex(String annex)`
`void` | `setBeginningDay(Date beginningDay)`
`void` | `setCancelled(boolean cancelled)`
`void` | `setCity(String city)`
`void` | `setCountry(String country)`
`void` | `setDuration(Integer duration)`
`void` | `setEndingDay(Date endingDay)`
`void` | `setEndingTime(Time endingTime)`
`void` | `setFirstStartingTime(Time firstStartingTime)`
`void` | `setLastEndingTime(Time lastEndingTime)`
`void` | `setLocation(String location)`
`void` | `setSeminarTypeId(int seminarTypeId)`
`void` | `setStartingTime(Time startingTime)`
`void` | `setStreet(String street)`
`void` | `setZipCode(String zipCode)`
`static boolean` | `tableOK()` Checks if the according DB table exists.
`void` | `updateDB()` Converts the actual `Presentation` object into a database record and updates a existing record to the changes made.

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

### lockedIds

    public static List<Integer> lockedIds

  A list of the ids of locked records. This list is meant to avoid the deletion or changing of records, which are currently edited.

### id

    protected int id

  The DB-ID.

### seminarTypeId

    protected int seminarTypeId

  The id of the corresponding seminartype. Has to be not null.

### duration

    protected Integer duration

  The duration of the presentation.

### beginningDay

    protected Date beginningDay

  The day when the presentation begins.

### endingDay

    protected Date endingDay

  The last day of the presentation.

### startingTime

    protected Time startingTime

  The time when the presentation begins.

### endingTime

    protected Time endingTime

  The time when the presentation ends.

### firstStartingTime

    protected Time firstStartingTime

  The time when the presentation starts at the beginning day.

### lastEndingTime

    protected Time lastEndingTime

  The time when the presentation ends at the ending day.

### location

    protected String location

  The location of the presentation (such as the room).

### street

    protected String street

  The street.

### zipCode

    protected String zipCode

  The zip code.

### city

    protected String city

  The city.

### country

    protected String country

  The country.

### annex

    protected String annex

  The annex.

### cancelled

    protected boolean cancelled

  `true` if the presentation is canceled, `false` otherwise.

### tableName

    private static String tableName

  The name of the corresponding table in the db.

### superviseQueryString

    private static String superviseQueryString

  SQL query to get all presentations supervised by a certain lecturer.

### instructQueryString

    private static String instructQueryString

  SQL query to get all presentations which are instructed by certain lecturer.

### presentationQueryString

    private static String presentationQueryString

  SQL query to get all presentations of a certain seminartype.

### queryString

    private static String queryString

  SQL query to get all presentation records from the database.

### presentationInsertString

    protected static String presentationInsertString

  SQL query to insert a presentation record.

### createTableSQLString

    private static String createTableSQLString

  SQL statement for creating the table "presentation" (if not exists).

### presentationUpdateString

    protected static String presentationUpdateString

  SQL query to update a presentation record.

Constructor Detail

### Presentation

    protected Presentation(int id,
                           int seminarTypeId,
                           Integer duration,
                           Date beginningDay,
                           Date endingDay,
                           Time startingTime,
                           Time endingTime,
                           Time firstStartingTime,
                           Time lastEndingTime,
                           String location,
                           String street,
                           String zipCode,
                           String city,
                           String country,
                           String annex,
                           boolean cancelled,
                           Timestamp creationDate,
                           Timestamp modificationDate)
                    throws SQLException

  Initializes the common properties of all presentations with the given parameters.

  Throws:
    `SQLException`

Method Detail

### getSeminarTypeDescription

    public String getSeminarTypeDescription()

  Returns the shortened title of the seminartype corresponding to the current `Presentation` object.

  Returns:
    shortened title of the seminartype of this presentation.

### 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)`

### createPresentationTable

    public static void createPresentationTable(Statement statement)
                                        throws SQLException

  Creates the table "presentation" 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 of the given statement with the query `createTableSQLString` or its closing fails.

### insertIntoDB

    public int insertIntoDB()
                     throws SQLException

  Converts the actual Presentation object into a database record and inserts it into the table presentation. Furthermore this method queries the auto-generated id, sets the appropriate property `id` and returns the id. If a country or annex has been inserted into the form, this method also inserts the concerning properties into the table "enumeration" for later use. Finally it fires a TableChanged-EventListener to update the UI.

  Returns:
    the auto-generated id of the inserted tupel.
  Throws:
    `SQLException` - If the auto-generated id can't resolved from the db, i.e. it hasn't been generated, or the PreparedStatement instance can't be created or executed etc.

### updateDB

    public void updateDB()
                  throws SQLException

  Converts the actual `Presentation` object into a database record and updates a existing record to the changes made. If a country or annex has been inserted into the form, this method also inserts the concerning properties into the table "enumeration" for later use. Finally it fires a TableChanged-EventListener to update the UI.

  Throws:
    `SQLException` - If the PreparedStatement instance can't be created or executed, this exception is thrown.

### removeFromDB

    public static void removeFromDB(Iterable selectedElements)
                             throws SQLException

  Removes the given elements from the table "presentation".

  Hint: The given elements should be ONLY deleted from the table "presentation", i.e. NOT in the extending classes/tables, because the rest is done by the dbms in order to fulfill a FK-constraint with an ON-DELETE-cascade.

  Due to the FK connections (with an ON-DELETE-cascade) this method fires several TableChanged-Events to update the UI.

  Parameters:
    `selectedElements` - the elements, which should be deleted from the database.
  Throws:
    `SQLException` - Throws a SQL exception if the Statement instance can't be created or executed.

### getColumns

    public static Vector<DBColumn> getColumns()

  Returns a vector of `DBColumn` instances according to the properties of the table "presentation". Note that this function maps the names of the database columns to the names of the GUI tables.

  Returns:
    the vector of DBColumn instances.
  See Also:
    `AbstractTable.getColumns(String tableAbbreviation)`

### getVector

    private static DistinctVector<Presentation> getVector(ResultSet resultSet)

  Creates for each element in a given ResultSet instance an instance of this class and returns a vector with the resulting class objects.

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

### getPresSupervisedBy

    public static DistinctVector<Presentation> getPresSupervisedBy(int lecturerId)
                                                            throws SQLException

  Returns all presentations which are supervised by a lecturer corresponding to the given id.

  Parameters:
    `lecturerId` - id of the supervising lecturer
  Returns:
    `DistinctVector` instance filled with all presentations which are supervised by the given lecturer.
  Throws:
    `SQLException` - Throws a SQL exception if the Statement instance can't be created or executed.

### getPresInstructedBy

    public static DistinctVector<Presentation> getPresInstructedBy(int lecturerId)
                                                            throws SQLException

  Returns all presentations which are instructed by a lecturer corresponding to the given id.

  Parameters:
    `lecturerId` - id of the instructing lecturer
  Returns:
    `DistinctVector` instance filled with all presentations which are instructed by the given lecturer.
  Throws:
    `SQLException` - Throws a SQL exception if the Statement instance can't be created or executed.

### getPresForSemType

    public static DistinctVector<Presentation> getPresForSemType(int semTypeId)
                                                          throws SQLException

  Returns all presentations which possess the given seminartype.

  Parameters:
    `semTypeId` - id of the seminartype
  Returns:
    `DistinctVector` instance filled with all presentations which possess the given seminartype.
  Throws:
    `SQLException` - Throws a SQL exception if the Statement instance can't be created or executed.

### getPresentationVectorFromDB

    public static DistinctVector<Presentation> getPresentationVectorFromDB(Vector<DBConstraint> additionalConstraints,
                                                                           String sortString)
                                                                    throws SQLException

  Creates a PreparedStatement instance with the given parameters, executes the query and returns a vector of Presentation 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.

### getPresentation

    public static Presentation getPresentation(int presentationId)
                                        throws SQLException

  Returns for given id the corresponding `Presentation` object.

  Parameters:
    `presentationId` - id of the wanted `Presentation` instance.
  Returns:
    `Presentation` object corresponding to the given id.
  Throws:
    `SQLException` - if the PreparedStatement can't be created or the execution of the query fails.
  See Also:
    `getPresentationVectorFromDB(Vector, String)`

### getColumnsWithSemtype

    public static Vector<DBColumn> getColumnsWithSemtype()

  Returns a `Vector` of `DBColumn` objects for the current `Presentation` instance.
  Note that the second element in the vector gets replaced by a `DBColumn` which contains the shortened title of the corresponding `SeminarType`.

### hashCode

    public int hashCode()

  Returns the id.

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object otherPresentation)

  If the given object is an instance of the Presentation class this method compares the id of the given and the actual object, otherwise it calls the equal-method of the AbstractTable class with the given object.

  Overrides:
    `equals` in class `Object`
  Parameters:
    `otherPresentation` - object to be compared with the actual object.
  Returns:
    `true` if the id of the given object and the actual object are the same, `false` otherwise.

### getShortDescription

    public String getShortDescription()

  Returns a String composed of the id of the current presentation and the shortened title of the corresponding seminartype.

### getSeminarTypeForPresId

    public static SeminarType getSeminarTypeForPresId(int presId)
                                               throws SQLException

  Returns the seminartype for the given presentation id.

  Parameters:
    `presId` - the id of the presentation
  Returns:
    `SeminarType` instance corresponding to the presenation
  Throws:
    `SQLException` - SQLException if the PreparedStatement can't be created or the execution of the query fails.
  See Also:
    `SeminarType.getSeminarTypeFromDB(int)`

### getAnnex

    public String getAnnex()

### setAnnex

    public void setAnnex(String annex)

### getBeginningDay

    public Date getBeginningDay()

### setBeginningDay

    public void setBeginningDay(Date beginningDay)

### isCancelled

    public boolean isCancelled()

### setCancelled

    public void setCancelled(boolean cancelled)

### getCity

    public String getCity()

### setCity

    public void setCity(String city)

### getCountry

    public String getCountry()

### setCountry

    public void setCountry(String country)

### getDuration

    public Integer getDuration()

### setDuration

    public void setDuration(Integer duration)

### getEndingDay

    public Date getEndingDay()

### setEndingDay

    public void setEndingDay(Date endingDay)

### getEndingTime

    public Time getEndingTime()

### setEndingTime

    public void setEndingTime(Time endingTime)

### getFirstStartingTime

    public Time getFirstStartingTime()

### setFirstStartingTime

    public void setFirstStartingTime(Time firstStartingTime)

### getLastEndingTime

    public Time getLastEndingTime()

### setLastEndingTime

    public void setLastEndingTime(Time lastEndingTime)

### getLocation

    public String getLocation()

### setLocation

    public void setLocation(String location)

### getSeminarTypeId

    public int getSeminarTypeId()

### setSeminarTypeId

    public void setSeminarTypeId(int seminarTypeId)

### getStartingTime

    public Time getStartingTime()

### setStartingTime

    public void setStartingTime(Time startingTime)

### getStreet

    public String getStreet()

### setStreet

    public void setStreet(String street)

### getZipCode

    public String getZipCode()

### setZipCode

    public void setZipCode(String zipCode)

### getId

    public int getId()

  Description copied from interface: `SimpleIDKey`
  Returns the DB-ID of a database records.

  Specified by:
    `getId` in interface `SimpleIDKey`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD