| net.jforum.dao.UserDAO
All known Subclasses: net.jforum.dao.generic.GenericUserDAO,
UserDAO | public interface UserDAO (Code) | | Model interface for
net.jforum.entities.User .
This interface defines methods which are expected to be
implementd by a specific data access driver. The intention is
to provide all functionality needed to update, insert, delete and
select some specific data.
author: Rafael Steil version: $Id: UserDAO.java,v 1.10 2007/09/21 17:26:08 rafaelsteil Exp $ |
Method Summary | |
public int | addNew(User user) Adds a new User.
After successfuly persisting the data, this method
shoud call user.setId(theNewId); , as well
return the new user id. | public void | addNewWithId(User user) | public void | addToGroup(int userId, int[] groupId) | public void | decrementPosts(int userId) Decrement the number of posts of some user. | public void | delete(int userId) Deletes an user. | public User | findByEmail(String email) | public List | findByName(String input, boolean exactMath) Finds an user by matching an input string. | public User | getLastUserInfo() Gest some piece of information of the last user registered
HashMap containing the information. | public int | getTotalUsers() | public int | getTotalUsersByGroup(int groupId) Gets the total number of users of some group. | public String | getUserAuthHash(int userId) | public String | getUsernameByEmail(String email) | public boolean | hasUsernameChanged(int userId, String usernameToCheck) Check if the username passed as argument is different of
the username existent in the database. | public void | incrementPosts(int userId) Increments the number of posts of the user. | public boolean | isDeleted(int user_id) whether the user is locked or not. | public boolean | isUsernameRegistered(String username) Checks the existence of some username. | public List | pendingActivations() | public void | removeFromGroup(int userId, int[] groupId) | public void | saveNewPassword(String password, String email) Writes a new password for the user. | public void | saveUserAuthHash(int userId, String hash) | public List | selectAll() Gets all users
ArrayList with the users. | public List | selectAll(int startFrom, int count) Gets all users
Parameters: startFrom - Index to start fetching from Parameters: count - Number of records to retrieve ArrayList with the users. | public List | selectAllByGroup(int groupId, int start, int count) Gets all users from a specific group.
Parameters: groupId - The group id Parameters: start - The index position to start fetching Parameters: count - The total number of records to fetch List with the users. | public List | selectAllWithKarma() Gets all users with your Karma.
List with the users. | public List | selectAllWithKarma(int startFrom, int count) Gets all users
Parameters: startFrom - Index to start fetching from Parameters: count - Number of records to retrieve ArrayList with the users. | public User | selectById(int userId) Gets a specific User . | public User | selectByName(String username) Gets a specific User .
Parameters: username - The User name to search User object containing all the informationor null if no data was found. | public void | setActive(int userId, boolean active) Set the active status.
An user with the active status equals to false cannot be considered
a "oficial", "fully registered" user until its status is set to true. | public void | setRanking(int userId, int rankingId) Sets the ranking. | public void | undelete(int userId) Undeletes an user.
The system allows user undeletation because when you
call
UserDAO.delete(int) the user isn't fisically deleted of the
database, but just marked as deleted. | public void | update(User user) Updates a user. | public void | updateUsername(int userId, String username) Updates only the username. | public boolean | validateActivationKeyHash(int userId, String hash) | public User | validateLogin(String username, String password) Validates the user login. | public boolean | validateLostPasswordHash(String email, String hash) Validate the provided security hash against the data stored in our system. | public void | writeLostPasswordHash(String email, String hash) Stores the "lost password" security hash, that was generated
when the user asked the system to get a reminder of his password. | public void | writeUserActive(int userId) |
addNew | public int addNew(User user)(Code) | | Adds a new User.
After successfuly persisting the data, this method
shoud call user.setId(theNewId); , as well
return the new user id.
Parameters: user - Reference to a valid and configured User object The new user id |
addNewWithId | public void addNewWithId(User user)(Code) | | Adds a new user with a predefined user id
(added by Pieter for external login support)
Parameters: user - Reference to a valid and configured User object, with the user id already set |
addToGroup | public void addToGroup(int userId, int[] groupId)(Code) | | Associate the user to the group
Parameters: userId - The user id Parameters: groupId - The group id to associate to |
decrementPosts | public void decrementPosts(int userId)(Code) | | Decrement the number of posts of some user.
Parameters: userId - The user ID do decrement the number of posts. |
findByEmail | public User findByEmail(String email)(Code) | | Finds a user by its email address
Parameters: email - the email address to search the user instance if a match is found, or null otherwise |
findByName | public List findByName(String input, boolean exactMath)(Code) | | Finds an user by matching an input string.
Parameters: input - The username to search. May be part of the username. The method will match all users who have the input string as part of their usernames. Parameters: exactMath - Set to true to get the user data related to the username passed as argument, and set it to false to search all users who match the criteria. List with the found users. Each entry is an User object, where only the id and usernamemembers are filled. |
getLastUserInfo | public User getLastUserInfo()(Code) | | Gest some piece of information of the last user registered
HashMap containing the information. The maphas two keys: userName: The usernameuserId: The user's ID |
getTotalUsers | public int getTotalUsers()(Code) | | Gets the total number of users
The total number of users |
getTotalUsersByGroup | public int getTotalUsersByGroup(int groupId)(Code) | | Gets the total number of users of some group.
Parameters: groupId - The group id The total number of users |
getUserAuthHash | public String getUserAuthHash(int userId)(Code) | | Retrieves the auth hash from the database
Parameters: userId - intt String |
getUsernameByEmail | public String getUsernameByEmail(String email)(Code) | | Gets the username related to the email
Parameters: email - The email to search for the username The username, if found, or an empty String |
hasUsernameChanged | public boolean hasUsernameChanged(int userId, String usernameToCheck)(Code) | | Check if the username passed as argument is different of
the username existent in the database.
Parameters: userId - The user's id to work with Parameters: usernameToCheck - The username to compare with the existingone in jforum_users true if the usernames are different. |
incrementPosts | public void incrementPosts(int userId)(Code) | | Increments the number of posts of the user.
Parameters: userId - The user ID to increment the number of posts |
isDeleted | public boolean isDeleted(int user_id)(Code) | | whether the user is locked or not.
Parameters: user_id - int boolean |
isUsernameRegistered | public boolean isUsernameRegistered(String username)(Code) | | Checks the existence of some username.
This method is used to ensure that will not be two equal usernames in the database.
Parameters: username - The username to verify true or false , if the user was found or not, respectively |
pendingActivations | public List pendingActivations()(Code) | | Returns a list of users that haven't yet activated their accounts
|
removeFromGroup | public void removeFromGroup(int userId, int[] groupId)(Code) | | Remove the user from the group
Parameters: userId - The user id Parameters: groupId - The group id to remove the user from |
saveNewPassword | public void saveNewPassword(String password, String email)(Code) | | Writes a new password for the user.
Parameters: password - The new password Parameters: email - The user email |
saveUserAuthHash | public void saveUserAuthHash(int userId, String hash)(Code) | | Saves the user-specific security hash to the database
Parameters: userId - the user id to save Parameters: hash - the security hash |
selectAll | public List selectAll()(Code) | | Gets all users
ArrayList with the users. Each entry is an User object |
selectAll | public List selectAll(int startFrom, int count)(Code) | | Gets all users
Parameters: startFrom - Index to start fetching from Parameters: count - Number of records to retrieve ArrayList with the users. Each entry is an User object |
selectAllByGroup | public List selectAllByGroup(int groupId, int start, int count)(Code) | | Gets all users from a specific group.
Parameters: groupId - The group id Parameters: start - The index position to start fetching Parameters: count - The total number of records to fetch List with the users. Each entry is an User object |
selectAllWithKarma | public List selectAllWithKarma()(Code) | | Gets all users with your Karma.
List with the users. Each entry is an User object(with the KarmaStatus populated). |
selectAllWithKarma | public List selectAllWithKarma(int startFrom, int count)(Code) | | Gets all users
Parameters: startFrom - Index to start fetching from Parameters: count - Number of records to retrieve ArrayList with the users. Each entry is an User object(with the KarmaStatus populated). |
selectById | public User selectById(int userId)(Code) | | Gets a specific User .
Parameters: userId - The User ID to search User object containing all the information See Also: UserDAO.selectAll |
selectByName | public User selectByName(String username)(Code) | | Gets a specific User .
Parameters: username - The User name to search User object containing all the informationor null if no data was found. See Also: UserDAO.selectAll |
setActive | public void setActive(int userId, boolean active)(Code) | | Set the active status.
An user with the active status equals to false cannot be considered
a "oficial", "fully registered" user until its status is set to true. This is
interesting when you want to request user confirmation about registrations,
for example
Parameters: userId - The user ID to change the status Parameters: active - true or false |
setRanking | public void setRanking(int userId, int rankingId)(Code) | | Sets the ranking.
Parameters: userId - The user ID Parameters: rankingId - int |
undelete | public void undelete(int userId)(Code) | | Undeletes an user.
The system allows user undeletation because when you
call
UserDAO.delete(int) the user isn't fisically deleted of the
database, but just marked as deleted. This is done to ensure
data integrity.
Parameters: userId - The user ID to undelete See Also: UserDAO.delete(int) |
update | public void update(User user)(Code) | | Updates a user.
Parameters: user - Reference to a User object to update |
updateUsername | public void updateUsername(int userId, String username)(Code) | | Updates only the username.
This method generally will be used in implementations
of net.jforum.drivers.external.LoginAuthenticator to
update usernames which changed in the external source and therefore
should be updated in jforum's users table.
Parameters: userId - The user's id related to the username to update Parameters: username - The new username to write |
validateActivationKeyHash | public boolean validateActivationKeyHash(int userId, String hash)(Code) | | Validate if the activated key matches the one in the database
Parameters: userId - Which user to validate the activation key? Parameters: hash - The activation key true if the data matches ok, of false if it is invalid |
validateLogin | public User validateLogin(String username, String password)(Code) | | Validates the user login.
Parameters: username - The username Parameters: password - The password The user object if the provided information was corret, null if the information was invalid |
validateLostPasswordHash | public boolean validateLostPasswordHash(String email, String hash)(Code) | | Validate the provided security hash against the data stored in our system.
Parameters: email - The user email Parameters: hash - The supplied security hash true if the data matches ok, of false if it is invalid |
writeLostPasswordHash | public void writeLostPasswordHash(String email, String hash)(Code) | | Stores the "lost password" security hash, that was generated
when the user asked the system to get a reminder of his password.
This hash is used to ensure the information supplied.
Parameters: email - The user email Parameters: hash - The hash to store. |
writeUserActive | public void writeUserActive(int userId)(Code) | | Set user account to active
Parameters: userId - Which user account to set active? |
|
|