public class JdbcSimpleUserDao extends Object implements DaoInterface
Constructor and Description |
---|
JdbcSimpleUserDao() |
Modifier and Type | Method and Description |
---|---|
void |
addMembersToGroup(Set<String> members,
String groupName,
String membershipIdAttributeName) |
void |
createGroup(String groupName,
String membershipIdAttributeName) |
String |
createUser(String userIDAttributeName,
Map<String,Set<String>> attrMap) |
void |
deleteGroup(String groupName,
String membershipIdAttributeName) |
void |
deleteMembersFromGroup(Set<String> members,
String groupName,
String membershipIdAttributeName) |
void |
deleteUser(String userID,
String userIDAttributeName) |
Map<String,Set<String>> |
getAttributes(String userID,
String userIDAttributeName,
Set<String> attributesToFetch)
gets values for the user attributes specified in the atributesToFetch
set.
|
String |
getDataSourceURL()
get the url of the current database.
|
Map<String,Set<String>> |
getGroupAttributes(String groupName,
String membershipIdAttributeName,
Set<String> attributesToFetch) |
Set<String> |
getMembers(String groupName,
String membershipIdAttributeName) |
Set<String> |
getMemberships(String userName,
String membershipIdAttributeName) |
void |
initialize(String jndiName,
String userDataBaseTableName,
String membershipDataBaseTableName,
Debug idRepoDebugLog)
This class must be called before using the methods since the datasource
must be set up.
|
void |
initialize(String jdbcDriver,
String jdbcDriverUrl,
String jdbcUser,
String jdbcPassword,
String userDataBaseTableName,
String membershipDataBaseTableName,
Debug idRepoDebugLog)
This class must be called before using the methods since the datasource
must be set up.
|
Map<String,Map<String,Set<String>>> |
search(String userIDAttributeName,
int limit,
org.forgerock.util.query.QueryFilter<org.forgerock.json.JsonPointer> queryFilter,
Set<String> attributesToFetch,
String filterOperand,
Map<String,Set<String>> avPairs)
Dealing with a query filter is not supported as yet and will give an empty map.
|
Map<String,Map<String,Set<String>>> |
search(String userIDAttributeName,
int limit,
String idPattern,
Set<String> attributesToFetch,
String filterOperand,
Map<String,Set<String>> avPairs)
Fetch the set of users and including for each user all their attributes
specified in attributesToFetch.
|
Map<String,Map<String,Set<String>>> |
searchForGroups(String membershipIdAttributeName,
int limit,
org.forgerock.util.query.QueryFilter<org.forgerock.json.JsonPointer> queryFilter,
Set<String> attributesToFetch,
String filterOperand,
Map<String,Set<String>> avPairs) |
Map<String,Map<String,Set<String>>> |
searchForGroups(String membershipIdAttributeName,
int limit,
String idPattern,
Set<String> attributesToFetch,
String filterOperand,
Map<String,Set<String>> avPairs) |
void |
updateUser(String userID,
String userIDAttributeName,
Map<String,Set<String>> attrMap) |
public void initialize(String jndiName, String userDataBaseTableName, String membershipDataBaseTableName, Debug idRepoDebugLog) throws InstantiationException
initialize
in interface DaoInterface
InstantiationException
- when not able to instantiate
this class, for example if parameters are bad or null or can not
make a connection to datasource.public void initialize(String jdbcDriver, String jdbcDriverUrl, String jdbcUser, String jdbcPassword, String userDataBaseTableName, String membershipDataBaseTableName, Debug idRepoDebugLog) throws InstantiationException
initialize
in interface DaoInterface
InstantiationException
- when not able to instantiate
this class, for example if parameters are bad or null or can not
make a connection to datasource.public void updateUser(String userID, String userIDAttributeName, Map<String,Set<String>> attrMap)
updateUser
in interface DaoInterface
userID
- is user idattrMap
- is a Map that contains attribute/column names as keys
and values are Sets of valuespublic void deleteUser(String userID, String userIDAttributeName)
deleteUser
in interface DaoInterface
public String createUser(String userIDAttributeName, Map<String,Set<String>> attrMap)
createUser
in interface DaoInterface
public Map<String,Set<String>> getAttributes(String userID, String userIDAttributeName, Set<String> attributesToFetch)
getAttributes
in interface DaoInterface
userID
- is String of the users unique identifieruserIDAttributeName
- is the column name of the id field so is used
for example in the where clause of SQL
WHERE userIDAttributeName = userIDattributesToFetch
- is the set of column names for the attributes
that should be fetched from the DB table.public Map<String,Map<String,Set<String>>> search(String userIDAttributeName, int limit, String idPattern, Set<String> attributesToFetch, String filterOperand, Map<String,Set<String>> avPairs)
search
in interface DaoInterface
idPattern
- which is used in an SQL LIKE query on the id attribute
usually contains some SQL search chars like % to broaden matches
WHERE id_attribute LIKE 'the_pattern_value'
If idPattern is empty or null then it means to get all users
so do not need to use a LIKE clause on queryattributesToFetch
- is set of desired attributes to fetch for
each user.
If EMPTY or NULL, then will not do anything, return empty map.
Callers should be sure to specify which attributes to fetch.limit
- is maximum number of results to return. This is added to the
END of the WHERE clause using mysql LIMIT on a query.
Default if no limit(if limit<0) is specified is LIMIT=1
Limit is ignored in this implementation since it is not
portable SQLfilterOperand
- is a string of AND, or OR and is used to add
extra attributes and values to the WHERE search clause, and it is
applied between attribute = 'value' pairs in the parameter
for avPairs.avPairs
- is a map of attribute names as the keys and the associated
values are a SET for each attribute name, and would be added to
the WHERE clause after the isPattern part of clause and before
the LIMIT part of the where clause, for example
WHERE id_attribute LIKE 'the_pattern_value' AND
(attr_1='value1' ...filterOperand/AND/OR... attr_2='value2' )
LIMIT 2public Map<String,Map<String,Set<String>>> search(String userIDAttributeName, int limit, org.forgerock.util.query.QueryFilter<org.forgerock.json.JsonPointer> queryFilter, Set<String> attributesToFetch, String filterOperand, Map<String,Set<String>> avPairs) throws IdRepoUnsupportedOpException
search
in interface DaoInterface
userIDAttributeName
- the name of the attribute which uniquely identifies users, e.g. "uid".limit
- is maximum number of results to return. This is added to the
END of the WHERE clause using mysql LIMIT on a query.
Default if no limit(if limit<0) is specified is LIMIT=1
Limit is ignored in this implementation since it is not
portable SQLqueryFilter
- the query filter sent, more or less directly, from a CREST endpoint _queryFilter value.attributesToFetch
- is set of desired attributes to fetch for
each user.
If EMPTY or NULL, then will not do anything, return empty map.
Callers should be sure to specify which attributes to fetch.filterOperand
- is a string of AND, or OR and is used to add
extra attributes and values to the WHERE search clause, and it is
applied between attribute = 'value' pairs in the parameter
for avPairs.avPairs
- is a map of attribute names as the keys and the associated
values are a SET for each attribute name, and would be added to
the WHERE clause after the isPattern part of clause and before
the LIMIT part of the where clause, for example
WHERE id_attribute LIKE 'the_pattern_value' AND
(attr_1='value1' ...filterOperand/AND/OR... attr_2='value2' )
LIMIT 2IdRepoUnsupportedOpException
public String getDataSourceURL()
getDataSourceURL
in interface DaoInterface
public Set<String> getMembers(String groupName, String membershipIdAttributeName)
getMembers
in interface DaoInterface
public Set<String> getMemberships(String userName, String membershipIdAttributeName)
getMemberships
in interface DaoInterface
public void deleteGroup(String groupName, String membershipIdAttributeName)
deleteGroup
in interface DaoInterface
public void createGroup(String groupName, String membershipIdAttributeName)
createGroup
in interface DaoInterface
public void deleteMembersFromGroup(Set<String> members, String groupName, String membershipIdAttributeName)
deleteMembersFromGroup
in interface DaoInterface
public void addMembersToGroup(Set<String> members, String groupName, String membershipIdAttributeName)
addMembersToGroup
in interface DaoInterface
public Map<String,Map<String,Set<String>>> searchForGroups(String membershipIdAttributeName, int limit, String idPattern, Set<String> attributesToFetch, String filterOperand, Map<String,Set<String>> avPairs)
searchForGroups
in interface DaoInterface
public Map<String,Map<String,Set<String>>> searchForGroups(String membershipIdAttributeName, int limit, org.forgerock.util.query.QueryFilter<org.forgerock.json.JsonPointer> queryFilter, Set<String> attributesToFetch, String filterOperand, Map<String,Set<String>> avPairs)
searchForGroups
in interface DaoInterface
public Map<String,Set<String>> getGroupAttributes(String groupName, String membershipIdAttributeName, Set<String> attributesToFetch)
getGroupAttributes
in interface DaoInterface
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.