Class UserDAO
- java.lang.Object
-
- org.silverpeas.core.admin.user.dao.UserDAO
-
@Repository public class UserDAO extends Object
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
UserDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
addUser(Connection connection, UserDetail user)
void
blankUser(Connection connection, UserDetail user)
Updates the specified user by blanking some of its profile information.void
deleteUser(Connection connection, UserDetail user)
List<String>
getAllAdminIds(Connection connection, UserDetail fromUser)
List<String>
getAllUserIds(Connection connection)
List<UserDetail>
getAllUsers(Connection con)
List<UserDetail>
getAllUsersFromNewestToOldest(Connection con)
Map<String,List<String>>
getDirectUserIdsByGroup(Connection connection, List<String> groupIds, boolean includeRemoved)
List<String>
getDirectUserIdsByGroupUserRole(Connection connection, String groupUserRoleId, boolean includeRemoved)
List<String>
getDirectUserIdsInGroup(Connection connection, String groupId, boolean includeRemoved)
List<UserDetail>
getNonBlankedDeletedUsers(Connection connection, String... domainIds)
Gets all the users that were deleted in the specified domains and that weren't yet blanked.List<UserDetail>
getRemovedUsers(Connection connection, String... domainIds)
Gets all the users that were removed in the specified domains.UserDetail
getUserById(Connection connection, String id)
Gets the user with the specified unique identifier.List<UserDetail>
getUserByIds(Connection connection, Collection<String> ids)
Gets the users corresponding to specified unique identifiers.UserDetail
getUserBySpecificId(Connection connection, String domainId, String specificId)
int
getUserCountByCriteria(Connection connection, UserDetailsSearchCriteria criteria)
Gets the number of users that match the specified criteria.String
getUserIdByLoginAndDomain(Connection connection, String login, String domainId)
List<String>
getUserIdsByAccessLevel(Connection connection, UserAccessLevel accessLevel)
List<String>
getUserIdsByAccessLevelInDomain(Connection connection, UserAccessLevel accessLevel, String domainId)
List<String>
getUserIdsBySpaceUserRole(Connection connection, String spaceUserRoleId, boolean includeRemoved)
Returns all the User ids having directly a given space userRole.List<String>
getUserIdsByUserRole(Connection connection, String userRoleId, boolean includeRemoved)
List<String>
getUserIdsInDomain(Connection connection, String domainId)
List<String>
getUserIdsInGroups(Connection con, List<String> groupIds)
ListSlice<UserDetail>
getUsersByCriteria(Connection connection, UserDetailsSearchCriteria criteria)
Gets the user details that match the specified criteria.List<UserDetail>
getUsersBySpecificIds(Connection connection, String domainId, Collection<String> specificIds)
List<UserDetail>
getUsersInGroups(Connection con, List<String> groupIds)
List<UserDetail>
getUsersOfDomains(Connection con, List<String> domainIds)
List<UserDetail>
getUsersOfDomainsFromNewestToOldest(Connection con, List<String> domainIds)
List<UserDetail>
getUsersWithSensitiveData(Connection connection, String... domainIds)
Gets all the users in the specified user domains that have sensitive information.boolean
isUserByIdExists(Connection connection, String id)
boolean
isUserEmailExisting(Connection connection, String email)
void
removeUser(Connection connection, UserDetail user)
void
restoreUser(Connection connection, UserDetail user)
void
updateUser(Connection connection, UserDetail user)
Updates into the data source the specified user.
-
-
-
Method Detail
-
addUser
public String addUser(Connection connection, UserDetail user) throws SQLException
- Throws:
SQLException
-
restoreUser
public void restoreUser(Connection connection, UserDetail user) throws SQLException
- Throws:
SQLException
-
removeUser
public void removeUser(Connection connection, UserDetail user) throws SQLException
- Throws:
SQLException
-
deleteUser
public void deleteUser(Connection connection, UserDetail user) throws SQLException
- Throws:
SQLException
-
getUserById
public UserDetail getUserById(Connection connection, String id) throws SQLException
Gets the user with the specified unique identifier.- Parameters:
connection
- the connection to the data source to useid
- the unique identifier of the user to get.- Returns:
- the user or null if no such user exist.
- Throws:
SQLException
- if an error occurs while getting the user detail from the data source.
-
getUserByIds
public List<UserDetail> getUserByIds(Connection connection, Collection<String> ids) throws SQLException
Gets the users corresponding to specified unique identifiers.- Parameters:
connection
- the connection to the data source to useids
- the unique identifiers of the users to get.- Returns:
- a list of user.
- Throws:
SQLException
- if an error occurs while getting the user detail from the data source.
-
isUserByIdExists
public boolean isUserByIdExists(Connection connection, String id) throws SQLException
- Throws:
SQLException
-
getUserBySpecificId
public UserDetail getUserBySpecificId(Connection connection, String domainId, String specificId) throws SQLException
- Throws:
SQLException
-
getUsersBySpecificIds
public List<UserDetail> getUsersBySpecificIds(Connection connection, String domainId, Collection<String> specificIds) throws SQLException
- Throws:
SQLException
-
getRemovedUsers
public List<UserDetail> getRemovedUsers(Connection connection, String... domainIds) throws SQLException
Gets all the users that were removed in the specified domains.- Parameters:
connection
- a connection to the data source.domainIds
- zero, one or more unique identifiers of Silverpeas domains. If no domains are passed, then all the domains are taken by the request.- Returns:
- a list of user details.
- Throws:
SQLException
- if an error while requesting the users.
-
getNonBlankedDeletedUsers
public List<UserDetail> getNonBlankedDeletedUsers(Connection connection, String... domainIds) throws SQLException
Gets all the users that were deleted in the specified domains and that weren't yet blanked.- Parameters:
connection
- a connection to the data source.domainIds
- zero, one or more unique identifiers of Silverpeas domains. If no domains are passed, then all the domains are taken by the request.- Returns:
- a list of user details.
- Throws:
SQLException
- if an error while requesting the users.
-
getUsersWithSensitiveData
public List<UserDetail> getUsersWithSensitiveData(@Nonnull Connection connection, @Nonnull String... domainIds) throws SQLException
Gets all the users in the specified user domains that have sensitive information.- Parameters:
connection
- a connection to the data source.domainIds
- zero, one or more unique identifiers of Silverpeas domains. If no domains are passed, then all the domains are taken by the request.- Returns:
- a list of user details.
- Throws:
SQLException
- if an error while requesting the users.
-
getUserIdByLoginAndDomain
public String getUserIdByLoginAndDomain(Connection connection, String login, String domainId) throws SQLException
- Throws:
SQLException
-
isUserEmailExisting
public boolean isUserEmailExisting(Connection connection, String email) throws SQLException
- Throws:
SQLException
-
blankUser
public void blankUser(Connection connection, UserDetail user) throws SQLException
Updates the specified user by blanking some of its profile information.- Parameters:
connection
- a connection to the data source.user
- the user to blank.- Throws:
SQLException
- if the update fails.
-
updateUser
public void updateUser(Connection connection, UserDetail user) throws SQLException
Updates into the data source the specified user.- Parameters:
connection
- a connection to the data source.user
- the user to update.- Throws:
SQLException
- if the update fails.
-
getUsersByCriteria
public ListSlice<UserDetail> getUsersByCriteria(Connection connection, UserDetailsSearchCriteria criteria) throws SQLException
Gets the user details that match the specified criteria. The criteria are provided by an UserSearchCriteriaBuilder instance that was used to create them.- Parameters:
connection
- the connection with a data source to use.criteria
- the criteria to apply on the users to get.- Returns:
- a list of user details matching the criteria or an empty list if no such user details are found.
- Throws:
SQLException
-
getUserCountByCriteria
public int getUserCountByCriteria(Connection connection, UserDetailsSearchCriteria criteria) throws SQLException
Gets the number of users that match the specified criteria. The criteria are provided by an UserSearchCriteriaBuilder instance that was used to create them.- Parameters:
connection
- the connexion with a data source to use.criteria
- criteria the criteria to apply on the users to get.- Returns:
- the number of users that match the specified criteria.
- Throws:
SQLException
-
getUsersInGroups
public List<UserDetail> getUsersInGroups(Connection con, List<String> groupIds) throws SQLException
- Throws:
SQLException
-
getAllUserIds
public List<String> getAllUserIds(Connection connection) throws SQLException
- Throws:
SQLException
-
getAllAdminIds
public List<String> getAllAdminIds(Connection connection, UserDetail fromUser) throws SQLException
- Throws:
SQLException
-
getDirectUserIdsInGroup
public List<String> getDirectUserIdsInGroup(Connection connection, String groupId, boolean includeRemoved) throws SQLException
- Throws:
SQLException
-
getDirectUserIdsByGroup
public Map<String,List<String>> getDirectUserIdsByGroup(Connection connection, List<String> groupIds, boolean includeRemoved) throws SQLException
- Throws:
SQLException
-
getUserIdsInGroups
public List<String> getUserIdsInGroups(Connection con, List<String> groupIds) throws SQLException
- Throws:
SQLException
-
getUserIdsInDomain
public List<String> getUserIdsInDomain(Connection connection, String domainId) throws SQLException
- Throws:
SQLException
-
getUserIdsByAccessLevel
public List<String> getUserIdsByAccessLevel(Connection connection, UserAccessLevel accessLevel) throws SQLException
- Throws:
SQLException
-
getUserIdsByAccessLevelInDomain
public List<String> getUserIdsByAccessLevelInDomain(Connection connection, UserAccessLevel accessLevel, String domainId) throws SQLException
- Throws:
SQLException
-
getUserIdsByUserRole
public List<String> getUserIdsByUserRole(Connection connection, String userRoleId, boolean includeRemoved) throws SQLException
- Throws:
SQLException
-
getUserIdsBySpaceUserRole
public List<String> getUserIdsBySpaceUserRole(Connection connection, String spaceUserRoleId, boolean includeRemoved) throws SQLException
Returns all the User ids having directly a given space userRole.- Parameters:
spaceUserRoleId
- the unique identifier of the space user role.includeRemoved
- true to includeUserState.REMOVED
.- Returns:
- all the User ids having directly a given space userRole.
- Throws:
SQLException
- if an error occurs.
-
getDirectUserIdsByGroupUserRole
public List<String> getDirectUserIdsByGroupUserRole(Connection connection, String groupUserRoleId, boolean includeRemoved) throws SQLException
- Throws:
SQLException
-
getAllUsers
public List<UserDetail> getAllUsers(Connection con) throws SQLException
- Throws:
SQLException
-
getAllUsersFromNewestToOldest
public List<UserDetail> getAllUsersFromNewestToOldest(Connection con) throws SQLException
- Throws:
SQLException
-
getUsersOfDomains
public List<UserDetail> getUsersOfDomains(Connection con, List<String> domainIds) throws SQLException
- Throws:
SQLException
-
getUsersOfDomainsFromNewestToOldest
public List<UserDetail> getUsersOfDomainsFromNewestToOldest(Connection con, List<String> domainIds) throws SQLException
- Throws:
SQLException
-
-