@Override public UserDTO getUserByEmail(String email) { User u = userService.findByEmail(email); if (u == null) { return null; } return beanMappingService.mapTo(u, UserDTO.class); }
@Override public UserDTO getUserById(Long userId) { User u = userService.findById(userId); if (u == null) { return null; } return beanMappingService.mapTo(u, UserDTO.class); }
@Override public UserDTO authUser(UserAuthenticateDTO u) { User user = userService.findByEmail(u.getEmail()); if (user == null) { return null; } if (userService.authUser(user, u.getPassword())) { return beanMappingService.mapTo(user, UserDTO.class); } return null; }
@Override public List<UserDTO> getUserByName(String name) { return beanMappingService.mapTo(userService.findByName(name), UserDTO.class); }
@Override public List<UserDTO> getAllUsers() { return beanMappingService.mapTo(userService.findAll(), UserDTO.class); }
@Override public void removeUser(UserDTO u) { userService.removeUser(beanMappingService.mapTo(u, User.class)); }