net.bryansaunders.jee6divelog.service
Class UserAccountService

java.lang.Object
  extended by net.bryansaunders.jee6divelog.service.UserAccountService

public class UserAccountService
extends java.lang.Object

User Service for Working with User.

Author:
Bryan Saunders

Constructor Summary
UserAccountService()
           
 
Method Summary
 boolean clearApiKey(java.lang.String username)
          Reset the API Key for the specified user.
 UserAccount createUser(UserAccount user)
          Creates a new User.
 java.util.List<UserAccount> findByExample(UserAccount example)
          Finds all the Users that Match the provided Example.
 UserAccount findByUserEmail(java.lang.String username)
          Find a User by their Username.
 java.util.List<UserAccount> getAll()
          Gets all the Users.
 UserAccount saveUser(UserAccount userAccount)
          Saves the Given User.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserAccountService

public UserAccountService()
Method Detail

createUser

public UserAccount createUser(UserAccount user)
Creates a new User.

Parameters:
user - User to Create.
Returns:
Saved user object, or null if an error occured.

findByUserEmail

public UserAccount findByUserEmail(java.lang.String username)
Find a User by their Username. NoResultException thrown if the user is not found.

Parameters:
username - Username to search for
Returns:
User if found, null if not

saveUser

public UserAccount saveUser(UserAccount userAccount)
Saves the Given User.

Parameters:
userAccount - User to save.
Returns:
Saved User

clearApiKey

public boolean clearApiKey(java.lang.String username)
Reset the API Key for the specified user.

Parameters:
username - User to reset API Key for
Returns:
true if the ApiKey was Reset, false otherwise

findByExample

public java.util.List<UserAccount> findByExample(UserAccount example)
Finds all the Users that Match the provided Example.

Parameters:
example - Example User
Returns:
List of Matches

getAll

public java.util.List<UserAccount> getAll()
Gets all the Users.

Returns:
List of Users.


Copyright © 2012 Bryan Saunders. All Rights Reserved.