예제 #1
0
 @Override
 public User updateUser(
     long userId, String username, String password, String firstName, String lastName) {
   User user = userRepository.findOne(userId);
   user.setUsername(username);
   user.setFirstName(firstName);
   user.setLastName(lastName);
   user.setPassword(password);
   return this.userRepository.save(user);
 }
예제 #2
0
 @Override
 public Customer removeCustomer(long userId, long customerId) {
   User user = userRepository.findOne(userId);
   Customer customer = customerRepository.findOne(customerId);
   user.getCustomers().remove(customer);
   this.userRepository.save(user);
   customer.setUser(null);
   this.customerRepository.delete(customer);
   return customer;
 }
예제 #3
0
 @Override
 public User removeUser(long userId) {
   User u = userRepository.findOne(userId);
   this.userRepository.delete(userId);
   return u;
 }
예제 #4
0
 @Override
 public User findById(long userId) {
   User user = userRepository.findOne(userId);
   if (null == user) throw new UserNotFoundException(userId);
   return user;
 }