@RequestMapping(value = "/{id:.+}", method = RequestMethod.DELETE) @ApiOperation(value = "Deletes the User instance associated with the given id.") public boolean deleteUser(@PathVariable("id") Integer id) throws EntityNotFoundException { LOGGER.debug("Deleting User with id: {}", id); User deleted = userService.delete(id); return deleted != null; }
@RequestMapping(value = "/count", method = RequestMethod.GET) @ApiOperation(value = "Returns the total count of User instances.") public Long countAllUsers() { LOGGER.debug("counting Users"); Long count = userService.countAll(); return count; }
@RequestMapping(value = "/{id:.+}", method = RequestMethod.GET) @ApiOperation(value = "Returns the User instance associated with the given id.") public User getUser(@PathVariable("id") Integer id) throws EntityNotFoundException { LOGGER.debug("Getting User with id: {}", id); User instance = userService.findById(id); LOGGER.debug("User details with id: {}", instance); return instance; }
@RequestMapping(value = "/", method = RequestMethod.POST) @ApiOperation(value = "Creates a new User instance.") public User createUser(@RequestBody User instance) { LOGGER.debug("Create User with information: {}", instance); instance = userService.create(instance); LOGGER.debug("Created User with information: {}", instance); return instance; }
@RequestMapping(value = "/{id:.+}", method = RequestMethod.PUT) @ApiOperation(value = "Updates the User instance associated with the given id.") public User editUser(@PathVariable("id") Integer id, @RequestBody User instance) throws EntityNotFoundException { LOGGER.debug("Editing User with id: {}", instance.getUserid()); instance.setUserid(id); instance = userService.update(instance); LOGGER.debug("User details with id: {}", instance); return instance; }
@RequestMapping(value = "/", method = RequestMethod.GET) @ApiOperation(value = "Returns the list of User instances.") public Page<User> getUsers(Pageable pageable) { LOGGER.debug("Rendering Users list"); return userService.findAll(pageable); }
@RequestMapping(value = "/search", method = RequestMethod.POST) @ApiOperation(value = "Returns the list of User instances matching the search criteria.") public Page<User> findUsers(Pageable pageable, @RequestBody QueryFilter[] queryFilters) { LOGGER.debug("Rendering Users list"); return userService.findAll(queryFilters, pageable); }