public String removeCheese() { Cheese tempCheese = new Cheese(getSelectedCheeseName(), ""); Cheese storedCheese = service.find(tempCheese); if (storedCheese == null) { FacesContext.getCurrentInstance() .addMessage(null, new FacesMessage("Cheese " + tempCheese.getName() + " Not Found!")); return "delete error"; } service.remove(storedCheese); FacesContext.getCurrentInstance().addMessage(null, new FacesMessage("Cheese Removed")); return "ok"; }
public List getCheeses() { if (cheeses == null) { cheeses = new ArrayList(service.getCheeses()); } return cheeses; }