Exemplo n.º 1
0
 // DELETE /rest/users/{id}
 public HttpHeaders destroy() {
   user = new User();
   user.setId(Long.parseLong(id));
   usersService.delete(user);
   model = user;
   return httpHeaders.withStatus(200);
 }
Exemplo n.º 2
0
 // Get /rest/users
 public HttpHeaders index() {
   if (searchTerm == null) {
     users = usersService.getAll();
   } else {
     users = usersService.getAllBySearchTerm(searchTerm);
   }
   model = users;
   return httpHeaders.withStatus(200);
 }
Exemplo n.º 3
0
 // GET /rest/users/{id}/files
 public HttpHeaders files() {
   files = fileService.getByParentAndOwner(0, Long.parseLong(id));
   model = files;
   return httpHeaders.withStatus(200);
 }
Exemplo n.º 4
0
 // GET /rest/users/{id}/friends
 public HttpHeaders friends() {
   user = usersService.get(Long.parseLong(id));
   friends = friendsService.getAllByUser(user);
   model = friends;
   return httpHeaders.withStatus(200);
 }
Exemplo n.º 5
0
 // PUT /rest/users/{id}
 public HttpHeaders update() {
   user.setId(Long.parseLong(id));
   usersService.update(user);
   model = user;
   return httpHeaders.withStatus(200);
 }
Exemplo n.º 6
0
 // GET /rest/users/{id}
 public HttpHeaders show() {
   user = usersService.get(Long.parseLong(id));
   user.setPassword("");
   model = user;
   return httpHeaders.withStatus(200);
 }
Exemplo n.º 7
0
 // POST /rest/users
 public HttpHeaders create() throws IOException {
   usersService.save((User) model);
   model = user;
   return httpHeaders.withStatus(200);
 }