Пример #1
0
  @RequestMapping(value = "/records")
  public @ResponseBody UserListDto getUsers() {

    UserListDto userListDto = new UserListDto();
    userListDto.setUsers(service.findAll());
    return userListDto;
  }
Пример #2
0
  @RequestMapping(value = "/delete", method = RequestMethod.POST)
  public @ResponseBody Boolean delete(@RequestParam String username) {

    User existingUser = new User();
    existingUser.setUsername(username);

    return service.delete(existingUser);
  }
Пример #3
0
  @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);
  }
Пример #4
0
 @RequestMapping(value = "/get")
 public @ResponseBody User get(@RequestBody User user) {
   return service.read(user);
 }