| java.lang.Object jspPhoneBook.business.PersonList
PersonList | public class PersonList (Code) | | PhoneList defines a set of static methods that are used
to query and update phone information in the database.
|
Method Summary | |
public static void | addPerson(String firstName, String lastName, String phoneNumber) Creates a new person and adds him/her to the database.
Demonstrates how to use a
transaction to insert data into the database.
Parameters: firstName - the person's first name. Parameters: lastName - the person's last name. Parameters: phoneNumber - the person's phone number. exception: Exception - all exceptions are thrown. | public static void | deletePerson(String id) Deletes a person from the database. | public static Person | getById(String id) Queries a person from the database.
Parameters: id - the person's id. exception: Exception - all exceptions are thrown. | public static Vector[] | getLists() Queries the database for all people/phones. | public static void | modifyPerson(String id, String newFirstName, String newLastName, String newPhoneNumber) Modifies a person's profile. |
addPerson | public static void addPerson(String firstName, String lastName, String phoneNumber) throws Exception(Code) | | Creates a new person and adds him/her to the database.
Demonstrates how to use a
transaction to insert data into the database.
Parameters: firstName - the person's first name. Parameters: lastName - the person's last name. Parameters: phoneNumber - the person's phone number. exception: Exception - all exceptions are thrown. A morerobust application would handle them..... |
deletePerson | public static void deletePerson(String id) throws Exception(Code) | | Deletes a person from the database. Demonstrates how to use a
transaction to delete data in the database.
Parameters: id - the person's id exception: Exception - all exceptions are thrown. A morerobust application would handle them..... |
getById | public static Person getById(String id) throws Exception(Code) | | Queries a person from the database.
Parameters: id - the person's id. exception: Exception - all exceptions are thrown. A morerobust applications would handle them..... |
getLists | public static Vector[] getLists() throws Exception(Code) | | Queries the database for all people/phones.
Vector[0] contains the people's first names.Vector[1] contains the people's last names.Vector[2] contains the phone numbers.Vector[3] contains the people's identifiers. exception: Exception - all exceptions are thrown whenever anerror occurs. |
modifyPerson | public static void modifyPerson(String id, String newFirstName, String newLastName, String newPhoneNumber) throws Exception(Code) | | Modifies a person's profile. Demonstrates how to use a
transaction to update data in the database.
Parameters: id - the person's id Parameters: newFirstName - the person's new first name. Parameters: newLastName - the person's new last name. Parameters: newPhoneNumber - the person's new phone number. exception: Exception - all exceptions are thrown. A morerobust application would handle them..... |
|
|