public class PopulationContextHelper extends AbstractLogEnabled implements Component, Serviceable
UserPopulations to contexts.| Modifier and Type | Field and Description |
|---|---|
protected static String |
__ADMIN_RIGHT_ACCESS
The id of right for administration access
|
protected static String |
__USER_POPULATIONS_TABLE
The name of the JDBC table for user populations by context
|
private CurrentUserProvider |
_currentUserProvider |
protected ServiceManager |
_manager
The service manager
|
private ObservationManager |
_observationManager |
private RightManager |
_rightManager |
private UserPopulationDAO |
_userPopulationDAO
The DAO for
UserPopulations |
static String |
ADMIN_CONTEXT
The "admin" context
|
static String |
POPULATION_CONTEXTS_REQUEST_ATTR
The name of request attribute holding the current population contexts
|
static String |
ROLE
Avalon Role
|
| Constructor and Description |
|---|
PopulationContextHelper() |
| Modifier and Type | Method and Description |
|---|---|
private Set<String> |
_getPopulationsOnContextFromDatabase(String context,
boolean withDisabled) |
protected CurrentUserProvider |
getCurrentUserProvider()
Get the current user provider
|
protected ObservationManager |
getObservationManager()
Get the observation manager
|
protected RightManager |
getRightManager()
Get the right manager
|
protected Connection |
getSQLConnection()
Get the connection to the database
|
protected UserPopulationDAO |
getUserPopulationDAO()
Get the DAO for user populations
|
Set<String> |
getUserPopulationsOnContext(String context,
boolean withDisabled)
Gets the populations linked to the given context (need the population to be enabled)
|
Set<String> |
getUserPopulationsOnContexts(Collection<String> contexts,
boolean withDisabled)
Gets the populations linked to at least one of the given contexts (need the population to be enabled)
|
Set<String> |
getUserPopulationsOnContexts(Collection<String> contexts,
boolean withDisabled,
boolean checkRights)
Gets the populations linked to at least one of the given contexts (need the population to be enabled)
|
boolean |
isLinked(String upId)
Returns true if the user population is linked to a context.
|
Set<String> |
link(String context,
Collection<String> ids)
Links given populations to a context.
|
void |
service(ServiceManager manager) |
getLogger, setLoggerpublic static final String POPULATION_CONTEXTS_REQUEST_ATTR
public static final String ADMIN_CONTEXT
protected static final String __USER_POPULATIONS_TABLE
protected static final String __ADMIN_RIGHT_ACCESS
protected ServiceManager _manager
private UserPopulationDAO _userPopulationDAO
UserPopulationsprivate ObservationManager _observationManager
private CurrentUserProvider _currentUserProvider
private RightManager _rightManager
public PopulationContextHelper()
public void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionprotected ObservationManager getObservationManager()
protected UserPopulationDAO getUserPopulationDAO()
protected CurrentUserProvider getCurrentUserProvider()
protected RightManager getRightManager()
protected Connection getSQLConnection()
public Set<String> link(String context, Collection<String> ids)
context - The contextids - The ids of the populations to linkpublic Set<String> getUserPopulationsOnContext(String context, boolean withDisabled)
context - The contextwithDisabled - True to also return disabled populationspublic Set<String> getUserPopulationsOnContexts(Collection<String> contexts, boolean withDisabled, boolean checkRights)
contexts - The contextswithDisabled - True to also return disabled populationscheckRights - True to check that current user belongs to one of populations or is an administrator userpublic Set<String> getUserPopulationsOnContexts(Collection<String> contexts, boolean withDisabled)
contexts - The contextswithDisabled - True to also return disabled populationsprivate Set<String> _getPopulationsOnContextFromDatabase(String context, boolean withDisabled)