public class JdbcGroupDirectory extends AbstractLogEnabled implements ModifiableGroupDirectory, Serviceable
GroupDirectory
from the core database.Modifier and Type | Class and Description |
---|---|
private static class |
JdbcGroupDirectory.JdbcGroup |
Modifier and Type | Field and Description |
---|---|
private static String |
__DATASOURCE_PARAM_NAME
Name of the parameter holding the datasource id
|
private static String |
__GROUPS_COMPOSITION_COLUMN_GROUPID |
private static String |
__GROUPS_COMPOSITION_COLUMN_LOGIN |
private static String |
__GROUPS_COMPOSITION_COLUMN_POPULATIONID |
private static String |
__GROUPS_COMPOSITION_TABLE_PARAM_NAME
Name of the parameter holding the SQL table name for storing the composition (i.e.
|
private static String |
__GROUPS_LIST_COLUMN_ID |
private static String |
__GROUPS_LIST_COLUMN_LABEL |
private static String |
__GROUPS_LIST_TABLE_PARAM_NAME
Name of the parameter holding the SQL table name for storing the groups
|
protected CurrentUserProvider |
_currentUserProvider
The current user provider
|
protected String |
_dataSourceId
The identifier of data source
|
private String |
_groupDirectoryModelId
The id of the
GroupDirectoryModel |
protected String |
_groupsCompositionTableName
The name of the SQL table storing the composition (i.e.
|
protected String |
_groupsListTableName
The name of the SQL table storing the groups
|
protected String |
_id
The id
|
protected I18nizableText |
_label
The label
|
private boolean |
_lazyInitialized |
protected ObservationManager |
_observationManager
The observation manager
|
private Map<String,Object> |
_paramValues
The map of the values of the parameters
|
protected SourceResolver |
_sourceResolver
The cocoon source resolver
|
Constructor and Description |
---|
JdbcGroupDirectory() |
Modifier and Type | Method and Description |
---|---|
protected String |
_createGetGroupsClause()
Get the sql clause that gets all groups
|
protected void |
_fillGroup(JdbcGroupDirectory.JdbcGroup group,
Connection connection)
Fill users set in a group.
|
protected Map<String,Object> |
_group2JSON(Group group,
boolean users)
Get group as JSON object
|
ModifiableGroup |
add(String name)
Add a new group of users.
|
ModifiableGroup |
getGroup(String groupID)
Returns a particular group.
|
String |
getGroupDirectoryModelId()
Get the id of the
GroupDirectoryModel extension point |
Set<Group> |
getGroups()
Returns all groups.
|
String |
getId()
Get the id of the group directory.
|
I18nizableText |
getLabel()
Get the label of the group directory.
|
Map<String,Object> |
getParameterValues()
Get the values of parameters (from group directory model)
|
protected Connection |
getSQLConnection()
Get the connection to the database
|
Set<String> |
getUserGroups(UserIdentity userIdentity)
Get all groups a particular user is in.
|
Map<String,Object> |
group2JSON(String id,
boolean withUsers)
Get group
|
List<Map<String,Object>> |
groups2JSON(int count,
int offset,
Map parameters,
boolean withUsers)
Get groups
|
void |
init(String groupDirectoryModelId,
Map<String,Object> paramValues)
Initialize the group directory with given parameter values.
|
void |
remove(String groupID)
Remove a group of users.
|
void |
service(ServiceManager manager) |
void |
setId(String id)
Set the id of the group directory.
|
void |
setLabel(I18nizableText label)
Set the label of the group directory.
|
void |
update(ModifiableGroup userGroup)
Modify an existing group of users.
|
getLogger, setLogger
private static final String __DATASOURCE_PARAM_NAME
private static final String __GROUPS_LIST_TABLE_PARAM_NAME
private static final String __GROUPS_COMPOSITION_TABLE_PARAM_NAME
private static final String __GROUPS_LIST_COLUMN_ID
private static final String __GROUPS_LIST_COLUMN_LABEL
private static final String __GROUPS_COMPOSITION_COLUMN_GROUPID
private static final String __GROUPS_COMPOSITION_COLUMN_LOGIN
private static final String __GROUPS_COMPOSITION_COLUMN_POPULATIONID
protected ObservationManager _observationManager
protected CurrentUserProvider _currentUserProvider
protected SourceResolver _sourceResolver
protected String _dataSourceId
protected String _groupsListTableName
protected String _groupsCompositionTableName
protected I18nizableText _label
private String _groupDirectoryModelId
GroupDirectoryModel
private Map<String,Object> _paramValues
private boolean _lazyInitialized
public JdbcGroupDirectory()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public String getId()
GroupDirectory
getId
in interface GroupDirectory
public I18nizableText getLabel()
GroupDirectory
getLabel
in interface GroupDirectory
public void setId(String id)
GroupDirectory
setId
in interface GroupDirectory
id
- The idpublic void setLabel(I18nizableText label)
GroupDirectory
setLabel
in interface GroupDirectory
label
- The labelpublic String getGroupDirectoryModelId()
GroupDirectory
GroupDirectoryModel
extension pointgetGroupDirectoryModelId
in interface GroupDirectory
public Map<String,Object> getParameterValues()
GroupDirectory
getParameterValues
in interface GroupDirectory
public void init(String groupDirectoryModelId, Map<String,Object> paramValues)
GroupDirectory
init
in interface GroupDirectory
groupDirectoryModelId
- The id of group directory extension pointparamValues
- The parameters' valuesprotected Connection getSQLConnection()
public ModifiableGroup getGroup(String groupID)
GroupDirectory
getGroup
in interface GroupDirectory
getGroup
in interface ModifiableGroupDirectory
groupID
- The id of the group.public Set<Group> getGroups()
GroupDirectory
getGroups
in interface GroupDirectory
protected String _createGetGroupsClause()
protected void _fillGroup(JdbcGroupDirectory.JdbcGroup group, Connection connection) throws SQLException
group
- The group to fill.connection
- The SQL connection.SQLException
- If a problem occurs.public Set<String> getUserGroups(UserIdentity userIdentity)
GroupDirectory
getUserGroups
in interface GroupDirectory
userIdentity
- The identity of the userpublic List<Map<String,Object>> groups2JSON(int count, int offset, Map parameters, boolean withUsers)
GroupDirectory
groups2JSON
in interface GroupDirectory
count
- The maximum number of groups to sax. (-1 to sax all)offset
- The offset to start with, first is 0.parameters
- Parameters for saxing user list differently, see implementation.withUsers
- true to also have the users of the groupspublic Map<String,Object> group2JSON(String id, boolean withUsers)
GroupDirectory
group2JSON
in interface GroupDirectory
id
- The group's idwithUsers
- true to also have the users of the groupprotected Map<String,Object> _group2JSON(Group group, boolean users)
group
- the groupusers
- true to get users' grouppublic ModifiableGroup add(String name) throws InvalidModificationException
ModifiableGroupDirectory
add
in interface ModifiableGroupDirectory
name
- The name of the user group to create. Cannot be null;InvalidModificationException
- if the group id exists yet or
if at least one of the parameter is invalid.public void update(ModifiableGroup userGroup) throws InvalidModificationException
ModifiableGroupDirectory
update
in interface ModifiableGroupDirectory
userGroup
- Informations about the new group. Cannot be null:InvalidModificationException
- if the group id does not exist yetpublic void remove(String groupID) throws InvalidModificationException
ModifiableGroupDirectory
remove
in interface ModifiableGroupDirectory
groupID
- The id of the group. Cannot be null;InvalidModificationException
- if the group id does not exist.