Esempio n. 1
0
  public void create() {
    service.create(recipe);

    MessagesUtil.setGlobalInfoMessage(MessagesUtil.getValue("createRecipeSuccessful"));

    ingredients = new ArrayList<>();
    refreshRecipeIngredient();
    refreshRecipe();
  }
Esempio n. 2
0
  public void addIngredient() {

    if (recipeingredient.getIngredient().getId() == 0) {
      MessagesUtil.setGlobalWarningMessage(MessagesUtil.getValue("ingredientRequired"));
      return;
    }

    Ingredient ingredient = serviceIngredient.getById(recipeingredient.getIngredient().getId());
    recipeingredient.setIngredient(ingredient);

    Unit unit = serviceUnit.getById(recipeingredient.getUnit().getId());
    recipeingredient.setUnit(unit);

    Ingredientform ingredientform =
        serviceIngredientform.getById(recipeingredient.getIngredientForm().getId());
    recipeingredient.setIngredientForm(ingredientform);

    UUID uuid = UUID.randomUUID();
    recipeingredient.setUuid(uuid.toString());

    ingredients.add(recipeingredient);

    refreshRecipeIngredient();
  }