com.pow2.user.dao
Class DBUserDAO

java.lang.Object
  extended bycom.pow2.dao.AbstractDAO
      extended bycom.pow2.user.dao.DBUserDAO
All Implemented Interfaces:
UserDAO

public class DBUserDAO
extends AbstractDAO
implements UserDAO

User Data access object.
Encapsulates data access methods for the User entity.
Extends AbstractDAO, and use the singleton design pattern to provide an unique object instance per vm.

Version:
$Id: DBUserDAO.java,v 1.1.1.1 2004/08/31 20:22:46 foxat Exp $
Author:
Luca Fossato

Field Summary
 
Fields inherited from class com.pow2.dao.AbstractDAO
cat
 
Constructor Summary
protected DBUserDAO()
          Default private constructor.
 
Method Summary
 void deleteUser(String id)
          Delete the User having the input id from the database.
 String getProviderType()
          Get the data provider type
 User getUser(String login, String passwd)
          Update the input User object with the user informations retrieved from the data provider.
 void getUser(User user)
          Update the input User object with the user informations retrieved from the data provider.
protected static DBUserDAO instance()
          Get the unique instance of UserDAO class.
 boolean loginExists(String login)
          Test if the input login property already exists into the application database.
 boolean loginExists(User user)
          Test if the input user login property already exists into the application database.
 void setUser(User user)
          Persist the user informations into the database.
 
Methods inherited from class com.pow2.dao.AbstractDAO
assertion, closeResources, closeResources, closeResources, count, count, delete, delete, encode, getConnection, getConnection, getNewKey, isDebugEnabled, populate, setLike, setLike
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBUserDAO

protected DBUserDAO()
Default private constructor.

Method Detail

instance

protected static DBUserDAO instance()
Get the unique instance of UserDAO class.
This method is protected; use UserDAOFactory.getUserDAO() instead.

Returns:
the instance of UserDAO class

getProviderType

public String getProviderType()
Get the data provider type

Specified by:
getProviderType in interface UserDAO
Returns:
the data provider type

getUser

public User getUser(String login,
                    String passwd)
             throws Exception
Update the input User object with the user informations retrieved from the data provider.
This method uses the User login and passwd properties to execute the login procedure.

Specified by:
getUser in interface UserDAO
Parameters:
login - the user login
passwd - the user password
Returns:
the retrieved User object if the login is succesfull; null if login fails
Throws:
Exception - if any error occurs

getUser

public void getUser(User user)
             throws Exception
Update the input User object with the user informations retrieved from the data provider.
This method uses the User login and passwd properties to execute the login procedure.

Specified by:
getUser in interface UserDAO
Parameters:
user - the user object with the login and passwd properties properly set.
Throws:
Exception - if any error occurs

setUser

public void setUser(User user)
             throws Exception
Persist the user informations into the database.
This method updates or insert a new User entry into the database depending on the user id value.

Specified by:
setUser in interface UserDAO
Parameters:
user - the user object to persist into the database
Throws:
Exception - if any error occurs

deleteUser

public void deleteUser(String id)
                throws Exception
Delete the User having the input id from the database.

Specified by:
deleteUser in interface UserDAO
Parameters:
id - the identifier of the user to remove from the database
Throws:
Exception - if any error occurs

loginExists

public boolean loginExists(User user)
                    throws Exception
Test if the input user login property already exists into the application database.

Specified by:
loginExists in interface UserDAO
Parameters:
user - the user object
Returns:
true if the input user login already exists into the application database; false otherwise
Throws:
Exception - if any error occurs

loginExists

public boolean loginExists(String login)
                    throws Exception
Test if the input login property already exists into the application database.

Specified by:
loginExists in interface UserDAO
Parameters:
login - the login string
Returns:
true if the input login already exists into the application database; false otherwise
Throws:
Exception - if any error occurs


Copyright © 2002-2004 Power Of Two S.R.L. All Rights Reserved.