|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsemorg.sql.tables.AbstractTable
semorg.sql.tables.Booking
public abstract class Booking
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 |
---|
public static List<Integer> lockedIds
protected int id
protected Date enrolled
protected Date confirmed
protected Date billed
protected Date signedOff
protected Date messaged
private static String tableName
protected static String bookingInsertString
private static String createTableSQLString
protected static String bookingUpdateString
Constructor Detail |
---|
protected Booking(int id, Date enrolled, Date confirmed, Date billed, Date signedOff, Date messaged, Timestamp creationDate, Timestamp modificationDate)
Method Detail |
---|
public static boolean tableOK()
true
, if the table is ok, false
otherwise.AbstractTable.tableOK(String)
public static void createBookingTable(Statement statement) throws SQLException
createTableSQLString
via the given
Statement object.
statement
- a Statement instance for executing the creation query.
SQLException
- Throws the SQL exception if the execution fails.public int insertIntoDB() throws SQLException
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.
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.public void updateDB() throws SQLException
bookingUpdateString
by setting the parameters and finally
executes the query. Finally it fires a TableChanged-Event-Listener to
update the UI.
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.public static void removeFromDB(Iterable selectedElements) throws SQLException
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.
selectedElements
- the elements, which should be deleted from the database.
SQLException
- Throws a SQL exception if the Statement instance can't be
created or executed.public static Vector<DBColumn> getColumns()
DBColumn
instances according to
the properties of the table Booking.
Hint: The properties of the AbstractTable table are also included.
public Date getBilled()
public void setBilled(Date billed)
billed
- the new billing datepublic Date getConfirmed()
public void setConfirmed(Date confirmed)
confirmed
- the new confirmation date.public Date getEnrolled()
public void setEnrolled(Date enrolled)
enrolled
- the new enrollment date.public Date getMessaged()
public void setMessaged(Date messaged)
messaged
- the new date of information.public Date getSignedOff()
public void setSignedOff(Date signedOff)
signedOff
- the new date of deregistration.public int getId()
getId
in interface SimpleIDKey
public int hashCode()
hashCode
in class Object
public boolean equals(Object otherBooking)
equals
in class Object
otherBooking
- object, which should be compared with actual object.
true
if the id of the given object and the actual
object are the same, false
otherwise.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |