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(); }
public List<Ingredient> complete(String query) { return serviceIngredient.searchIngredients(query); }