Package es.udc.tfg.journals.model.user

Examples of es.udc.tfg.journals.model.user.User


    return j;
  }

  private void createKeywordsByString(String line, Journal j, long userId)
      throws InstanceNotFoundException {
    User userAdmin = userService.findUser(userId);
    HashMap<String, Integer> keywordsMap = new HashMap<String, Integer>();

    // Domains
    line = line.substring(line.indexOf(", Domain=[")
        + ", Domain=[".length());
View Full Code Here


  }

  Object onSuccess() {
    try {
      User user = userService.findUser(userSession.getUserId());
      for (KeywordWeight kw : keywordwlist) {
        if (kw != null) {
          kw.addUser(user);
          keywordService
              .createKeywordWeightJournal(new KeywordWeightJournal(
View Full Code Here

      } catch (InstanceNotFoundException e1) {
        String encryptedPassword = null;
        if (clearPassword != null) {
          encryptedPassword = PasswordEncrypter.crypt(clearPassword);
        }
        User user = new User(userDetails.getEmail(),
            userDetails.getLogin(), encryptedPassword,
            userDetails.getFirstName(), userDetails.getLastName());

        userDao.save(user);
        return user;
View Full Code Here

  }

  @Transactional(readOnly = true)
  public User login(String login, String password, boolean passwordIsEncrypted)
      throws InstanceNotFoundException, IncorrectPasswordException {
    User user = userDao.findByLogin(login);
    String storedPassword = user.getEncryptedPassword();
    if (storedPassword == null) {
      throw new IncorrectPasswordException(login);
    }

    if (passwordIsEncrypted) {
View Full Code Here

    return userDao.findByLogin(login);
  }

  public void updateUserDetails(Long userId, UserDetails userDetails)
      throws InstanceNotFoundException, DuplicateInstanceException {
    User user = userDao.find(userId);
    try {
      if (user.getEmail().equals(userDetails.getEmail())) {
        throw new InstanceNotFoundException(null, null);
      }
      userDao.findByEmail(userDetails.getEmail());
      throw new DuplicateInstanceException(userDetails.getEmail(),
          User.class.getName());
    } catch (InstanceNotFoundException e) {
      try {
        if (user.getLogin().equals(userDetails.getLogin())) {
          throw new InstanceNotFoundException(null, null);
        }
        userDao.findByLogin(userDetails.getLogin());
        throw new DuplicateInstanceException(userDetails.getLogin(),
            User.class.getName());
      } catch (InstanceNotFoundException e1) {
        user.setFirstName(userDetails.getFirstName());
        user.setLastName(userDetails.getLastName());
        user.setEmail(userDetails.getEmail());
        user.setLogin(userDetails.getLogin());
      }
    }
  }
View Full Code Here

  }

  public void changePassword(Long userId, String oldClearPassword,
      String newClearPassword) throws IncorrectPasswordException,
      InstanceNotFoundException {
    User user;
    user = userDao.find(userId);

    String storedPassword = user.getEncryptedPassword();

    if (!PasswordEncrypter.isClearPasswordCorrect(oldClearPassword,
        storedPassword)) {
      throw new IncorrectPasswordException(user.getEmail());
    }

    user.setEncryptedPassword(PasswordEncrypter.crypt(newClearPassword));
  }
View Full Code Here

    user.setEncryptedPassword(PasswordEncrypter.crypt(newClearPassword));
  }

  public void deleteAccount(Long userId, String clearPassword)
      throws IncorrectPasswordException, InstanceNotFoundException {
    User user;
    user = userDao.find(userId);

    String storedPassword = user.getEncryptedPassword();

    if (storedPassword != null) {
      if (clearPassword == null
          || !PasswordEncrypter.isClearPasswordCorrect(clearPassword,
              storedPassword)) {
        throw new IncorrectPasswordException(user.getEmail());
      }
    }
    userDao.remove(userId);
  }
View Full Code Here

    userDao.remove(userId);
  }

  @Transactional(readOnly = true)
  public User loginWithSocial(String email) throws InstanceNotFoundException {
    User user = userDao.findByEmail(email);
    return user;
  }
View Full Code Here

    return userDao.findAll();
  }

  public void setRole(long userId, String role)
      throws InstanceNotFoundException {
    User user = userDao.find(userId);
    user.setRole(role);
  }
View Full Code Here

TOP

Related Classes of es.udc.tfg.journals.model.user.User

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.