|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuserman.UserManager
@Named @SessionScoped public class UserManager
The UserManager bean class handles all aspects of logging in and registering. For other modules, it provides access to information about the current application user.
This class represents a session-scoped managed bean with name userManager.
This class exposes the following properties:
| Property | Value |
|---|---|
| user | current application user as a User object |
| allUsers | all application users as a Result object |
| nothingSelected | true if no user management task has been selected by the admin |
| editSelected | true if the Edit Users task has been selected by the admin |
| pendingSelected | true if the Review Pending task has been selected by the admin |
| selectedUser | integer ID of a user selected for editing |
| editedUser | current user being edited as a User object |
| errorMessage | the current error message string if any |
| Nested Class Summary | |
|---|---|
static class |
UserManager.Status
An enumerated type for representing login and registration status. |
| Field Summary | |
|---|---|
static java.lang.String |
HASH_ALGORITHM
|
| Constructor Summary | |
|---|---|
UserManager()
The UserManager constructor creates two User objects. |
|
| Method Summary | |
|---|---|
UserManager.Status |
attemptLogin(java.lang.String name,
java.lang.String password)
Attempts to look up a user in the database with the given login information. |
UserManager.Status |
attemptRegister(java.lang.String name,
java.lang.String password)
Attempts to add a new user to the database |
java.lang.String |
editUser(int id)
Action method called when an administrator selects a user for editing. |
javax.servlet.jsp.jstl.sql.Result |
getAllUsers()
Getter for the allUsers property. |
User |
getEditedUser()
Getter for the editedUser property. |
java.lang.String |
getErrorMessage()
Getter for the errorMessage property. |
int |
getSelectedUser()
Getter for the selectedUser property. |
User |
getUser()
Getter for the user property. |
boolean |
isEditSelected()
Getter for the editSelected property. |
boolean |
isNothingSelected()
Getter for the nothingSelected property. |
boolean |
isPendingSelected()
Getter for the pendingSelected property. |
void |
logout()
Replaces all current user information with default (unauthorized) guest information. |
java.lang.String |
selectEdit()
Action method called when an administrator selects the Edit Users task. |
java.lang.String |
selectPending()
Action method called when an administrator selects the Review Pending task. |
void |
setErrorMessage(java.lang.String errorMessage)
Setter for the errorMessage property. |
void |
updateUser(User user)
Updates a user's database information. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String HASH_ALGORITHM
| Constructor Detail |
|---|
public UserManager()
| Method Detail |
|---|
public User getUser()
public User getEditedUser()
public java.lang.String getErrorMessage()
public void setErrorMessage(java.lang.String errorMessage)
errorMessage - the current error message
public UserManager.Status attemptLogin(java.lang.String name,
java.lang.String password)
throws java.sql.SQLException,
java.io.IOException
name - the submitted user namepassword - the submitted password
java.sql.SQLException - if a database error occurs
java.io.IOException - if a query file error occurspublic void logout()
public UserManager.Status attemptRegister(java.lang.String name,
java.lang.String password)
throws java.io.IOException,
java.sql.SQLException
name - password -
java.io.IOException
java.sql.SQLExceptionpublic javax.servlet.jsp.jstl.sql.Result getAllUsers()
public void updateUser(User user)
throws java.sql.SQLException,
java.io.IOException
user -
java.sql.SQLException
java.io.IOExceptionpublic java.lang.String selectEdit()
public int getSelectedUser()
public java.lang.String editUser(int id)
id - the database ID of the selected user
public java.lang.String selectPending()
public boolean isNothingSelected()
public boolean isPendingSelected()
public boolean isEditSelected()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||