|
||||||||||
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.Person
public abstract class Person
This class models a person and serves as the superclass for several classes which model different roles of persons, such as Client or Lecturer.
Field Summary | |
---|---|
protected String |
annex
The annex. |
protected Date |
birthday
The birthday. |
protected String |
city
The city. |
protected String |
country
The country. |
private static String |
createTableSQLString
SQL statement for creating the table "person" (if not exists). |
protected String |
email
The email address. |
protected String |
fax
The fax number. |
protected Date |
firstContact
The date of the first contact. |
protected String |
firstname
The firstname. |
protected int |
id
The DB-ID. |
static List<Integer> |
lockedIds
This list contains the ids of data records which are locked for further editing, because they are actually edited. |
protected String |
mobile
The number of the mobile. |
protected String |
name
The name (lastname). |
protected String |
notices
The notices. |
protected static String |
personInsertString
Parameterized SQL statement for inserting a person. |
protected static String |
personUpdateString
Parameterized SQL statement for updating a person data record. |
protected String |
phone
The phone number. |
protected String |
salutation
The salutation. |
protected String |
shortinfo
The short information. |
protected String |
street
The street. |
private static String |
tableName
The name of the corresponding table in the db. |
protected String |
title
The title. |
protected String |
zipCode
The zip code. |
Fields inherited from class semorg.sql.tables.AbstractTable |
---|
creationDate, modificationDate, NULL_ID |
Constructor Summary | |
---|---|
protected |
Person(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 shortinfo,
String notices,
Timestamp creationDate,
Timestamp modificationDate)
Creates an instance of this class with the given values. |
Method Summary | |
---|---|
static void |
createPersonTable(Statement statement)
Creates the table "person" if it does not exist. |
boolean |
equals(Object otherPerson)
If the given object is an instance of the Person 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 |
getBirthday()
|
String |
getCity()
|
static Vector<DBColumn> |
getColumns()
Returns a vector of DBColumn instances according to
the properties of the table "person". |
String |
getCountry()
|
String |
getEmail()
|
String |
getFax()
|
Date |
getFirstContact()
|
String |
getFirstname()
|
int |
getId()
Returns the DB-ID of a database records. |
String |
getMobile()
|
String |
getName()
|
String |
getNotices()
|
String |
getPhone()
|
String |
getSalutation()
|
String |
getShortinfo()
|
String |
getStreet()
|
String |
getTitle()
|
String |
getZipCode()
|
int |
hashCode()
Returns the id. |
int |
insertIntoDB()
Converts the actual Person object into a database person record and inserts it into the table person. |
static void |
removeFromDB(Iterable selectedElements)
Removes the given elements from the table "person". |
void |
setAnnex(String annex)
|
void |
setBirthday(Date birthday)
|
void |
setCity(String city)
|
void |
setCountry(String country)
|
void |
setEmail(String email)
|
void |
setFax(String fax)
|
void |
setFirstContact(Date firstContact)
|
void |
setFirstname(String firstname)
|
void |
setMobile(String mobile)
|
void |
setName(String name)
|
void |
setNotices(String notices)
|
void |
setNumber(int number)
|
void |
setPhone(String phone)
|
void |
setSalutation(String salutation)
|
void |
setShortinfo(String shortinfo)
|
void |
setStreet(String street)
|
void |
setTitle(String title)
|
void |
setZipCode(String zipCode)
|
static boolean |
tableOK()
Checks if the according DB table exists. |
void |
updateDB()
Converts the actual Person object into a database person 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 |
---|
public static List<Integer> lockedIds
If a data record is to get edited, its id will be inserted into this list. Through this an exclusive access to the actual data record is assured which is meant to avoid that mutiple editing of the same record leads to inconsistencies in the data base.
protected int id
protected String salutation
protected String title
protected String firstname
protected String name
protected String street
protected String zipCode
protected String city
protected String country
protected String annex
protected String phone
protected String mobile
protected String fax
protected String email
protected Date birthday
protected Date firstContact
protected String shortinfo
protected String notices
private static String tableName
protected static String personInsertString
private static String createTableSQLString
protected static String personUpdateString
Constructor Detail |
---|
protected Person(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 shortinfo, String notices, Timestamp creationDate, Timestamp modificationDate)
Method Detail |
---|
public String getAnnex()
public Date getBirthday()
public String getCity()
public String getCountry()
public String getEmail()
public String getFax()
public String getFirstname()
public String getMobile()
public String getName()
public String getNotices()
public int getId()
SimpleIDKey
getId
in interface SimpleIDKey
public String getPhone()
public String getSalutation()
public String getShortinfo()
public String getStreet()
public String getTitle()
public String getZipCode()
public Date getFirstContact()
public void setAnnex(String annex)
public void setBirthday(Date birthday)
public void setCity(String city)
public void setCountry(String country)
public void setEmail(String email)
public void setFax(String fax)
public void setFirstContact(Date firstContact)
public void setFirstname(String firstname)
public void setMobile(String mobile)
public void setName(String name)
public void setNotices(String notices)
public void setNumber(int number)
public void setPhone(String phone)
public void setSalutation(String salutation)
public void setShortinfo(String shortinfo)
public void setStreet(String street)
public void setTitle(String title)
public void setZipCode(String zipCode)
public static boolean tableOK()
true
, if the table is ok, false
otherwise.AbstractTable.tableOK(String)
public static void createPersonTable(Statement statement) throws SQLException
statement
- instance of the class Statement, which is used for
executing the SQL statement createTableSQLString
.
SQLException
- If the execution of the given statement with the query
createTableSQLString
or its closing fails.public int insertIntoDB() throws SQLException
id
and returns
the id. If a salutation, title, 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.
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.public void updateDB() throws SQLException
SQLException
- If 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 "person", 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 "person". Note that this function maps the
names of the database columns to the names of the GUI tables.
AbstractTable.getColumns(String tableAbbreviation)
public int hashCode()
hashCode
in class Object
public boolean equals(Object otherPerson)
equals
in class Object
otherPerson
- object to be compared with the 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 |