Esempio n. 1
0
 @Timed
 @ApiOperation(value = "Get User", notes = "Gets the specified user", response = UserDTO.class)
 @RequestMapping(
     value = "/{username}",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 public ResponseEntity<?> get(
     @ApiParam(value = "username of the user", required = true) @PathVariable("username")
         String login) {
   User user = userService.findOne(login);
   return new ResponseEntity<>(userDTOAssembler.toResource(user), HttpStatus.OK);
 }
Esempio n. 2
0
 @Timed
 @ApiOperation(
     value = "Search users",
     notes = "Search users by username",
     response = UserDTO.class,
     responseContainer = "List")
 @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
 public ResponseEntity<?> search(
     @ApiParam(value = "username to search for", required = true) @RequestParam("username")
         String username) {
   List<UserDTO> users = new ArrayList<>();
   for (User user : userService.findLike(username)) {
     users.add(userDTOAssembler.toResource(user));
   }
   return new ResponseEntity<>(users, HttpStatus.OK);
 }