|
||||||||||
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.Company
public class Company
Models a company.
Field Summary | |
---|---|
protected String |
annex
The annex. |
protected String |
city
The city. |
protected static String |
companyInsertString
Parameterized SQL statement for inserting a data record. |
protected static String |
companyUpdateString
Parameterized SQL statement for updating a data record. |
protected String |
country
The country. |
protected Date |
cpBirthDay
The birthday of the contact person. |
protected String |
cpDepartment
The departement of the contact person. |
protected String |
cpEmail
The email address of the contact person. |
protected String |
cpFax
The fax number of the contact person. |
protected String |
cpFirstname
The firstname of the contact person. |
protected String |
cpMobile
The number of the mobile phone of the contact person. |
protected String |
cpName
The lastname of the contact person. |
protected String |
cpPhone
The phone number of the contact person. |
protected String |
cpSalutation
The salutation of the contact person. |
protected String |
cpTask
The task of the contact person in the company. |
protected String |
cpTitle
The title of the contact person. |
private static String |
createTableSQLString
SQL statement for creating the table "person" (if not exists). |
protected Date |
customerSince
The date of becoming a customer. |
protected String |
email
The email address. |
protected String |
fax
The fax number. |
protected String |
firstname
The firstname. |
protected int |
id
The DB-ID. |
static List<Integer> |
lockedIds
A list of the ids of locked records. |
protected String |
mobile
The number of the mobile phone. |
protected String |
name
The name. |
protected String |
notices
The notices. |
protected String |
phone
The phone number. |
private static String |
queryString
SQL query to get all company records from the database. |
protected String |
salutation
The salutation. |
protected String |
shortInfo
The short information. |
protected String |
shortName
The short name of a company. |
protected String |
street
The street. |
private static String |
tableName
The name of the corresponding table in the db. |
protected String |
title
The title. |
protected Float |
turnover
The turnover produced by a company. |
protected String |
zipCode
The Zipcode. |
Fields inherited from class semorg.sql.tables.AbstractTable |
---|
creationDate, modificationDate, NULL_ID |
Constructor Summary | |
---|---|
Company(int id,
String shortName,
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,
String cpSalutation,
String cpTitle,
String cpFirstname,
String cpName,
String cpPhone,
String cpMobile,
String cpFax,
String cpEmail,
String cpDepartment,
Date cpBirthDay,
String cpTask,
String shortInfo,
String notices,
Float turnover,
Date customerSince,
Timestamp creationDate,
Timestamp modificationDate)
Creates an instance of the class Company with the given parameters. |
Method Summary | |
---|---|
static void |
createCompanyTable(Statement statement)
Creates the table "company" if it does not exist. |
boolean |
equals(Object otherCompany)
If the given object is an instance of the Company 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()
|
String |
getCity()
|
static Vector<DBColumn> |
getColumns()
Returns a vector of DBColumn instances according to
the properties of the table "company". |
static Company |
getCompany(int companyId)
Returns a Company instance for a given company id. |
String |
getCountry()
|
Date |
getCpBirthDay()
|
String |
getCpDepartment()
|
String |
getCpEmail()
|
String |
getCpFax()
|
String |
getCpFirstname()
|
String |
getCpMobile()
|
String |
getCpName()
|
String |
getCpPhone()
|
String |
getCpSalutation()
|
String |
getCpTask()
|
String |
getCpTitle()
|
Date |
getCustomerSince()
|
String |
getEmail()
|
String |
getFax()
|
String |
getFirstname()
|
int |
getId()
Returns the DB-ID of a database records. |
String |
getMobile()
|
String |
getName()
|
static Company |
getNext(int lecturerId)
Returns for a DB-ID the Company instance according to the record which has the next bigger id. |
String |
getNotices()
|
String |
getPhone()
|
static Company |
getPrevious(int lecturerId)
Returns for a DB-ID the Company instance according to the record which has the next smaller id. |
String |
getSalutation()
|
String |
getShortInfo()
|
String |
getShortName()
|
String |
getStreet()
|
String |
getTitle()
|
Float |
getTurnover()
|
private static DistinctVector<Company> |
getVector(ResultSet resultSet)
Creates for each element in a given ResultSet instance an Company object and returns a vector with the resulting Company instances. |
static DistinctVector<Company> |
getVectorFromDB(Vector<DBConstraint> additionalConstraints,
String sortString)
Creates a PreparedStatement instance with the given parameters, executes the query and returns a vector of Company instances corresponding to the ResultSet of the query. |
String |
getZipCode()
|
int |
hashCode()
Returns the id. |
int |
insertIntoDB()
Converts the actual Company object into a database record and inserts it into the table "company". |
static void |
removeFromDB(Iterable selectedElements)
Removes the given elements from the table "company". |
void |
setAnnex(String annex)
|
void |
setCity(String city)
|
void |
setCountry(String country)
|
void |
setCpBirthDay(Date cpBirthDay)
|
void |
setCpDepartment(String cpDepartment)
|
void |
setCpEmail(String cpEmail)
|
void |
setCpFax(String cpFax)
|
void |
setCpFirstname(String cpFirstname)
|
void |
setCpMobile(String cpMobile)
|
void |
setCpName(String cpName)
|
void |
setCpPhone(String cpPhone)
|
void |
setCpSalutation(String cpSalutation)
|
void |
setCpTask(String cpTask)
|
void |
setCpTitle(String cpTitle)
|
void |
setCustomerSince(Date customerSince)
|
void |
setEmail(String email)
|
void |
setFax(String fax)
|
void |
setFirstname(String firstname)
|
void |
setMobile(String mobile)
|
void |
setName(String name)
|
void |
setNotices(String notices)
|
void |
setPhone(String phone)
|
void |
setSalutation(String salutation)
|
void |
setShortInfo(String shortInfo)
|
void |
setShortName(String shortName)
|
void |
setStreet(String street)
|
void |
setTitle(String title)
|
void |
setTurnover(Float turnover)
|
void |
setZipCode(String zipCode)
|
static boolean |
tableOK()
Checks if the according DB table exists. |
void |
updateDB()
Converts the actual Company object into a database company 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
protected int id
protected String shortName
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 String cpSalutation
protected String cpTitle
protected String cpFirstname
protected String cpName
protected String cpPhone
protected String cpMobile
protected String cpFax
protected String cpEmail
protected String cpDepartment
protected Date cpBirthDay
protected String cpTask
protected String shortInfo
protected String notices
protected Float turnover
protected Date customerSince
private static String tableName
protected static String companyInsertString
private static String createTableSQLString
protected static String companyUpdateString
private static String queryString
Constructor Detail |
---|
public Company(int id, String shortName, 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, String cpSalutation, String cpTitle, String cpFirstname, String cpName, String cpPhone, String cpMobile, String cpFax, String cpEmail, String cpDepartment, Date cpBirthDay, String cpTask, String shortInfo, String notices, Float turnover, Date customerSince, Timestamp creationDate, Timestamp modificationDate)
Method Detail |
---|
public static boolean tableOK()
true
, if the table is ok, false
otherwise.AbstractTable.tableOK(String)
public static void createCompanyTable(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, annex, contact person salutation
or contact person title 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
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.private static DistinctVector<Company> getVector(ResultSet resultSet)
resultSet
- given ResultSet instance.
Company
instances.public static DistinctVector<Company> 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
- sf the PreparedStatement can't be created or the
execution of the query fails.public static Vector<DBColumn> getColumns()
DBColumn
instances according to
the properties of the table "company".
AbstractTable.getColumns(String tableAbbreviation)
public static Company getNext(int lecturerId)
lecturerId
- the key of the current record
AbstractTable.getNext(String, DBColumn, int)
public static Company getPrevious(int lecturerId)
lecturerId
- the key of the current record
AbstractTable.getPrevious(String, DBColumn, int)
public static Company getCompany(int companyId) throws SQLException
companyId
- id of the wanted Company instance
SQLException
- if the execution for the wanted company fails.public int hashCode()
hashCode
in class Object
public boolean equals(Object otherCompany)
equals
in class Object
otherCompany
- 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.public int getId()
SimpleIDKey
getId
in interface SimpleIDKey
public String getAnnex()
public void setAnnex(String annex)
public String getCity()
public void setCity(String city)
public String getCountry()
public void setCountry(String country)
public Date getCpBirthDay()
public void setCpBirthDay(Date cpBirthDay)
public String getCpDepartment()
public void setCpDepartment(String cpDepartment)
public String getCpEmail()
public void setCpEmail(String cpEmail)
public String getCpFax()
public void setCpFax(String cpFax)
public String getCpFirstname()
public void setCpFirstname(String cpFirstname)
public String getCpMobile()
public void setCpMobile(String cpMobile)
public String getCpName()
public void setCpName(String cpName)
public String getCpPhone()
public void setCpPhone(String cpPhone)
public String getCpSalutation()
public void setCpSalutation(String cpSalutation)
public String getCpTask()
public void setCpTask(String cpTask)
public String getCpTitle()
public void setCpTitle(String cpTitle)
public Date getCustomerSince()
public void setCustomerSince(Date customerSince)
public String getEmail()
public void setEmail(String email)
public String getFax()
public void setFax(String fax)
public String getFirstname()
public void setFirstname(String firstname)
public String getMobile()
public void setMobile(String mobile)
public String getName()
public void setName(String name)
public String getNotices()
public void setNotices(String notices)
public String getPhone()
public void setPhone(String phone)
public String getSalutation()
public void setSalutation(String salutation)
public String getShortInfo()
public void setShortInfo(String shortInfo)
public String getShortName()
public void setShortName(String shortName)
public String getStreet()
public void setStreet(String street)
public String getTitle()
public void setTitle(String title)
public Float getTurnover()
public void setTurnover(Float turnover)
public String getZipCode()
public void setZipCode(String zipCode)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |