|
||||||||||
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
semorg.sql.tables.Associate
public class Associate
Models the person in the role of an associate.
Field Summary | |
---|---|
private static String |
associateInsertString
SQL query to insert a associate record. |
private static String |
associateUpdateString
SQL query to update a associate record. |
private static String |
createTableSQLString
SQL statement for creating the table "associate" (if not exists). |
private int |
entitlement
The entitlement owned by the associate. |
private String |
occupation
The occupation performed by the associate. |
private String |
password
The password for the login. |
private static String |
queryString
SQL query to get all associate records from the database. |
private static String |
tableName
The name of the DB table which holds all the records. |
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 | |
---|---|
Associate(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,
int entitlement,
String password,
String occupation,
String shortinfo,
String notices,
Timestamp creationDate,
Timestamp modificationDate)
Creates an instance of the class Associate with the given parameters. |
Method Summary | |
---|---|
static void |
createAssociateTable(Statement statement)
Creates the table "associate" if it does not exist. |
static Vector<DBColumn> |
getColumns()
Returns a vector of DBColumn instances according to
the properties of the tables "person" and "associate". |
int |
getEntitlement()
|
static Associate |
getNext(int associateId)
Returns for a DB-ID the Associate instance according to the record which has the next bigger id. |
String |
getOccupation()
|
String |
getPassword()
|
static Associate |
getPrevious(int associateId)
Returns for a DB-ID the Associate instance according to the record which has the next smaller id. |
private static DistinctVector<Associate> |
getVector(ResultSet resultSet)
Creates for each element in a given ResultSet instance an Associate object and returns a vector with the created Associate instances. |
static DistinctVector<Associate> |
getVectorFromDB(Vector<DBConstraint> additionalConstraints,
String sortString)
Creates a PreparedStatement instance with the given parameters, executes the query and returns a vector of Associate instances corresponding to the ResultSet of the query. |
int |
insertIntoDB()
Inserts a associate record into the db. |
void |
setEntitlement(int entitlement)
|
void |
setOccupation(String occupation)
|
void |
setPassword(String password)
|
static boolean |
tableOK()
Checks if the according DB table exists. |
void |
updateDB()
Updates a associate 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 |
---|
private int entitlement
private String password
private String occupation
private static String tableName
private static String queryString
private static String associateInsertString
private static String associateUpdateString
private static String createTableSQLString
Constructor Detail |
---|
public Associate(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, int entitlement, String password, String occupation, String shortinfo, String notices, Timestamp creationDate, Timestamp modificationDate)
Method Detail |
---|
private static DistinctVector<Associate> getVector(ResultSet resultSet)
resultSet
- given ResultSet instance.
public static DistinctVector<Associate> getVectorFromDB(Vector<DBConstraint> additionalConstraints, String sortString) throws SQLException
additionalConstraints
- additional conditions of the WHERE-clausesortString
- sort string with the following structure
ORDER BY attribute [ASC|DSC]
SQLException
- If the PreparedStatement can't be created or the
execution of the query fails this exception is thrown.public static boolean tableOK()
true
, if the table is ok, false
otherwise.AbstractTable.tableOK(String)
public static void createAssociateTable(Statement statement) throws SQLException
statement
- instance of the class Statement, which is used for
executing the SQL statement createTableSQLString
.
SQLException
public int getEntitlement()
public String getOccupation()
public String getPassword()
public void setEntitlement(int entitlement)
public void setOccupation(String occupation)
public void setPassword(String password)
public int insertIntoDB() throws SQLException
insertIntoDB
in class Person
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.Person.insertIntoDB()
public void updateDB() throws SQLException
updateDB
in class Person
SQLException
- If the PreparedStatement instance can't be created or
executed, this exception is thrown.Person.updateDB()
public static Associate getNext(int associateId)
associateId
- the key of the current record
AbstractTable.getNext(String, DBColumn, int)
public static Associate getPrevious(int associateId)
associateId
- the key of the current record
AbstractTable.getPrevious(String, DBColumn, int)
public static Vector<DBColumn> getColumns()
DBColumn
instances according to
the properties of the tables "person" and "associate".
Person.getColumns()
,
AbstractTable.getColumns(String tableAbbreviation)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |