Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## semorg.sql.tables
Class Associate

    java.lang.Object
      semorg.sql.tables.AbstractTable
          semorg.sql.tables.Person
              semorg.sql.tables.Associate

All Implemented Interfaces:
  SimpleIDKey

    public class Associate

extends Person

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

### entitlement

    private int entitlement

  The entitlement owned by the associate.

### password

    private String password

  The password for the login.

### occupation

    private String occupation

  The occupation performed by the associate.

### tableName

    private static String tableName

  The name of the DB table which holds all the records.

### queryString

    private static String queryString

  SQL query to get all associate records from the database. (delives also the inherited attributes)

### associateInsertString

    private static String associateInsertString

  SQL query to insert a associate record.

### associateUpdateString

    private static String associateUpdateString

  SQL query to update a associate record.

### createTableSQLString

    private static String createTableSQLString

  SQL statement for creating the table "associate" (if not exists).

Constructor Detail

### Associate

    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)

  Creates an instance of the class Associate with the given parameters.

Method Detail

### getVector

    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.

  Parameters:
    `resultSet` - given ResultSet instance.
  Returns:
    a DistinctVector instance filled with the created Associate instances.

### getVectorFromDB

    public static DistinctVector<Associate> getVectorFromDB(Vector<DBConstraint> additionalConstraints,
                                                            String sortString)
                                                     throws SQLException

  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.

  Parameters:
    `additionalConstraints` - additional conditions of the WHERE-clause
    `sortString` - sort string with the following structure `ORDER BY attribute [ASC|DSC]`
  Returns:
    a DistinctVector instance filled with the created Associate instances.
  Throws:
    `SQLException` - If the PreparedStatement can't be created or the execution of the query fails this exception is thrown.

### tableOK

    public static boolean tableOK()

  Checks if the according DB table exists.

  Returns:
    `true`, if the table is ok, `false` otherwise.
  See Also:
    `AbstractTable.tableOK(String)`

### createAssociateTable

    public static void createAssociateTable(Statement statement)
                                     throws SQLException

  Creates the table "associate" if it does not exist.

  Parameters:
    `statement` - instance of the class Statement, which is used for executing the SQL statement `createTableSQLString`.
  Throws:
    `SQLException`

### getEntitlement

    public int getEntitlement()

### getOccupation

    public String getOccupation()

### getPassword

    public String getPassword()

### setEntitlement

    public void setEntitlement(int entitlement)

### setOccupation

    public void setOccupation(String occupation)

### setPassword

    public void setPassword(String password)

### insertIntoDB

    public int insertIntoDB()
                     throws SQLException

  Inserts a associate record into the db. To do so, it first inserts a record into the table "person", secondly a record into the table "associate". These two records are linked by a PK-FK-association.

  Overrides:
    `insertIntoDB` in class `Person`
  Returns:
    the auto-generated id of the inserted person-tupel.
  Throws:
    `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.
  See Also:
    `Person.insertIntoDB()`

### updateDB

    public void updateDB()
                  throws SQLException

  Updates a associate record in the database. To do so, it firstly updates the corresponding record in the "person" table and secondly the record in the "associate" table.

  Overrides:
    `updateDB` in class `Person`
  Throws:
    `SQLException` - If the PreparedStatement instance can't be created or executed, this exception is thrown.
  See Also:
    `Person.updateDB()`

### getNext

    public static Associate getNext(int associateId)

  Returns for a DB-ID the Associate instance according to the record which has the next bigger id.

  Parameters:
    `associateId` - the key of the current record
  Returns:
    the Associate instance corresponding to the next record in the table "associate" or if it does not exist the Associate instance with the smallest id.
  See Also:
    `AbstractTable.getNext(String, DBColumn, int)`

### getPrevious

    public static Associate getPrevious(int associateId)

  Returns for a DB-ID the Associate instance according to the record which has the next smaller id.

  Parameters:
    `associateId` - the key of the current record
  Returns:
    the Associate instance corresponding to the previous record in the table "associate" or if it does not exist the Associate instance with the biggest id.
  See Also:
    `AbstractTable.getPrevious(String, DBColumn, int)`

### getColumns

    public static Vector<DBColumn> getColumns()

  Returns a vector of `DBColumn` instances according to the properties of the tables "person" and "associate".

  Returns:
    the vector of DBColumn instances according to the properties of the class Associate.
  See Also:
    `Person.getColumns()`, `AbstractTable.getColumns(String tableAbbreviation)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD