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 Booking

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

All Implemented Interfaces:
  SimpleIDKey

Direct Known Subclasses:
  ClientBooking, CompanyBooking

    public abstract class Booking

extends AbstractTable
implements SimpleIDKey

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

Field Summary
`protected Date` | `billed` The billing date.
`protected static String` | `bookingInsertString` Parameterized SQL statement for inserting a record into the table "booking".
`protected static String` | `bookingUpdateString` Parameterized SQL statement for updating a booking record.
`protected Date` | `confirmed` The date of comfirmation of the enrollment of a customer into a presentation according to this booking.
`private static String` | `createTableSQLString` SQL statement for creating the table "booking" if it does not exist.
`protected Date` | `enrolled` The date of enrollment of a customer into a presentation according to this booking.
`protected int` | `id` The DB-ID.
`static List<Integer>` | `lockedIds` A list of the ids of locked records.
`protected Date` | `messaged` The date of information.
`protected Date` | `signedOff` The date of deregistration.
`private static String` | `tableName` The name of the table in the db.

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

Constructor Summary
`protected` | `Booking(int id, Date enrolled, Date confirmed, Date billed, Date signedOff, Date messaged, Timestamp creationDate, Timestamp modificationDate)` Creates an instance of this class with the given values.

Method Summary
`static void` | `createBookingTable(Statement statement)` Executes the sql statement `createTableSQLString` via the given Statement object.
`boolean` | `equals(Object otherBooking)` If the given object is an instance of the Booking 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.
`Date` | `getBilled()` Returns the billing date.
`static Vector<DBColumn>` | `getColumns()` Returns a vector of `DBColumn` instances according to the properties of the table Booking.
`Date` | `getConfirmed()` Returns the confirmation date.
`Date` | `getEnrolled()` Returns the enrollment date.
`int` | `getId()` Returns the id.
`Date` | `getMessaged()` Returns the date of information.
`Date` | `getSignedOff()` Returns the date of deregistration.
`int` | `hashCode()` Returns the id.
`int` | `insertIntoDB()` Inserts a data record into the database table "booking".
`static void` | `removeFromDB(Iterable selectedElements)` Removes the given elements from the table "Booking".
`void` | `setBilled(Date billed)` Sets the billing date.
`void` | `setConfirmed(Date confirmed)` Sets the confirmation date.
`void` | `setEnrolled(Date enrolled)` Sets the enrollment date.
`void` | `setMessaged(Date messaged)` Sets the date of information.
`void` | `setSignedOff(Date signedOff)` Sets the date of deregistration.
`static boolean` | `tableOK()` Checks if the according DB table exists.
`void` | `updateDB()` Updates a data record in the database table "Booking".

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 of records, which are curently edited.

### id

    protected int id

  The DB-ID.

### enrolled

    protected Date enrolled

  The date of enrollment of a customer into a presentation according to this booking.

### confirmed

    protected Date confirmed

  The date of comfirmation of the enrollment of a customer into a presentation according to this booking.

### billed

    protected Date billed

  The billing date.

### signedOff

    protected Date signedOff

  The date of deregistration.

### messaged

    protected Date messaged

  The date of information.

### tableName

    private static String tableName

  The name of the table in the db.

### bookingInsertString

    protected static String bookingInsertString

  Parameterized SQL statement for inserting a record into the table "booking".

### createTableSQLString

    private static String createTableSQLString

  SQL statement for creating the table "booking" if it does not exist.

### bookingUpdateString

    protected static String bookingUpdateString

  Parameterized SQL statement for updating a booking record.

Constructor Detail

### Booking

    protected Booking(int id,
                      Date enrolled,
                      Date confirmed,
                      Date billed,
                      Date signedOff,
                      Date messaged,
                      Timestamp creationDate,
                      Timestamp modificationDate)

  Creates an instance of this class with the given values.

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

### createBookingTable

    public static void createBookingTable(Statement statement)
                                   throws SQLException

  Executes the sql statement `createTableSQLString` via the given Statement object.

  Parameters:
    `statement` - a Statement instance for executing the creation query.
  Throws:
    `SQLException` - Throws the SQL exception if the execution fails.

### insertIntoDB

    public int insertIntoDB()
                     throws SQLException

  Inserts a data record into the database table "booking".

  Due to doing that it creates a PreparedStatement instance from the parameterized SQL query `bookingInsertString` by setting the parameters and finally executes the query.

  Furthermore this method queries the auto-generated id, sets the appropriate property `id` and returns the id.

  Finally it fires a TableChanged-Event-Listener 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 hasnt been generated, or the PreparedStatement instance can't be created or executed, this exception is thrown.

### updateDB

    public void updateDB()
                  throws SQLException

  Updates a data record in the database table "Booking". Due to doing that it creates a PreparedStatement instance from the parameterized SQL query `bookingUpdateString` by setting the parameters and finally executes the query. Finally it fires a TableChanged-Event-Listener to update the UI.

  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, this exception is thrown.

### removeFromDB

    public static void removeFromDB(Iterable selectedElements)
                             throws SQLException

  Removes the given elements from the table "Booking".

  Hint: The given elements should be ONLY deleted from the table "Booking", i.e. NOT in the extending classes/tables, because the rest is done by the dbms in order to fullfill 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 Booking.

  Hint: The properties of the AbstractTable table are also included.

  Returns:
    the vector of DBColumn instances.

### getBilled

    public Date getBilled()

  Returns the billing date.

### setBilled

    public void setBilled(Date billed)

  Sets the billing date.

  Parameters:
    `billed` - the new billing date

### getConfirmed

    public Date getConfirmed()

  Returns the confirmation date.

  Returns:
    the confirmed

### setConfirmed

    public void setConfirmed(Date confirmed)

  Sets the confirmation date.

  Parameters:
    `confirmed` - the new confirmation date.

### getEnrolled

    public Date getEnrolled()

  Returns the enrollment date.

  Returns:
    the enrollement date.

### setEnrolled

    public void setEnrolled(Date enrolled)

  Sets the enrollment date.

  Parameters:
    `enrolled` - the new enrollment date.

### getMessaged

    public Date getMessaged()

  Returns the date of information.

  Returns:
    the date of information.

### setMessaged

    public void setMessaged(Date messaged)

  Sets the date of information.

  Parameters:
    `messaged` - the new date of information.

### getSignedOff

    public Date getSignedOff()

  Returns the date of deregistration.

  Returns:
    the date of deregistration.

### setSignedOff

    public void setSignedOff(Date signedOff)

  Sets the date of deregistration.

  Parameters:
    `signedOff` - the new date of deregistration.

### getId

    public int getId()

  Returns the id.

  Specified by:
    `getId` in interface `SimpleIDKey`

### hashCode

    public int hashCode()

  Returns the id.

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object otherBooking)

  If the given object is an instance of the Booking 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:
    `otherBooking` - object, which should be compared with actual object.
  Returns:
    `true` if the id of the given object and the actual object are the same, `false` otherwise.

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