Package org.ametys.core.group
Class GroupDirectoryContextHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.group.GroupDirectoryContextHelper
-
- All Implemented Interfaces:
LogEnabled
,Initializable
,Component
,Serviceable
public class GroupDirectoryContextHelper extends AbstractLogEnabled implements Component, Serviceable, Initializable
Helper for associatingGroupDirectory
(ies) to contexts.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ADMIN_CONTEXT
The "admin" contextstatic String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description GroupDirectoryContextHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Cache<String,Set<String>>
_getCache()
Get the cacheprotected Map<String,Set<String>>
_getCacheAsMap()
Get the cache as mapSet<String>
getGroupDirectoriesOnContext(String context)
Gets the group directories linked to the given contextSet<String>
getGroupDirectoriesOnContexts(Set<String> contexts)
Gets the group directories linked to at least one of the given contextsprotected Connection
getSQLConnection()
Get the connection to the databasevoid
initialize()
Set<String>
link(String context, List<String> ids)
Links given group directories to a context.void
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
ADMIN_CONTEXT
public static final String ADMIN_CONTEXT
The "admin" context- See Also:
- Constant Field Values
-
-
Constructor Detail
-
GroupDirectoryContextHelper
public GroupDirectoryContextHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
getSQLConnection
protected Connection getSQLConnection()
Get the connection to the database- Returns:
- the SQL connection
-
link
public Set<String> link(String context, List<String> ids)
Links given group directories to a context.- Parameters:
context
- The contextids
- The ids of the group directories to link- Returns:
- The ids of the linked group directories
-
getGroupDirectoriesOnContext
public Set<String> getGroupDirectoriesOnContext(String context)
Gets the group directories linked to the given context- Parameters:
context
- The context- Returns:
- The ids of group directories linked to the context
-
getGroupDirectoriesOnContexts
public Set<String> getGroupDirectoriesOnContexts(Set<String> contexts)
Gets the group directories linked to at least one of the given contexts- Parameters:
contexts
- The contexts- Returns:
- The ids of group directories linked to the contexts
-
_getCacheAsMap
protected Map<String,Set<String>> _getCacheAsMap()
Get the cache as map- Returns:
- Non null cache
-
-