com.elasticpath.service.cmuser.impl
Class CmUserServiceImpl

java.lang.Object
  extended by com.elasticpath.service.impl.AbstractEpServiceImpl
      extended by com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
          extended by com.elasticpath.service.cmuser.impl.CmUserServiceImpl
All Implemented Interfaces:
CmUserService, EpPersistenceService, EpService

public class CmUserServiceImpl
extends AbstractEpPersistenceServiceImpl
implements CmUserService

The default implementation of CmUserService.


Constructor Summary
CmUserServiceImpl()
           
 
Method Summary
 CmUser add(CmUser cmUser)
          Adds the given cmUser.
 boolean emailExists(CmUser cmUser)
          Check the given cmUser's email exists or not.
 boolean emailExists(java.lang.String email)
          Checks the given email exists or not.
 CmUser findByEmail(java.lang.String email)
          Find the cmUser with the given email address.
 CmUser findByUserName(java.lang.String userName)
          Find the cmUser with the given userName.
 CmUser get(long cmUserUid)
          Get the cmUser with the given UID.
 java.lang.Object getObject(long uid)
          Generic get method for all persistable domain models.
 java.util.List list()
          Lists all cmUsers stored in the database.
 CmUser load(long cmUserUid)
          Load the cmUser with the given UID.
 void remove(CmUser cmUser)
          Deletes the cmUser.
 void resetPassword(java.lang.String email)
          Resets the cmUser's password for the specified email.
 void setEmailService(EmailService emailService)
          Set the emailService.
 void setUserRoleService(UserRoleService userRoleService)
          Set the userRoleService instance.
 void update(CmUser cmUser)
          Updates the given cmUser.
 boolean userNameExists(CmUser cmUser)
          Check the given cmUser's userName exists or not.
 boolean userNameExists(java.lang.String userName)
          Checks the given userName exists or not.
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpPersistenceServiceImpl
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from class com.elasticpath.service.impl.AbstractEpServiceImpl
getElasticPath, setElasticPath
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.elasticpath.service.EpPersistenceService
getPersistenceEngine, setPersistenceEngine
 
Methods inherited from interface com.elasticpath.service.EpService
getElasticPath, setElasticPath
 

Constructor Detail

CmUserServiceImpl

public CmUserServiceImpl()
Method Detail

add

public CmUser add(CmUser cmUser)
           throws UserNameExistException,
                  EmailExistException
Adds the given cmUser.

Specified by:
add in interface CmUserService
Parameters:
cmUser - the cmUser to add
Returns:
the persisted instance of cmUser
Throws:
UserNameExistException - - the specified user name is already in use.
EmailExistException - - the specified email is already in use.

emailExists

public boolean emailExists(CmUser cmUser)
                    throws EpServiceException
Check the given cmUser's email exists or not.

Specified by:
emailExists in interface CmUserService
Parameters:
cmUser - the cmUser to check
Returns:
true if the given email exists
Throws:
EpServiceException - - in case of any errors

emailExists

public boolean emailExists(java.lang.String email)
                    throws EpServiceException
Checks the given email exists or not.

Specified by:
emailExists in interface CmUserService
Parameters:
email - the email address
Returns:
true if the given email exists
Throws:
EpServiceException - - in case of any errors

findByEmail

public CmUser findByEmail(java.lang.String email)
                   throws EpServiceException
Find the cmUser with the given email address.

Specified by:
findByEmail in interface CmUserService
Parameters:
email - the cmUser email address
Returns:
the cmUser if email address exists, otherwise null
Throws:
EpServiceException - - in case of any errors

findByUserName

public CmUser findByUserName(java.lang.String userName)
                      throws EpServiceException
Find the cmUser with the given userName.

Parameters:
userName - the cmUser userName
Returns:
the cmUser if userName exists, otherwise null
Throws:
EpServiceException - - in case of any errors

get

public CmUser get(long cmUserUid)
           throws EpServiceException
Get the cmUser with the given UID. Return null if no matching record exists.

Specified by:
get in interface CmUserService
Parameters:
cmUserUid - the cmUser UID
Returns:
the cmUser if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getObject

public java.lang.Object getObject(long uid)
                           throws EpServiceException
Generic get method for all persistable domain models.

Specified by:
getObject in interface EpPersistenceService
Parameters:
uid - the persisted instance uid
Returns:
the persisted instance if exists, otherwise null
Throws:
EpServiceException - - in case of any errors

list

public java.util.List list()
                    throws EpServiceException
Lists all cmUsers stored in the database.

Specified by:
list in interface CmUserService
Returns:
a list of cmUsers
Throws:
EpServiceException - - in case of any errors

load

public CmUser load(long cmUserUid)
            throws EpServiceException
Load the cmUser with the given UID.

Specified by:
load in interface CmUserService
Parameters:
cmUserUid - the cmUser UID
Returns:
the cmUser if UID exists, otherwise nullemail
Throws:
EpServiceException - - in case of any errors

remove

public void remove(CmUser cmUser)
            throws EpServiceException
Deletes the cmUser.

Specified by:
remove in interface CmUserService
Parameters:
cmUser - the cmUser to remove
Throws:
EpServiceException - - in case of any errors

resetPassword

public void resetPassword(java.lang.String email)
                   throws EmailNonExistException
Resets the cmUser's password for the specified email.

Specified by:
resetPassword in interface CmUserService
Parameters:
email - The email address of the cmUser whose password is to be reset
Throws:
EmailNonExistException - if the email address isn't found

setEmailService

public void setEmailService(EmailService emailService)
Set the emailService.

Parameters:
emailService - the emailService

setUserRoleService

public void setUserRoleService(UserRoleService userRoleService)
Set the userRoleService instance.

Parameters:
userRoleService - the userRoleService instance.

update

public void update(CmUser cmUser)
            throws UserNameExistException,
                   EmailExistException
Updates the given cmUser.

Specified by:
update in interface CmUserService
Parameters:
cmUser - the cmUser to update
Throws:
UserNameExistException - - the specified user name is taken by another user.
EmailExistException - - the specified email is taken by another user.

userNameExists

public boolean userNameExists(CmUser cmUser)
                       throws EpServiceException
Check the given cmUser's userName exists or not.

Specified by:
userNameExists in interface CmUserService
Parameters:
cmUser - the cmUser to check
Returns:
true if the given userName exists
Throws:
EpServiceException - - in case of any errors

userNameExists

public boolean userNameExists(java.lang.String userName)
                       throws EpServiceException
Checks the given userName exists or not.

Specified by:
userNameExists in interface CmUserService
Parameters:
userName - the userName
Returns:
true if the given userName exists
Throws:
EpServiceException - - in case of any errors