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"); } }
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; }
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()); }