private String deletePizza(Pizzeria pizzeria, Pizza pizza, PizzeriaPizzaForm form) {
    List<RelationPizzeriaPizza> pizzeriaPizzas = pizzeria.getPizzasPriceList();

    /*
     * Only update the pizza if the pizzeria has already a
     * RelationPizzeriaPizza with the same id.
     */
    for (RelationPizzeriaPizza pizzeriaPizza : pizzeriaPizzas) {
      if (pizzeriaPizza.getId() == form.getId()) {

        /*
         * FIXME - Prevent the elimination of RelationPizzeriaPizzas
         * which belong to an OrderItem which has not yet been
         * collected.
         */

        RelationPizzeriaPizzaDAO dao =
            (RelationPizzeriaPizzaDAO) context.getBean("relationPizzeriaPizzaDAO");
        pizzeriaPizza.setAvailable(false);
        dao.update(pizzeriaPizza);
        return buildOkResponse(pizzeriaPizza);
      }
    }

    return buildErrorResponse();
  }
  private String updatePizza(Pizzeria pizzeria, Pizza pizza, PizzeriaPizzaForm form) {
    List<RelationPizzeriaPizza> pizzeriaPizzas = pizzeria.getPizzasPriceList();

    /*
     * Only update the pizza if the pizzeria has already a
     * RelationPizzeriaPizza with the same id.
     */
    for (RelationPizzeriaPizza pizzeriaPizza : pizzeriaPizzas) {
      if (pizzeriaPizza.getId() == form.getId()) {
        pizzeriaPizza.setPizza(pizza);
        pizzeriaPizza.setPizzaSize(form.getSize());
        pizzeriaPizza.setPreparationTime(form.getPreparationTimeInSeconds());
        pizzeriaPizza.setGlutenFree(form.getGlutenFree());
        pizzeriaPizza.setPrice(form.getPrice());

        RelationPizzeriaPizzaDAO dao =
            (RelationPizzeriaPizzaDAO) context.getBean("relationPizzeriaPizzaDAO");
        dao.update(pizzeriaPizza);

        return buildOkResponse(pizzeriaPizza);
      }
    }

    return buildErrorResponse();
  }
 private String buildOkResponse(RelationPizzeriaPizza pizzeriaPizza) {
   return "{\"success\" : true, \"id\" : "
       + pizzeriaPizza.getId()
       + ", \"pizzaId\" : "
       + pizzeriaPizza.getPizza().getId()
       + ", \"pizzaName\" : \""
       + pizzeriaPizza.getPizza().getName()
       + "\", \"size\" : \""
       + pizzeriaPizza.getPizzaSize()
       + "\", \"preparationTime\" : \""
       + pizzeriaPizza.getPreparationTimeString()
       + "\", \"glutenFree\" : "
       + pizzeriaPizza.getGlutenFree()
       + ", \"price\" : "
       + pizzeriaPizza.getPrice()
       + "}";
 }