fr.paris.lutece.plugins.unittree.service.unit
Class UnitUserService

java.lang.Object
  extended by fr.paris.lutece.plugins.unittree.service.unit.UnitUserService
All Implemented Interfaces:
IUnitUserService

public class UnitUserService
extends Object
implements IUnitUserService

UnitUserService


Constructor Summary
UnitUserService()
           
 
Method Summary
 boolean addUserToUnit(int nIdUnit, int nIdUser)
          Add an user to an unit
 void doProcessAddUser(int nIdUser, fr.paris.lutece.portal.business.user.AdminUser currentUser, javax.servlet.http.HttpServletRequest request)
          Do process adding the user to the unit
 void doProcessModifyUser(int nIdUser, fr.paris.lutece.portal.business.user.AdminUser currentUser, javax.servlet.http.HttpServletRequest request)
          Do process modifying the user
 void doProcessRemoveUser(int nIdUser, fr.paris.lutece.portal.business.user.AdminUser currentUser, javax.servlet.http.HttpServletRequest request)
          Do process removing an user from an unit
 List<fr.paris.lutece.portal.business.user.AdminUser> getAvailableUsers(fr.paris.lutece.portal.business.user.AdminUser currentUser, int nIdUnit)
          Get the list of available users for a given unit.
 List<fr.paris.lutece.portal.business.user.AdminUser> getAvailableUsers(fr.paris.lutece.portal.business.user.AdminUser currentUser, int nIdUnit, boolean bMultiAffectationEnabled)
          Get the list of available users for a given unit.
 fr.paris.lutece.portal.business.user.AdminUser getUser(int nIdUser)
          Get the user from a given id user
 List<fr.paris.lutece.portal.business.user.AdminUser> getUsers(int nIdUnit, Map<String,Unit> mapIdUserUnit, boolean isInDepthSearch)
          Get the list of AdminUser from a given id unit
 boolean isMultiAffectationEnabled()
          Check if users can be affected to several units at the same time or not
 boolean isUserInUnit(int nIdUser, int nIdUnit)
          Check if the given user is in a given unit
 void removeUserFromUnit(int nIdUser, int nIdUnit)
          Remove the user from a unit
 void removeUsersFromUnit(int nIdUnit)
          Remove users from a given id unit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnitUserService

public UnitUserService()
Method Detail

getUser

public fr.paris.lutece.portal.business.user.AdminUser getUser(int nIdUser)
Get the user from a given id user

Specified by:
getUser in interface IUnitUserService
Parameters:
nIdUser - the id user
Returns:
an AdminUser

getUsers

public List<fr.paris.lutece.portal.business.user.AdminUser> getUsers(int nIdUnit,
                                                                     Map<String,Unit> mapIdUserUnit,
                                                                     boolean isInDepthSearch)
Get the list of AdminUser from a given id unit

Specified by:
getUsers in interface IUnitUserService
Parameters:
nIdUnit - the id unit
mapIdUserUnit - the map of
isInDepthSearch - true if it is an in depth search (search in the sub units too)
Returns:
a list of AdminUser

getAvailableUsers

public List<fr.paris.lutece.portal.business.user.AdminUser> getAvailableUsers(fr.paris.lutece.portal.business.user.AdminUser currentUser,
                                                                              int nIdUnit,
                                                                              boolean bMultiAffectationEnabled)
Get the list of available users for a given unit.

Specified by:
getAvailableUsers in interface IUnitUserService
Parameters:
currentUser - The current user
nIdUnit - The id of the unit
bMultiAffectationEnabled - True to include users already associated to a unit, false to ignore them.
Returns:
a list of AdminUser

getAvailableUsers

public List<fr.paris.lutece.portal.business.user.AdminUser> getAvailableUsers(fr.paris.lutece.portal.business.user.AdminUser currentUser,
                                                                              int nIdUnit)
Get the list of available users for a given unit. current user can administer.

Specified by:
getAvailableUsers in interface IUnitUserService
Parameters:
currentUser - the current user
nIdUnit - The id of the unit
Returns:
a list of AdminUser. If multi affectation is not enabled, return users that can be administered by the current user and that are not associated with any unit. Otherwise returns users that are not associated directly or transitively to the unit and that the current user can administer.

doProcessAddUser

public void doProcessAddUser(int nIdUser,
                             fr.paris.lutece.portal.business.user.AdminUser currentUser,
                             javax.servlet.http.HttpServletRequest request)
Do process adding the user to the unit

Specified by:
doProcessAddUser in interface IUnitUserService
Parameters:
nIdUser - the id user
currentUser - the current user
request - the HTTP requesst

doProcessModifyUser

public void doProcessModifyUser(int nIdUser,
                                fr.paris.lutece.portal.business.user.AdminUser currentUser,
                                javax.servlet.http.HttpServletRequest request)
Do process modifying the user

Specified by:
doProcessModifyUser in interface IUnitUserService
Parameters:
nIdUser - the id user
currentUser - the current user
request - the HTTP request

doProcessRemoveUser

public void doProcessRemoveUser(int nIdUser,
                                fr.paris.lutece.portal.business.user.AdminUser currentUser,
                                javax.servlet.http.HttpServletRequest request)
Do process removing an user from an unit

Specified by:
doProcessRemoveUser in interface IUnitUserService
Parameters:
nIdUser - the id user
currentUser - the current user
request - the HTTP request

isUserInUnit

public boolean isUserInUnit(int nIdUser,
                            int nIdUnit)
Check if the given user is in a given unit

Specified by:
isUserInUnit in interface IUnitUserService
Parameters:
nIdUser - the id user
nIdUnit - The id of the unit
Returns:
true if the user is in an unit, false otherwise

addUserToUnit

@Transactional(value="unittree.transactionManager")
public boolean addUserToUnit(int nIdUnit,
                                           int nIdUser)
Add an user to an unit

Specified by:
addUserToUnit in interface IUnitUserService
Parameters:
nIdUnit - the id unit
nIdUser - the id user
Returns:
true if the user is added to the unit, false otherwise

removeUserFromUnit

@Transactional(value="unittree.transactionManager")
public void removeUserFromUnit(int nIdUser,
                                             int nIdUnit)
Remove the user from a unit

Specified by:
removeUserFromUnit in interface IUnitUserService
Parameters:
nIdUser - the id user
nIdUnit - The id of the unit

removeUsersFromUnit

@Transactional(value="unittree.transactionManager")
public void removeUsersFromUnit(int nIdUnit)
Remove users from a given id unit

Specified by:
removeUsersFromUnit in interface IUnitUserService
Parameters:
nIdUnit - the id unit

isMultiAffectationEnabled

public boolean isMultiAffectationEnabled()
Check if users can be affected to several units at the same time or not

Specified by:
isMultiAffectationEnabled in interface IUnitUserService
Returns:
True if multi affectation is enabled, false otherwise. If the property is not defined, the default value is used which is false.


Copyright © 2013 Mairie de Paris. All Rights Reserved.