Beispiel #1
0
 public void delete(Beer beer) {
   logger.debug("Deleting beer: " + beer.toString());
   if (beerMap.containsKey(beer.getId())) {
     beerMap.remove(beer.getId());
   } else {
     throw new BeerNotFoundException(
         beer.getId(), "No beer with id = " + beer.getId() + " exists");
   }
 }
Beispiel #2
0
 public Beer update(Beer beer) {
   logger.debug("Updating beer: " + beer.toString());
   if (beerMap.containsKey(beer.getId())) {
     beerMap.put(beer.getId(), beer);
   } else {
     throw new BeerNotFoundException(
         beer.getId(), "No beer with id = " + beer.getId() + " exists");
   }
   return beer;
 }
Beispiel #3
0
 public Beer create(Beer beer) {
   beer.setId(idSeq.getAndIncrement());
   logger.debug("Creating beer: " + beer.toString());
   beerMap.put(beer.getId(), beer);
   return beerMap.get(beer.getId());
 }