Esempio n. 1
0
  @Transactional(readOnly = false, rollbackFor = Exception.class)
  @Override
  public User delete(Long id) throws Exception {
    LOGGER.debug("User delete(Long id): " + id);

    User user = userRepository.findOne(id);

    if (user == null) {
      LOGGER.debug("No user found with id: " + id);
      throw new Exception();
    }

    userRepository.delete(user);
    return user;
  }
Esempio n. 2
0
  @Transactional(readOnly = false, rollbackFor = Exception.class)
  @Override
  public User update(User user) throws Exception {
    LOGGER.debug("update(User user): " + user);
    user.setUpdatedDate(new Date());
    LOGGER.debug("Updating user with information: " + user);

    User userDb = userRepository.findOne(user.getId());

    if (userDb == null) {
      LOGGER.debug("No user found with id: " + user.getId());
      throw new Exception();
    }

    userRepository.save(user);
    return user;
  }
Esempio n. 3
0
 @Transactional(readOnly = true)
 @Override
 public User findById(Long id) {
   LOGGER.debug("findById(Long id): " + id);
   return userRepository.findOne(id);
 }