Main Page | Class List | Directories | Class Members

com.forum.nokia.taskmanager.database.DBAccess Class Reference

List of all members.

Public Member Functions

 DBAccess () throws Exception
boolean testConnection ()
void connect () throws SQLException
void terminateConnection ()
UserInfo validateUser (String username, String password) throws SQLException
boolean addNewTask (String owner_id, String description, String state)
List getTasks ()
List getTasks (String user_id)
boolean changeTask (String ownerId, String description, String state, String taskId)
boolean markTaskDone (String task_id)
boolean markTasksUpToDate (String userId)
boolean deleteTask (String taskId, String ownerId)
List getTaskUsers ()
List smsUsers ()
List getAllUsers ()
boolean checkCurrentPassword (String currentPw, String userId)
boolean changePassword (String newPw, String userId)
List getGroups ()
boolean addNewUser (String login, String password, String mobile, String group)
boolean changeUser (String login, String pw, String mobile, String groupId, String userId)
boolean deleteUser (String userId)

Detailed Description

This class handles the connection to the MySQL database. It is used directly by the Controller to perform database duties as well as by the beans to get data from the database to be shown on the Java Server Pages. The beans are merely an interface to access this object from the JSP side of the system.


Constructor & Destructor Documentation

com.forum.nokia.taskmanager.database.DBAccess.DBAccess  )  throws Exception
 

The constructor opens a connection to the MySQL database.

Exceptions:
Exception An Exception is thrown if opening the connection fails.


Member Function Documentation

boolean com.forum.nokia.taskmanager.database.DBAccess.addNewTask String  owner_id,
String  description,
String  state
 

Adds a new task to the database, for a single user.

Parameters:
owner_id Id of the owner of the task.
description Description of the task.
state The default state of the new task.
Returns:
True if the adding succeeded, otherwise false.

boolean com.forum.nokia.taskmanager.database.DBAccess.addNewUser String  login,
String  password,
String  mobile,
String  group
 

This function adds a new user account in to the database.

Parameters:
login Login of the new user.
password Password of the new user.
mobile Mobile number of the new user.
group Id of the group the new user belongs to.
Returns:
True if the adding succeeded, otherwise false.

boolean com.forum.nokia.taskmanager.database.DBAccess.changePassword String  newPw,
String  userId
 

Changes the user's password.

Parameters:
newPw The new password.
userId The id of the user in question.
Returns:
True if the operation was successful, otherwise false.

boolean com.forum.nokia.taskmanager.database.DBAccess.changeTask String  ownerId,
String  description,
String  state,
String  taskId
 

Changes a single tasks attributes.

Parameters:
ownerId The new owner id.
description The new description.
state The new state.
taskId The id that identifies the task.
Returns:
True if that password was valid, otherwise false.

boolean com.forum.nokia.taskmanager.database.DBAccess.changeUser String  login,
String  pw,
String  mobile,
String  groupId,
String  userId
 

This function changes the users settings.

Parameters:
login New login to be set.
pw New password (can be left empty).
mobile New mobile number.
groupId New group id.
userId The id of the user that is being modified.
Returns:
True if modification was successful, otherwise false.

boolean com.forum.nokia.taskmanager.database.DBAccess.checkCurrentPassword String  currentPw,
String  userId
 

Does a check on the users current password.

Parameters:
currentPw The user's current password.
userId The user's id number.
Returns:
True if that password was valid, otherwise false.

void com.forum.nokia.taskmanager.database.DBAccess.connect  )  throws SQLException
 

This function gets a new connection to the database.

Exceptions:
SQLException If the connection forming fails.

boolean com.forum.nokia.taskmanager.database.DBAccess.deleteTask String  taskId,
String  ownerId
 

Removes a task from the database.

Parameters:
taskId Id number of the task to be removed.
ownerId Id number of the owner of the task.
Returns:
True if the removing succeeded, otherwise false.

boolean com.forum.nokia.taskmanager.database.DBAccess.deleteUser String  userId  ) 
 

This function removes the specified user from the database.

Parameters:
userId The id number of the user scheduled for removal.
Returns:
True if the remove operation succeeded, otherwise false.

List com.forum.nokia.taskmanager.database.DBAccess.getAllUsers  ) 
 

Returns a list of all users in the database. The administrator needs to see all users so that he can change everyones attributes.

Returns:
A list of all the users in the system.

List com.forum.nokia.taskmanager.database.DBAccess.getGroups  ) 
 

Returns a list of all available user groups.

Returns:
A list of groups.

List com.forum.nokia.taskmanager.database.DBAccess.getTasks String  user_id  ) 
 

Retrieves the tasks for a single user.

Parameters:
user_id The id-number of the user.
Returns:
A list of tasks.

List com.forum.nokia.taskmanager.database.DBAccess.getTasks  ) 
 

Retrieves tasks for all users from the database.

Returns:
A list of tasks.

List com.forum.nokia.taskmanager.database.DBAccess.getTaskUsers  ) 
 

Returns a list of users that can have tasks, retrieved from the database. This list comprises of worker and manager users, since administrators can't have any tasks.

Returns:
A list of users that can have tasks.

boolean com.forum.nokia.taskmanager.database.DBAccess.markTaskDone String  task_id  ) 
 

Marks a task done in the database.

Parameters:
task_id The id of the task.
Returns:
True if the operation was successful, otherwise false.

boolean com.forum.nokia.taskmanager.database.DBAccess.markTasksUpToDate String  userId  ) 
 

Marks the users tasks as up to date.

Parameters:
userId The id of the user.
Returns:
True if the operation was successful, otherwise false.

List com.forum.nokia.taskmanager.database.DBAccess.smsUsers  ) 
 

Returns a list of users that do not have their tasks up to date. This list is used in sending SMS messages to those users that do not have their tasks up to date.

Returns:
A list of users.

void com.forum.nokia.taskmanager.database.DBAccess.terminateConnection  ) 
 

Terminates the connection to the database.

boolean com.forum.nokia.taskmanager.database.DBAccess.testConnection  ) 
 

This function tests if the connection is still alive. MySQL disconnects all connections after they've idled for 8 hours so we must test that the connection is still alive before making actual queries.

Returns:
True if the connection is alive, otherwise false.

UserInfo com.forum.nokia.taskmanager.database.DBAccess.validateUser String  username,
String  password
throws SQLException
 

Validates the user's username and password from the database.

Parameters:
username The user's username as String.
password The user's password as String.
Returns:
A struct containing info about the user.
Exceptions:
SQLException Thrown if something goes wrong while communicating with the database.


The documentation for this class was generated from the following file:
Generated on Tue Aug 30 14:22:36 2005 for TaskManagerWebUI by  doxygen 1.4.4