예제 #1
0
 @RequestMapping(
     value = "/entries",
     produces = Constants.APPLICATION_JSON,
     method = RequestMethod.GET)
 @ResponseStatus(HttpStatus.FOUND)
 public List<Beer> getAllBeers() {
   logger.debug("endpoint: .../entries");
   return beerService.getAll();
 }
예제 #2
0
 @RequestMapping(
     value = "/update",
     consumes = Constants.APPLICATION_JSON,
     produces = Constants.APPLICATION_JSON,
     method = RequestMethod.POST)
 @ResponseStatus(HttpStatus.OK)
 public Beer updateBeer(@RequestBody Beer beer) {
   logger.debug("endpoint: .../update with payload: " + beer.toString());
   return beerService.update(beer);
 }
예제 #3
0
 @RequestMapping(
     value = "/entry/{id}",
     produces = Constants.APPLICATION_JSON,
     method = RequestMethod.GET)
 @ResponseStatus(HttpStatus.FOUND)
 public Beer getBeer(@PathVariable long id) {
   logger.debug("endpoint: .../entry/" + id);
   Beer beer = beerService.getOne(id);
   return beer;
 }
예제 #4
0
 @RequestMapping(value = "/delete/all", method = RequestMethod.DELETE)
 @ResponseStatus(HttpStatus.OK)
 public void deleteBeer() {
   logger.debug("endpoint: .../delete/all");
   beerService.deleteAll();
 }
예제 #5
0
 @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
 @ResponseStatus(HttpStatus.OK)
 public void deleteBeer(@PathVariable long id) {
   logger.debug("endpoint: .../delete/" + id);
   beerService.deleteById(id);
 }