Package com.din.din.model.entities

Examples of com.din.din.model.entities.RecipeItem


          return FoodItemDAO.getFoodItemsByProject(entityManager, recipe.getProject());
        }
      })
     
      if(system == MeasurementSystem.Imperial) {
        RecipeItem recipeItem;
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.bacon"));
        recipeItem.setQuantity(new BigDecimal(0.5));
        recipeItem.setQuantityTypeKey(quantityTypeMapped.get("lbs.").get(0).getKey());
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.bacon")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.sandwichBread"));
        //recipeItem.setQuantityType(null);  //
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.sandwichBread")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.icebergLettuce"));
        //recipeItem.setQuantityType(null);  //
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.icebergLettuce")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.tomato"));
        recipeItem.setQuantity(new BigDecimal(2));
        recipeItem.setQuantityTypeKey(quantityTypeMapped.get(BeanUtil.getMessage("quantityType.pieces")).get(0).getKey())//
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.tomato")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);     
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.mayonnaise"));
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.mayonnaise")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);   
      } else {
        RecipeItem recipeItem;
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.potato"));
        recipeItem.setQuantity(BigDecimal.ONE);
        recipeItem.setQuantityTypeKey(quantityTypeMapped.get(BeanUtil.getMessage("quantityType.pieces")).get(0).getKey());
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.potato")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);     
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.chives"));
        recipeItem.setQuantity(new BigDecimal(12));
        recipeItem.setQuantityTypeKey(quantityTypeMapped.get("g").get(0).getKey());
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.chives")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);   
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.butter"));
        recipeItem.setQuantity(new BigDecimal(5));
        recipeItem.setQuantityTypeKey(quantityTypeMapped.get("g").get(0).getKey());
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.butter")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);     
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.onion"));
        recipeItem.setQuantity(BigDecimal.ONE);
        recipeItem.setQuantityTypeKey(quantityTypeMapped.get(BeanUtil.getMessage("quantityType.pieces")).get(0).getKey());
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.onion")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache)
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.cheddarCheese"));
        recipeItem.setQuantity(new BigDecimal(25));
        recipeItem.setQuantityTypeKey(quantityTypeMapped.get("g").get(0).getKey());
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.cheddarCheese")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache)
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.salt"));
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.salt")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache)
       
        recipeItem = new RecipeItem();
        recipeItem.setDescription(BeanUtil.getMessage("recipeItem.pepper"));
        recipeItem.setFoodItemKey(foodMapped.get(BeanUtil.getMessage("foodItem.pepper")).get(0).getKey());
        recipeItem.setRecipe(recipe);
        save(entityManager, recipeItem, cache);         
      }
   
      if(contained) {
        transaction.commit();
View Full Code Here


  private EntityCachingManager cache;
  private Project project;
 
  public RecipeItemWrapper(Project project) {
    this(project, null);
    recipeItem = new RecipeItem();
   
    loadDefaults();
  }
View Full Code Here

    super.onPreSave(entityManager, entity);
   
    // Save/update all current RecipeItems
    for(FoodItemWrapper item : foodItemSet) {
      RecipeItemWrapper recipeItemWrapper = item.getRecipeItem();
      RecipeItem recipeItem = recipeItemWrapper.getRecipeItem();
     
      recipeItem.setRecipe(entity);
      recipeItem.setFoodItemKey(item.getFoodItem().getKey());
    }   
    entity.setRecipeItems(getRecipeItemList());
  }
View Full Code Here

  private Map<Key, RecipeItem> getRecipeItemMap() {
    Map<Key, RecipeItem> recipeItemMap = new LinkedHashMap<Key, RecipeItem>();
    for(FoodItemWrapper item : foodItemSet) {
      RecipeItemWrapper recipeItemWrapper = item.getRecipeItem();
      RecipeItem recipeItem = recipeItemWrapper.getRecipeItem();
     
      if(recipeItem.getKey() != null) {
        recipeItemMap.put(recipeItem.getKey(), recipeItem);
      }
    }
    return recipeItemMap;
  }
View Full Code Here

  @Override
  protected String onSaveSuccess(Recipe entity) {
    List<RecipeItem> recipeItems = new ArrayList<RecipeItem>();
    for(FoodItemWrapper item : foodItemSet) {
      RecipeItemWrapper recipeItemWrapper = item.getRecipeItem();
      RecipeItem recipeItem = recipeItemWrapper.getRecipeItem();
     
      recipeItems.add(recipeItem);
    }
   
    entity.setRecipeItems(recipeItems);
View Full Code Here

TOP

Related Classes of com.din.din.model.entities.RecipeItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.