Package eu.scape_project.pw.idp.excpetions

Examples of eu.scape_project.pw.idp.excpetions.UserNotFoundException


     */
    public void activateUser(IdpUser user) throws UserNotFoundException {
        IdpUser foundUser = em.find(IdpUser.class, user.getId());
        if (foundUser == null) {
            log.error("Error activating user. User {} not found.", user.getUsername());
            throw new UserNotFoundException("Error activating user. User " + user.getUsername() + "not found.");
        }
        foundUser.setStatus(IdpUserState.ACTIVE);
        foundUser.setActionToken("");
        em.persist(foundUser);
        log.info("Activated user with username {}.", foundUser.getUsername());
View Full Code Here


        // We have to find the user because if we use em.merge(user)
        // user.plainPassword will be deleted (because it is transient).
        IdpUser foundUser = em.find(IdpUser.class, user.getId());
        if (foundUser == null) {
            log.error("Error resetting password. User not found {}.", user.getUsername());
            throw new UserNotFoundException("Error resetting password. User not found " + user.getUsername());
        }
        foundUser.setPlainPassword(user.getPlainPassword());
        foundUser.setActionToken("");
        foundUser.setStatus(IdpUserState.ACTIVE);
        em.persist(foundUser);
View Full Code Here

            .createQuery("SELECT u FROM IdpUser u WHERE u.actionToken = :actionToken", IdpUser.class)
            .setParameter("actionToken", actionToken).getResultList();

        if (matchingUsers.size() != 1) {
            log.error("{} users matching given actionToken {}", matchingUsers.size(), actionToken);
            throw new UserNotFoundException(matchingUsers.size() + " users matching given actionToken " + actionToken);
        }

        return matchingUsers.get(0);
    }
View Full Code Here

            .createQuery("SELECT u FROM IdpUser u WHERE u.username = :userIdentifier OR u.email = :userIdentifier",
                IdpUser.class).setParameter("userIdentifier", userIdentifier).getResultList();

        if (matchingUsers.size() != 1) {
            log.error("{} users matching given identifier {}", matchingUsers.size(), userIdentifier);
            throw new UserNotFoundException(matchingUsers.size() + " users matching given identifier " + userIdentifier);
        }

        return matchingUsers.get(0);
    }
View Full Code Here

TOP

Related Classes of eu.scape_project.pw.idp.excpetions.UserNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.