org.squashtest.tm.service.internal.user
Class AdministrationServiceImpl

java.lang.Object
  extended by org.squashtest.tm.service.internal.user.AdministrationServiceImpl
All Implemented Interfaces:
AdministrationService

@Service(value="squashtest.tm.service.AdministrationService")
@Transactional
public class AdministrationServiceImpl
extends Object
implements AdministrationService

Author:
bsiri

Constructor Summary
AdministrationServiceImpl()
           
 
Method Summary
 void activateUser(long userId)
           
 void activateUsers(Collection<Long> userIds)
           
 void addUser(org.squashtest.tm.domain.users.User user, long groupId, String password)
           
 void associateToTeams(long userId, List<Long> teamIds)
          Will add user to teams members lists.
 void createAuthentication(long userId, String password)
          Creates authentication data for given user.
 org.squashtest.tm.domain.users.User createUserFromLogin(String login)
          Creates a stub User using the given login and returns it.
 void createUserWithoutCredentials(org.squashtest.tm.domain.users.User user, long groupId)
          Creates a user without credentials.
 void deactivateUser(long userId)
           
 void deactivateUsers(Collection<Long> userIds)
           
 void deassociateTeams(long userId, List<Long> teamIds)
          Will remove user from teams members lists.
 void deleteUsers(Collection<Long> userIds)
           
 org.squashtest.tm.domain.AdministrationStatistics findAdministrationStatistics()
          will ask database how much there is of some entities and return it in a AdministrationStatistics bean.
 List<org.squashtest.tm.domain.users.User> findAllActiveUsersOrderedByLogin()
           
 List<org.squashtest.tm.domain.users.Team> findAllNonAssociatedTeams(long userId)
          Will return a list of all Team that do not have the concerned User as a member
access restricted to admins
 List<org.squashtest.tm.domain.project.Project> findAllProjects()
           
 org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.users.User>> findAllUsersFiltered(org.squashtest.tm.core.foundation.collection.PagingAndSorting sorter, org.squashtest.tm.core.foundation.collection.Filtering filter)
           
 List<org.squashtest.tm.domain.users.UsersGroup> findAllUsersGroupOrderedByQualifiedName()
           
 List<org.squashtest.tm.domain.users.User> findAllUsersOrderedByLogin()
           
 org.squashtest.tm.domain.users.User findByLogin(String login)
          This is not secured on purpose.
 String findLoginMessage()
           
 org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.users.Team>> findSortedAssociatedTeams(long userId, org.squashtest.tm.core.foundation.collection.PagingAndSorting paging, org.squashtest.tm.core.foundation.collection.Filtering filtering)
          Will return an paged and filtered list of Teams that have the concerned user as a member.
 AuthenticatedUser findUserById(long userId)
           
 String findWelcomeMessage()
           
 void modifyLoginMessage(String loginMessage)
           
 void modifyUserEmail(long userId, String newEmail)
           
 void modifyUserFirstName(long userId, String newName)
           
 void modifyUserLastName(long userId, String newName)
           
 void modifyUserLogin(long userId, String newLogin)
           
 void modifyWelcomeMessage(String welcomeMessage)
           
 void resetUserPassword(long userId, String newPassword)
           
 void setAdministratorAuthenticationService(AdministratorAuthenticationService adminService)
           
 void setConfigurationService(ConfigurationService configurationService)
           
 void setUserGroupAuthority(long userId, long groupId)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdministrationServiceImpl

public AdministrationServiceImpl()
Method Detail

setAdministratorAuthenticationService

public void setAdministratorAuthenticationService(AdministratorAuthenticationService adminService)

setConfigurationService

public void setConfigurationService(ConfigurationService configurationService)

modifyUserFirstName

public void modifyUserFirstName(long userId,
                                String newName)
Specified by:
modifyUserFirstName in interface AdministrationService

modifyUserLastName

public void modifyUserLastName(long userId,
                               String newName)
Specified by:
modifyUserLastName in interface AdministrationService

modifyUserLogin

public void modifyUserLogin(long userId,
                            String newLogin)
Specified by:
modifyUserLogin in interface AdministrationService

modifyUserEmail

public void modifyUserEmail(long userId,
                            String newEmail)
Specified by:
modifyUserEmail in interface AdministrationService

findUserById

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public AuthenticatedUser findUserById(long userId)
Specified by:
findUserById in interface AdministrationService

findAllUsersOrderedByLogin

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public List<org.squashtest.tm.domain.users.User> findAllUsersOrderedByLogin()
Specified by:
findAllUsersOrderedByLogin in interface AdministrationService

findAllActiveUsersOrderedByLogin

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public List<org.squashtest.tm.domain.users.User> findAllActiveUsersOrderedByLogin()
Specified by:
findAllActiveUsersOrderedByLogin in interface AdministrationService

findAllUsersFiltered

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.users.User>> findAllUsersFiltered(org.squashtest.tm.core.foundation.collection.PagingAndSorting sorter,
                                                                                                                                                       org.squashtest.tm.core.foundation.collection.Filtering filter)
Specified by:
findAllUsersFiltered in interface AdministrationService

findAllUsersGroupOrderedByQualifiedName

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public List<org.squashtest.tm.domain.users.UsersGroup> findAllUsersGroupOrderedByQualifiedName()
Specified by:
findAllUsersGroupOrderedByQualifiedName in interface AdministrationService

addUser

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void addUser(org.squashtest.tm.domain.users.User user,
                                 long groupId,
                                 String password)
Specified by:
addUser in interface AdministrationService

setUserGroupAuthority

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void setUserGroupAuthority(long userId,
                                               long groupId)
Specified by:
setUserGroupAuthority in interface AdministrationService

