|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsemorg.sql.tables.Enumeration
public class Enumeration
This class model the enumerations used in the application.
Field Summary | |
---|---|
private static String |
checkForAnnexString
SQL query to check if a annex is already in use. |
private static String |
checkForCountryString
SQL query to check if a country name is already in use. |
private static String |
checkForSalutationString
SQL query to check if a salutation is already in use. |
private static String |
checkForTitleString
SQL query to check if a title is already in use. |
private static String |
createTableSQLString
SQL statement for creating the table "enumeration" (if not exists). |
private static String |
deleteString
Parameterized SQL statement for deleting a data record. |
private static String |
insertString
Parameterized SQL statement for inserting a data record. |
private static String |
queryString
SQL query to get all enumerations with a given type. |
private static String |
tableName
The name of the corresponding table in the db. |
private int |
type
The type of the current enumeration. |
static int |
TYPE_ANNEX
Enumeration s of this type refering to annexes. |
static int |
TYPE_COUNTRY
Enumeration s of this type refering to salutations. |
static int |
TYPE_SALUTATION
Enumeration s of this type refering to salutations. |
static int |
TYPE_TITLE
Enumeration s of this type refering to titles. |
private static String[] |
updateAnnexStrings
SQL queries to update all occurrences of a annexes to a new value. |
private static String[] |
updateCountryStrings
SQL queries to update all occurrences of a country name to a new value. |
private static String[] |
updateSalutationStrings
SQL queries to update all occurrences of a salutation to a new value. |
private static String |
updateString
Parameterized SQL statement for updating a data record in the table enumeration. |
private static String[] |
updateTitleStrings
SQL queries to update all occurrences of a title to a new value. |
private String |
value
The value of the current enumeration. |
Constructor Summary | |
---|---|
Enumeration(int type,
String value)
Creates instances of this class with the given parameters. |
Method Summary | |
---|---|
static void |
addAnnexEnums(org.eclipse.swt.widgets.Combo annexCombo)
Adds all enumerations of the type 3 to the given Combo field. |
static void |
addCountryEnums(org.eclipse.swt.widgets.Combo countryCombo)
Adds all enumerations of the type 2 to the given Combo field. |
private static void |
addEnums(org.eclipse.swt.widgets.Combo combo,
int type)
Adds all enumerations of the given type to the given Combo field. |
static void |
addSalutationEnums(org.eclipse.swt.widgets.Combo salutationCombo)
Adds all enumerations of the type 0 to the given Combo field. |
static void |
addTitleEnums(org.eclipse.swt.widgets.Combo titleCombo)
Adds all enumerations of the type 1 to the given Combo field. |
static void |
createEnumerationTable(Statement statement)
Creates the table "enumeration" if it does not exist. |
static Enumeration |
createNewEnumInDB(int type,
String value)
|
int |
getType()
|
String |
getValue()
|
private static DistinctVector<Enumeration> |
getVector(ResultSet resultSet)
Creates for each element in a given ResultSet instance an object of this class and returns a vector with the resulting class objects. |
static DistinctVector<Enumeration> |
getVectorFromDB(int type)
Creates a PreparedStatement instance with the given parameter, executes the query and returns a vector of instances of this class corresponding to the ResultSet of the query. |
static void |
insertAnnexStringInDB(String annex)
Inserts the given annex into the database. |
static void |
insertcountryStringInDB(String country)
Inserts the given country into the database. |
static void |
insertSalutationStringInDB(String salutation)
Inserts the given salutation into the database. |
static void |
insertTitleStringInDB(String title)
Inserts the given title into the database. |
boolean |
removeFromDB()
This method checks first if the enumeration to delete is already in use and if not deletes it form the db. |
void |
setValueInDB(String value)
Replaces all occurrences of the actual enumeration to the given value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_SALUTATION
Enumeration
s of this type refering to salutations.
public static final int TYPE_TITLE
Enumeration
s of this type refering to titles.
public static final int TYPE_COUNTRY
Enumeration
s of this type refering to salutations.
public static final int TYPE_ANNEX
Enumeration
s of this type refering to annexes.
private static String tableName
private static String createTableSQLString
private static String insertString
private static String deleteString
private static String updateString
private static String queryString
private static String checkForSalutationString
private static String checkForTitleString
private static String checkForCountryString
private static String checkForAnnexString
private static String[] updateSalutationStrings
private static String[] updateTitleStrings
private static String[] updateCountryStrings
private static String[] updateAnnexStrings
private int type
private String value
Constructor Detail |
---|
public Enumeration(int type, String value)
Method Detail |
---|
public static void createEnumerationTable(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 static DistinctVector<Enumeration> getVectorFromDB(int type) throws SQLException
type
- the type of the wanted enumerations.
SQLException
- if the PreparedStatement can't be created or the
execution of the query fails.private static DistinctVector<Enumeration> getVector(ResultSet resultSet) throws SQLException
resultSet
- given ResultSet instance.
Enumeration
instances.
SQLException
public String getValue()
public int getType()
public static Enumeration createNewEnumInDB(int type, String value) throws SQLException
SQLException
public boolean removeFromDB() throws SQLException
SQLException
- Throws a SQL exception if the Statement instance can't be
created or executed.public void setValueInDB(String value) throws SQLException
DBTableChangedListener
are fired.
value
- the new value of the actual enumeration
SQLException
- if the PreparedStatement can't be created or the
execution of the query fails.private static void addEnums(org.eclipse.swt.widgets.Combo combo, int type)
Combo
field.
combo
- the Combo
field, which takes the enumeration
values.type
- the type of the enumeration to add.public static void addSalutationEnums(org.eclipse.swt.widgets.Combo salutationCombo)
Combo
field.
salutationCombo
- the Combo
field, which takes the enumeration
values.public static void addTitleEnums(org.eclipse.swt.widgets.Combo titleCombo)
Combo
field.
titleCombo
- the Combo
field, which takes the enumeration
values.public static void addCountryEnums(org.eclipse.swt.widgets.Combo countryCombo)
Combo
field.
countryCombo
- the Combo
field, which takes the enumeration
values.public static void addAnnexEnums(org.eclipse.swt.widgets.Combo annexCombo)
Combo
field.
annexCombo
- the Combo
field, which takes the enumeration
values.public static void insertSalutationStringInDB(String salutation)
salutation
- the value of the new salutationpublic static void insertTitleStringInDB(String title)
title
- the value of the new titlepublic static void insertcountryStringInDB(String country)
country
- the value of the new countrypublic static void insertAnnexStringInDB(String annex)
annex
- the value of the new annex
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |