Search in sources :

Example 1 with InvalidEmailException

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());
    }
}
Also used : User(com.networknt.portal.usermanagement.model.common.model.user.User) UserDto(com.networknt.portal.usermanagement.model.common.domain.UserDto) NoSuchUserException(com.networknt.portal.usermanagement.model.common.exception.NoSuchUserException) InvalidEmailException(com.networknt.portal.usermanagement.model.common.exception.InvalidEmailException) InvalidEmailException(com.networknt.portal.usermanagement.model.common.exception.InvalidEmailException) NoSuchUserException(com.networknt.portal.usermanagement.model.common.exception.NoSuchUserException) EventHandlerMethod(com.networknt.eventuate.common.EventHandlerMethod)

Aggregations

EventHandlerMethod (com.networknt.eventuate.common.EventHandlerMethod)1 UserDto (com.networknt.portal.usermanagement.model.common.domain.UserDto)1 InvalidEmailException (com.networknt.portal.usermanagement.model.common.exception.InvalidEmailException)1 NoSuchUserException (com.networknt.portal.usermanagement.model.common.exception.NoSuchUserException)1 User (com.networknt.portal.usermanagement.model.common.model.user.User)1