com.elasticpath.service.cmuser.impl
Class UserRoleServiceImpl

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

public class UserRoleServiceImpl
extends AbstractEpPersistenceServiceImpl
implements UserRoleService

Test UserRoleServiceImpl.


Constructor Summary
UserRoleServiceImpl()
           
 
Method Summary
 UserRole add(UserRole userRole)
          Adds the given userRole.
 UserRole findByName(java.lang.String name)
          Find the UserRole with the given name.
 UserRole get(long userRoleUid)
          Get the userRole with the given UID.
 java.util.Map getAllUserPermissionsMap()
          Return the system configured permission map.
 UserRole getDefaultUserRole()
          Return the deafalt userRole, namely, the userRole with name "USER".
 java.lang.Object getObject(long uid)
          Generic load method for all persistable domain models.
 java.util.List getUserRoleInUseUidList()
          Get the list of uids of UserRole used by existing CmUsers.
 java.util.List list()
          Lists all userRoles stored in the database.
 UserRole load(long userRoleUid)
          Load the userRole with the given UID.
 boolean nameExists(java.lang.String name)
          Checks whether the given userRole name exists or not.
 boolean nameExists(UserRole userRole)
          Check whether the given userRole's name exists or not.
 void remove(UserRole userRole)
          Delete the userRole.
 void setAllUserPermissionsMap(java.util.Map allUserPermissionsMap)
          Set the system configured permission map.
 void update(UserRole userRole)
          Updates the given userRole.
 
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

UserRoleServiceImpl

public UserRoleServiceImpl()
Method Detail

add

public UserRole add(UserRole userRole)
             throws UserRoleNameExistException
Adds the given userRole.

Specified by:
add in interface UserRoleService
Parameters:
userRole - the userRole to add
Returns:
the persisted instance of userRole
Throws:
UserRoleNameExistException - - if userRole with the specified name already exists

findByName

public UserRole findByName(java.lang.String name)
                    throws EpServiceException
Find the UserRole with the given name.

Specified by:
findByName in interface UserRoleService
Parameters:
name - the userRole name.
Returns:
the userRole if name exists, otherwise null
Throws:
EpServiceException - - in case of any errors

get

public UserRole get(long userRoleUid)
             throws EpServiceException
Get the userRole with the given UID. Return null if no matching record exists.

Specified by:
get in interface UserRoleService
Parameters:
userRoleUid - the userRole UID
Returns:
the userRole if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

getAllUserPermissionsMap

public java.util.Map getAllUserPermissionsMap()
Return the system configured permission map.

Specified by:
getAllUserPermissionsMap in interface UserRoleService
Returns:
the system configured permission map.

getDefaultUserRole

public UserRole getDefaultUserRole()
                            throws EpServiceException
Return the deafalt userRole, namely, the userRole with name "USER".

Specified by:
getDefaultUserRole in interface UserRoleService
Returns:
the default userRole.
Throws:
EpServiceException - - in case of any errors

getObject

public java.lang.Object getObject(long uid)
                           throws EpServiceException
Generic load 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

getUserRoleInUseUidList

public java.util.List getUserRoleInUseUidList()
Get the list of uids of UserRole used by existing CmUsers.

Specified by:
getUserRoleInUseUidList in interface UserRoleService
Returns:
the list of uids of UserRoles in use.

list

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

Specified by:
list in interface UserRoleService
Returns:
a list of userRoles
Throws:
EpServiceException - - in case of any errors

load

public UserRole load(long userRoleUid)
              throws EpServiceException
Load the userRole with the given UID. Throw an unrecoverable exception if there is no matching database row.

Specified by:
load in interface UserRoleService
Parameters:
userRoleUid - the userRole UID
Returns:
the userRole if UID exists, otherwise null
Throws:
EpServiceException - - in case of any errors

nameExists

public boolean nameExists(java.lang.String name)
                   throws EpServiceException
Checks whether the given userRole name exists or not.

Specified by:
nameExists in interface UserRoleService
Parameters:
name - the userRole name.
Returns:
true if the given name exists.
Throws:
EpServiceException - - in case of any errors

nameExists

public boolean nameExists(UserRole userRole)
                   throws EpServiceException
Check whether the given userRole's name exists or not.

Specified by:
nameExists in interface UserRoleService
Parameters:
userRole - the userRole to check
Returns:
true if a different userRole with the given userRole's name exists
Throws:
EpServiceException - - in case of any errors

remove

public void remove(UserRole userRole)
            throws EpServiceException
Delete the userRole.

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

setAllUserPermissionsMap

public void setAllUserPermissionsMap(java.util.Map allUserPermissionsMap)
Set the system configured permission map.

Specified by:
setAllUserPermissionsMap in interface UserRoleService
Parameters:
allUserPermissionsMap - the system configured permission map.

update

public void update(UserRole userRole)
            throws UserRoleNameExistException
Updates the given userRole.

Specified by:
update in interface UserRoleService
Parameters:
userRole - the userRole to update
Throws:
UserRoleNameExistException - - if userRole with the specified name already exists