use of com.networknt.portal.usermanagement.model.common.exception.InvalidEmailException in project light-portal by networknt.
the class UserQueryWorkflow method update.
@EventHandlerMethod
public void update(DispatchedEvent<UserUpdatedEvent> de) {
String id = de.getEntityId();
UserDto user = de.getEvent().getUserDto();
User userResult = null;
try {
if (user.isEmailChange()) {
userResult = service.changeEmail(id, user.getContactData().getEmail());
} else if (user.isPasswordReset()) {
userResult = service.changePassword(id, user.getPassword());
} else if (user.isScreenNameChange()) {
userResult = service.changeScreenName(id, user.getScreenName());
} else {
userResult = service.fromUserDto(user);
userResult.setId(id);
userResult = service.update(userResult);
}
} catch (NoSuchUserException e) {
logger.info("No Such User Error", id, e.getMessage());
} catch (InvalidEmailException e) {
logger.info("Invalid Email Error", id, e.getMessage());
} catch (Exception e) {
logger.info("Error on update user:", id, e.getMessage());
}
}
Aggregations