@RequestMapping(value = "/pizzeria/pizzasList", method = RequestMethod.GET)
  public @ResponseBody List<RelationPizzeriaPizza> getPizzas(HttpSession session) {
    /*
     * If the author of the request is not logged in as a pizzeria, negate
     * the information.
     */
    if (!SessionUtils.isPizzeria(session)) {
      return null;
    }

    PizzeriaDAO pizzeriaDAO = (PizzeriaDAO) context.getBean("pizzeriaDAO");
    Pizzeria pizzeria = pizzeriaDAO.get(SessionUtils.getPizzeriaIdFromSessionOrNull(session));

    return pizzeria.getAvailablePizzasPriceList();
  }
  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();
  }