@Service(value="userManagement") public class UserManagementImpl extends UserManagementBase
UserManagement. UserManagement.RegistrationTypeANONYMIZE_USER_PREFIX| Constructor and Description |
|---|
UserManagementImpl() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
changeAlias(Long userId,
String newAlias)
Method to change the users alias.
|
Collection<User> |
findNotDeletedUsers(boolean excludeSystemUsers)
Returns a collection with all users that do not have one of the deleted statuses.
|
User |
findUser(UserIdentification userIdentification)
Find the User by the given identification, not loading the
ExternalUserAuthentication
s |
User |
findUser(UserIdentification userIdentification,
boolean loadExternalAuthentications)
Find the User by the given identification
|
User |
findUserByUserId(Long userId,
boolean loadExternalAuthentications)
Find a user by the its id.
|
List<User> |
findUsersByRole(UserRole role,
UserStatus status)
Returns a collection of users having a specific role and optionally a specific status.
|
String |
generateUniqueAlias(String externalUserName,
String emailAddress)
Create a valid, not yet used, user alias.
|
long |
getActiveUserCount(String systemId,
UserRole role)
Get the number of users with status ACTIVE.
|
Set<ExternalUserAuthentication> |
getExternalExternalUserAuthentications(long userId) |
<T> T |
getUserById(Long userId,
Converter<User,T> converter)
Return the details of a user.
|
protected void |
handleAcceptTermsOfUse(Long userId) |
protected void |
handleAnonymizeUser(Long userId,
Long[] blogIds,
boolean becomeManager)
Performs the core logic for
UserManagementBase.anonymizeUser(Long, Long[], boolean) |
protected User |
handleAssignUserRole(Long userId,
UserRole role)
Performs the core logic for
UserManagementBase.assignUserRole(Long, UserRole) |
protected boolean |
handleChangeEmailAddress(Long userId,
String newEmail,
boolean sendConfirmationEmail)
Performs the core logic for
#changeEmailAddress(Long, String) |
protected void |
handleChangeUserStatusByManager(Long userId,
UserStatus newStatus) |
protected void |
handleConfirmNewEmailAddress(String securityCode)
Performs the core logic for
UserManagementBase.confirmNewEmailAddress(String) |
protected User |
handleConfirmUser(String securitycode,
UserVO data)
Performs the core logic for
UserManagementBase.confirmUser(String, UserVO) |
protected User |
handleCreateOrUpdateExternalUser(ExternalUserVO userVO)
Performs the core logic for
UserManagementBase.createOrUpdateExternalUser(ExternalUserVO) |
protected User |
handleCreateUser(UserVO userVo,
boolean emailConfirmation,
boolean managerActivation)
Performs the core logic for
UserManagementBase.createUser(UserVO, boolean, boolean) |
protected User |
handleFindUserByAlias(String alias)
Performs the core logic for
UserManagementBase.findUserByAlias(String) |
protected User |
handleFindUserByEmail(String email)
Performs the core logic for
UserManagementBase.findUserByEmail(String) |
protected User |
handleFindUserByEmailAlias(String username)
Performs the core logic for
#findKenmeiUserByEmailAlias(String) |
protected User |
handleFindUserByExternalUserId(String userId,
String systemId)
Performs the core logic for
UserManagementBase.findUserByExternalUserId(String, String) |
protected long |
handleGetActiveUserCount()
Performs the core logic for
UserManagementBase.getActiveUserCount() |
protected UserRole[] |
handleGetRolesOfUser(Long userId)
Performs the core logic for
UserManagementBase.getRolesOfUser(Long) |
protected User |
handleInviteUserToBlog(Long blogId,
UserVO userVo,
BlogRole role)
Performs the core logic for
#inviteUserToBlog(Long, User, UserVO, com.communote.server.model.blog.BlogRole) |
protected User |
handleInviteUserToClient(UserVO userVo)
Performs the core logic for
#inviteUserToClient(User, UserVO) |
protected void |
handlePermanentlyDisableUser(Long userId,
Long[] blogIds,
boolean becomeManager)
Performs the core logic for
UserManagementBase.permanentlyDisableUser(Long, Long[], boolean) |
protected User |
handleRegisterUser(String email,
Locale locale,
UserManagement.RegistrationType type)
Performs the core logic for
#registerUser(String, java.util.Locale) |
protected User |
handleRemoveUserRole(Long userId,
UserRole role)
Performs the core logic for
UserManagementBase.removeUserRole(Long, UserRole) |
protected void |
handleResetPermanentId(String systemId)
Performs the core logic for
#resetExternalUserId(String) |
protected User |
handleUnlockUser(String securityCode)
Performs the core logic for
UserManagementBase.unlockUser(String) |
protected User |
handleUpdateExternalUser(ExternalUserVO userVO)
Performs the core logic for
UserManagementBase.updateExternalUser(ExternalUserVO) |
protected void |
handleUpdateLanguage(Long userId,
String languageCode)
Performs the core logic for
UserManagementBase.updateLanguage(Long, String) |
boolean |
hasExternalAuthentication(long userId,
String externalSystemId) |
protected void |
init() |
void |
registerActivationValidator(UserActivationValidator validator)
Register a validator that will be called before the status of a user is set to
ACTIVE. |
void |
resetTermsOfUse()
Reset the terms of use for all users which have already accepted the terms of use.
|
void |
sendReminderMails() |
void |
unregisterActivationValidator(UserActivationValidator validator)
Unregister a previously registered validator.
|
void |
updateUserTags(Long userId,
Set<TagTO> tags)
Updates the tags of the given user.
|
acceptTermsOfUse, anonymizeUser, assignUserRole, changeEmailAddress, changeUserStatusByManager, confirmNewEmailAddress, confirmUser, createOrUpdateExternalUser, createUser, findUserByAlias, findUserByEmail, findUserByEmailAlias, findUserByExternalUserId, findUserByUserId, getActiveUserCount, getPrincipal, getRolesOfUser, inviteUserToBlog, inviteUserToClient, permanentlyDisableUser, registerUser, removeUserRole, resetPermanentId, unlockUser, updateExternalUser, updateLanguagepublic boolean changeAlias(Long userId, String newAlias) throws AliasAlreadyExistsException, AliasInvalidException
userId - The users id.newAlias - The new alias.AliasAlreadyExistsException - Thrown, when there is already a user with this alias.AliasInvalidException - Thrown, when the alias is syntactically invalid.@Transactional(readOnly=true) public Collection<User> findNotDeletedUsers(boolean excludeSystemUsers)
UserManagementexcludeSystemUsers - whether to exclude the users who have the system user rolepublic User findUser(UserIdentification userIdentification)
UserManagementExternalUserAuthentication
suserIdentification - the identificationpublic User findUser(UserIdentification userIdentification, boolean loadExternalAuthentications)
UserManagementuserIdentification - the identificationloadExternalAuthentications - true if the external auths of the user should be loaded as well@Transactional(readOnly=true) public User findUserByUserId(Long userId, boolean loadExternalAuthentications)
UserManagementUserManagement.getUserById(Long, Converter) instead.userId - Id of the user to find.loadExternalAuthentications - true to load the external authentications of the user@Transactional(readOnly=true) public List<User> findUsersByRole(UserRole role, UserStatus status)
UserManagement@Transactional(readOnly=true) public String generateUniqueAlias(String externalUserName, String emailAddress)
UserManagementexternalUserName - the external user name to try first. Can be null.emailAddress - the email address to extract the alias from@Transactional(readOnly=true) public long getActiveUserCount(String systemId, UserRole role)
UserManagementsystemId - ID of an external system to only count the users which originate from this
external system. If null, all user are counted.role - the role of a user. If not null only the users with that role will be counted
otherwise all roles (including system users) are considered.public Set<ExternalUserAuthentication> getExternalExternalUserAuthentications(long userId)
userId - The users id.@Transactional(readOnly=true) public <T> T getUserById(Long userId, Converter<User,T> converter)
UserManagementT - the type of the resulting objectuserId - the ID of the userconverter - the converter to useprotected void handleAcceptTermsOfUse(Long userId) throws UserNotFoundException, AuthorizationException, UserActivationValidationException
handleAcceptTermsOfUse in class UserManagementBaseUserNotFoundExceptionAuthorizationExceptionUserActivationValidationExceptionprotected void handleAnonymizeUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoBlogManagerLeftException, NoClientManagerLeftException, UserDeletionDisabledException
UserManagementBaseUserManagementBase.anonymizeUser(Long, Long[], boolean)handleAnonymizeUser in class UserManagementBaseAuthorizationExceptionNoBlogManagerLeftExceptionNoClientManagerLeftExceptionUserDeletionDisabledExceptionprotected User handleAssignUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException
UserManagementBaseUserManagementBase.assignUserRole(Long, UserRole)handleAssignUserRole in class UserManagementBaseAuthorizationException - in case the current user is not a client managerInvalidOperationException - in case the user is already a system or a crawl user or the role to assign is the
system or crawl user roleprotected boolean handleChangeEmailAddress(Long userId, String newEmail, boolean sendConfirmationEmail) throws EmailAlreadyExistsException, EmailValidationException
UserManagementBase#changeEmailAddress(Long, String)handleChangeEmailAddress in class UserManagementBaseuserId - Id of the user, which email should be changed.newEmail - The new email address.sendConfirmationEmail - If true an confirmation link will be send to the user to confirm the new address.
False is only possible, if the current use an administrator.EmailAlreadyExistsExceptionEmailValidationExceptionprotected void handleChangeUserStatusByManager(Long userId, UserStatus newStatus) throws UserActivationValidationException, InvalidUserStatusTransitionException, UserNotFoundException, NoClientManagerLeftException
protected void handleConfirmNewEmailAddress(String securityCode) throws SecurityCodeNotFoundException, EmailAlreadyExistsException
UserManagementBaseUserManagementBase.confirmNewEmailAddress(String)handleConfirmNewEmailAddress in class UserManagementBaseSecurityCodeNotFoundExceptionEmailAlreadyExistsExceptionprotected User handleConfirmUser(String securitycode, UserVO data) throws SecurityCodeNotFoundException, EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PasswordValidationException, InvalidUserStatusTransitionException, ExternalUserPasswordChangeNotAllowedException
UserManagementBaseUserManagementBase.confirmUser(String, UserVO)protected User handleCreateOrUpdateExternalUser(ExternalUserVO userVO) throws EmailAlreadyExistsException, EmailValidationException, AliasAlreadyExistsException, UserActivationValidationException, InvalidUserStatusTransitionException, PermanentIdMissmatchException
UserManagementBaseUserManagementBase.createOrUpdateExternalUser(ExternalUserVO)protected User handleCreateUser(UserVO userVo, boolean emailConfirmation, boolean managerActivation) throws EmailAlreadyExistsException, EmailValidationException, AliasAlreadyExistsException, PasswordValidationException
UserManagementBaseUserManagementBase.createUser(UserVO, boolean, boolean)handleCreateUser in class UserManagementBaseEmailAlreadyExistsExceptionEmailValidationExceptionAliasAlreadyExistsExceptionPasswordValidationExceptionprotected User handleFindUserByAlias(String alias)
UserManagementBaseUserManagementBase.findUserByAlias(String)handleFindUserByAlias in class UserManagementBaseprotected User handleFindUserByEmail(String email)
UserManagementBaseUserManagementBase.findUserByEmail(String)handleFindUserByEmail in class UserManagementBaseprotected User handleFindUserByEmailAlias(String username)
UserManagementBase#findKenmeiUserByEmailAlias(String)handleFindUserByEmailAlias in class UserManagementBaseprotected User handleFindUserByExternalUserId(String userId, String systemId)
UserManagementBaseUserManagementBase.findUserByExternalUserId(String, String)handleFindUserByExternalUserId in class UserManagementBaseprotected long handleGetActiveUserCount()
UserManagementBaseUserManagementBase.getActiveUserCount()handleGetActiveUserCount in class UserManagementBaseprotected UserRole[] handleGetRolesOfUser(Long userId)
UserManagementBaseUserManagementBase.getRolesOfUser(Long)handleGetRolesOfUser in class UserManagementBaseprotected User handleInviteUserToBlog(Long blogId, UserVO userVo, BlogRole role) throws AliasAlreadyExistsException, EmailAlreadyExistsException, EmailValidationException, PermanentIdMissmatchException, AuthorizationException
UserManagementBase#inviteUserToBlog(Long, User, UserVO, com.communote.server.model.blog.BlogRole)handleInviteUserToBlog in class UserManagementBaseBlogAccessException - in case the current user is not allowed to add the userAuthorizationException - in case there is no current userAliasAlreadyExistsExceptionEmailAlreadyExistsExceptionEmailValidationExceptionPermanentIdMissmatchExceptionprotected User handleInviteUserToClient(UserVO userVo) throws EmailValidationException, EmailAlreadyExistsException, AliasAlreadyExistsException, PermanentIdMissmatchException, AuthorizationException
UserManagementBase#inviteUserToClient(User, UserVO)protected void handlePermanentlyDisableUser(Long userId, Long[] blogIds, boolean becomeManager) throws AuthorizationException, NoBlogManagerLeftException, NoClientManagerLeftException, UserDeletionDisabledException, InvalidUserStatusTransitionException
UserManagementBase.permanentlyDisableUser(Long, Long[], boolean)protected User handleRegisterUser(String email, Locale locale, UserManagement.RegistrationType type) throws EmailValidationException, EmailAlreadyExistsException
#registerUser(String, java.util.Locale)handleRegisterUser in class UserManagementBaseEmailValidationExceptionEmailAlreadyExistsExceptionUserManagement.registerUser(String, Locale, RegistrationType)protected User handleRemoveUserRole(Long userId, UserRole role) throws AuthorizationException, InvalidOperationException, NoClientManagerLeftException
UserManagementBaseUserManagementBase.removeUserRole(Long, UserRole)handleRemoveUserRole in class UserManagementBaseAuthorizationException - in case the current user is not client managerInvalidOperationException - in case the user is a system or crawl user and the system or crawl user role
should be removedNoClientManagerLeftException - in case the client manager role should be removed from the last user with that
roleprotected void handleResetPermanentId(String systemId) throws AuthorizationException
#resetExternalUserId(String)handleResetPermanentId in class UserManagementBaseAuthorizationExceptionprotected User handleUnlockUser(String securityCode) throws SecurityCodeNotFoundException
UserManagementBaseUserManagementBase.unlockUser(String)handleUnlockUser in class UserManagementBaseSecurityCodeNotFoundExceptionprotected User handleUpdateExternalUser(ExternalUserVO userVO) throws AliasAlreadyExistsException, EmailValidationException, EmailAlreadyExistsException, UserActivationValidationException, InvalidUserStatusTransitionException, PermanentIdMissmatchException
UserManagementBaseUserManagementBase.updateExternalUser(ExternalUserVO)protected void handleUpdateLanguage(Long userId, String languageCode)
UserManagementBaseUserManagementBase.updateLanguage(Long, String)handleUpdateLanguage in class UserManagementBasepublic boolean hasExternalAuthentication(long userId,
String externalSystemId)
userId - The users id.externalSystemId - ID of an external system@PostConstruct protected void init()
public void registerActivationValidator(UserActivationValidator validator)
UserManagementACTIVE. The validators are executed in the order defined by the
Orderable implementation. If the first validator throws an exception the validation
will be stopped.validator - the validator to addpublic void resetTermsOfUse()
throws AuthorizationException
UserManagementAuthorizationException - in case the current user is not client manager or internal system userpublic void sendReminderMails()
public void unregisterActivationValidator(UserActivationValidator validator)
UserManagementvalidator - the validator to removeCopyright © 2019 Communote team. All rights reserved.