@RequestMapping(value = "/records") public @ResponseBody UserListDto getUsers() { UserListDto userListDto = new UserListDto(); userListDto.setUsers(service.findAll()); return userListDto; }
@RequestMapping(value = "/delete", method = RequestMethod.POST) public @ResponseBody Boolean delete(@RequestParam String username) { User existingUser = new User(); existingUser.setUsername(username); return service.delete(existingUser); }
@RequestMapping(value = "/update", method = RequestMethod.POST) public @ResponseBody User update( @RequestParam String username, @RequestParam String firstName, @RequestParam String lastName, @RequestParam Integer role) { Role newRole = null; try { newRole = getter.findByRoleId(role.toString()); } catch (DaoException e) { // NOP } User existingUser = new User(); existingUser.setUsername(username); existingUser.setFirstName(firstName); existingUser.setLastName(lastName); existingUser.setRole(newRole); return service.update(existingUser); }
@RequestMapping(value = "/get") public @ResponseBody User get(@RequestBody User user) { return service.read(user); }