public class PopulationContextHelper extends AbstractLogEnabled implements Component, Serviceable
UserPopulations to contexts.| Modifier and Type | Field and Description | 
|---|---|
private 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 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 List<String> | 
_getPopulationsOnContextFromDatabase(String context,
                                    boolean withDisabled)  | 
private CurrentUserProvider | 
getCurrentUserProvider()  | 
private ObservationManager | 
getObservationManager()  | 
protected Connection | 
getSQLConnection()
Get the connection to the database 
 | 
private UserPopulationDAO | 
getUserPopulationDAO()  | 
List<String> | 
getUserPopulationsOnContext(String context,
                           boolean withDisabled)
Gets the populations linked to the given context (need the population to be enabled) 
 | 
List<String> | 
getUserPopulationsOnContexts(Set<String> contexts,
                            boolean withDisabled)
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. 
 | 
List<String> | 
link(String context,
    List<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
private static final String __USER_POPULATIONS_TABLE
protected ServiceManager _manager
private UserPopulationDAO _userPopulationDAO
UserPopulationsprivate ObservationManager _observationManager
private CurrentUserProvider _currentUserProvider
public PopulationContextHelper()
public void service(ServiceManager manager) throws ServiceException
service in interface ServiceableServiceExceptionprivate ObservationManager getObservationManager()
private UserPopulationDAO getUserPopulationDAO()
private CurrentUserProvider getCurrentUserProvider()
protected Connection getSQLConnection()
public List<String> link(String context, List<String> ids)
context - The contextids - The ids of the populations to linkpublic List<String> getUserPopulationsOnContext(String context, boolean withDisabled)
context - The contextwithDisabled - True to also return disabled populationspublic List<String> getUserPopulationsOnContexts(Set<String> contexts, boolean withDisabled)
contexts - The contextswithDisabled - True to also return disabled populationsprivate List<String> _getPopulationsOnContextFromDatabase(String context, boolean withDisabled)