deactivateUser

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void deactivateUser(long userId)
Specified by:
deactivateUser in interface AdministrationService

activateUser

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void activateUser(long userId)
Specified by:
activateUser in interface AdministrationService

deactivateUsers

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void deactivateUsers(Collection<Long> userIds)
Specified by:
deactivateUsers in interface AdministrationService

activateUsers

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void activateUsers(Collection<Long> userIds)
Specified by:
activateUsers in interface AdministrationService

deleteUsers

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void deleteUsers(Collection<Long> userIds)
Specified by:
deleteUsers in interface AdministrationService

findAllProjects

public List<org.squashtest.tm.domain.project.Project> findAllProjects()
Specified by:
findAllProjects in interface AdministrationService

modifyWelcomeMessage

public void modifyWelcomeMessage(String welcomeMessage)
Specified by:
modifyWelcomeMessage in interface AdministrationService

modifyLoginMessage

public void modifyLoginMessage(String loginMessage)
Specified by:
modifyLoginMessage in interface AdministrationService

findWelcomeMessage

public String findWelcomeMessage()
Specified by:
findWelcomeMessage in interface AdministrationService

findLoginMessage

public String findLoginMessage()
Specified by:
findLoginMessage in interface AdministrationService

resetUserPassword

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void resetUserPassword(long userId,
                                           String newPassword)
Specified by:
resetUserPassword in interface AdministrationService

findAdministrationStatistics

public org.squashtest.tm.domain.AdministrationStatistics findAdministrationStatistics()
Description copied from interface: AdministrationService
will ask database how much there is of some entities and return it in a AdministrationStatistics bean.

Specified by:
findAdministrationStatistics in interface AdministrationService
Returns:
AdministrationStatistics as result of counts in database.
See Also:
AdministrationService.findAdministrationStatistics()

deassociateTeams

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void deassociateTeams(long userId,
                                          List<Long> teamIds)
Description copied from interface: AdministrationService
Will remove user from teams members lists.
access restricted to admins

Specified by:
deassociateTeams in interface AdministrationService
Parameters:
userId - : the id of the concerned User
teamIds - : ids of Teams to remove user from.
See Also:
AdministrationService.deassociateTeams(long, List)

associateToTeams

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public void associateToTeams(long userId,
                                          List<Long> teamIds)
Description copied from interface: AdministrationService
Will add user to teams members lists.
access restricted to admins

Specified by:
associateToTeams in interface AdministrationService
Parameters:
userId - : the id of the concerned User
teamIds - : ids of the Teams to add user to.
See Also:
AdministrationService.associateToTeams(long, List)

findSortedAssociatedTeams

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public org.squashtest.tm.core.foundation.collection.PagedCollectionHolder<List<org.squashtest.tm.domain.users.Team>> findSortedAssociatedTeams(long userId,
                                                                                                                                                            org.squashtest.tm.core.foundation.collection.PagingAndSorting paging,
                                                                                                                                                            org.squashtest.tm.core.foundation.collection.Filtering filtering)
Description copied from interface: AdministrationService
Will return an paged and filtered list of Teams that have the concerned user as a member.
access restricted to admins

Specified by:
findSortedAssociatedTeams in interface AdministrationService
Parameters:
userId - : the id of the concerned user
paging - : the PagingAndSorting criteria that the result has to match
filtering - : the Filtering criteria that the result has to match
Returns:
See Also:
AdministrationService.findSortedAssociatedTeams(long, PagingAndSorting, Filtering)

findAllNonAssociatedTeams

@PreAuthorize(value="hasRole(\'ROLE_ADMIN\')")
public List<org.squashtest.tm.domain.users.Team> findAllNonAssociatedTeams(long userId)
Description copied from interface: AdministrationService
Will return a list of all Team that do not have the concerned User as a member
access restricted to admins

Specified by:
findAllNonAssociatedTeams in interface AdministrationService
Parameters:
userId - : the id of the concerned User
Returns:
the list of all non associated Teams
See Also:
AdministrationService.findAllNonAssociatedTeams(long)

findByLogin

public org.squashtest.tm.domain.users.User findByLogin(String login)
This is not secured on purpose.

Specified by:
findByLogin in interface AdministrationService
See Also:
AdministrationService.findByLogin(java.lang.String)

createUserFromLogin

public org.squashtest.tm.domain.users.User createUserFromLogin(@NotNull
                                                               String login)
                                                        throws org.squashtest.tm.exception.user.LoginAlreadyExistsException
Description copied from interface: AdministrationService
Creates a stub User using the given login and returns it. This should throw an exception when the user already exists.

Specified by:
createUserFromLogin in interface AdministrationService
Returns:
the new User
Throws:
org.squashtest.tm.exception.user.LoginAlreadyExistsException - when user already exists
See Also:
AdministrationService.createUserFromLogin(java.lang.String)

createUserWithoutCredentials

public void createUserWithoutCredentials(org.squashtest.tm.domain.users.User user,
                                         long groupId)
Description copied from interface: AdministrationService
Creates a user without credentials. This should be used when authentication is managed by an external provider only.

Specified by:
createUserWithoutCredentials in interface AdministrationService
See Also:
AdministrationService.createUserWithoutCredentials(org.squashtest.tm.domain.users.User, long)

createAuthentication

public void createAuthentication(long userId,
                                 String password)
                          throws org.squashtest.tm.exception.user.LoginAlreadyExistsException
Description copied from interface: AdministrationService
Creates authentication data for given user.

Specified by:
createAuthentication in interface AdministrationService
Throws:
org.squashtest.tm.exception.user.LoginAlreadyExistsException - when authentication data already exixts
See Also:
AdministrationService.createAuthentication(long, java.lang.String)


Copyright © 2010-2013 Henix, henix.fr. All Rights Reserved.