net.sf.jportlet.service.user
Class UserServiceJDBC

java.lang.Object
  |
  +--net.sf.jportlet.service.PortletServiceAdapter
        |
        +--net.sf.jportlet.service.user.UserServiceJDBC
All Implemented Interfaces:
PortletService, UserService

public class UserServiceJDBC
extends PortletServiceAdapter
implements UserService

Implementation of UserService based on JDBC.

Author:
Herve Tchepannou

Field Summary
 
Fields inherited from class net.sf.jportlet.service.PortletServiceAdapter
_log, _serviceConfig, _serviceContext
 
Fields inherited from interface net.sf.jportlet.service.user.UserService
EMAIL, FIRSTNAME, LASTNAME, LOCALE, NAME, PASSWORD, USER_ID
 
Constructor Summary
UserServiceJDBC()
           
 
Method Summary
 void addUser(net.sf.jportlet.portlet.PortletRequest request)
          Create a new user account
 java.sql.Connection getConnection()
           
 java.util.Collection getRoles(java.lang.String userId)
          Retrieve all the roles of a given user
 java.lang.String getServiceName()
          Returns the name of the service
 net.sf.jportlet.portlet.User getUser(java.lang.String userId)
          Retrieve a user by its id
 net.sf.jportlet.portlet.User getUserByEmail(java.lang.String email)
          Retrieve a user by its email
 void init(net.sf.jportlet.service.PortletServiceConfig serviceConfig)
          Initialize the service
 void updateUser(net.sf.jportlet.portlet.PortletRequest request)
          Update a user account
 
Methods inherited from class net.sf.jportlet.service.PortletServiceAdapter
destroy, getInitParameter, getInitParameter, getServiceConfig
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserServiceJDBC

public UserServiceJDBC()
Method Detail

getRoles

public java.util.Collection getRoles(java.lang.String userId)
                              throws UserException
Description copied from interface: UserService
Retrieve all the roles of a given user

Specified by:
getRoles in interface UserService
Parameters:
userId - id of the user
Returns:
Collection
Throws:
UserException
See Also:
UserService.getRoles(java.lang.String)

getServiceName

public java.lang.String getServiceName()
Description copied from interface: PortletService
Returns the name of the service

Specified by:
getServiceName in interface PortletService
Returns:
String
See Also:
PortletService.getServiceName()

getUser

public net.sf.jportlet.portlet.User getUser(java.lang.String userId)
                                     throws UserException
Description copied from interface: UserService
Retrieve a user by its id

Specified by:
getUser in interface UserService
Parameters:
userId - Id of the user
Returns:
User throws UserNotFoundException if the user not found
Throws:
UserException - if any error occurs
See Also:
UserService.getUser(java.lang.String)

init

public void init(net.sf.jportlet.service.PortletServiceConfig serviceConfig)
          throws PortletServiceException
Description copied from interface: PortletService
Initialize the service

Specified by:
init in interface PortletService
Overrides:
init in class PortletServiceAdapter
PortletServiceException
See Also:
PortletService.init(net.sf.jportlet.service.PortletServiceConfig)

addUser

public void addUser(net.sf.jportlet.portlet.PortletRequest request)
             throws UserException
Description copied from interface: UserService
Create a new user account

Specified by:
addUser in interface UserService
Parameters:
request - throws UserIdNotUniqueException throws UserEmailNotUniqueException throws UserException
UserException
See Also:
UserService.addUser(net.sf.jportlet.portlet.PortletRequest)

updateUser

public void updateUser(net.sf.jportlet.portlet.PortletRequest request)
                throws UserException
Description copied from interface: UserService
Update a user account

Specified by:
updateUser in interface UserService
Parameters:
request - throws UserIdNotUniqueException throws UserEmailNotUniqueException throws UserException
UserException
See Also:
UserService.updateUser(net.sf.jportlet.portlet.PortletRequest)

getUserByEmail

public net.sf.jportlet.portlet.User getUserByEmail(java.lang.String email)
                                            throws UserException
Description copied from interface: UserService
Retrieve a user by its email

Specified by:
getUserByEmail in interface UserService
Parameters:
email -
Returns:
User throws UserNotFoundException if the user not found
Throws:
UserException - if any error occurs
See Also:
UserService.getUserByEmail(java.lang.String)

getConnection

public java.sql.Connection getConnection()
                                  throws UserException
UserException


Copyright © 2002 Herve Tchepannou. All Rights Reserved.