Package com.din.din.model.entities

Examples of com.din.din.model.entities.Recipe


       
        List<KeyEntity> sublist = entry.getValue();
        if(sublist.size() > 0) {       
          List<SelectItem> selectSublist = new ArrayList<SelectItem>();
          for(KeyEntity entity : sublist) {
            Recipe recipe = (Recipe)entity;
            SelectItem item = new SelectItem(recipe, recipe.getTitle());
            selectSublist.add(item);
          }

          group.setSelectItems(selectSublist.toArray(new SelectItem[0]));
          recipeList.add(group);
View Full Code Here


    try {
      if(!transaction.isActive()) {
        contained = true;
        transaction.begin();
      }
      Recipe recipe = new Recipe();     
      if(system == MeasurementSystem.Imperial) {
        recipe.setCategory(BeanUtil.getMessage("recipe.category.sandwiches"));
        recipe.setTitle(BeanUtil.getMessage("recipe.classicBLT"));
        recipe.setRecipeText(new Text(BeanUtil.getMessage("recipe.classicBLT.text")));
        recipe.setServes(4);
        recipe.setProject(project);
        recipe = (Recipe)save(entityManager, recipe, cache);
      } else {
        recipe.setCategory(BeanUtil.getMessage("recipe.category.entrees"));
        recipe.setTitle(BeanUtil.getMessage("recipe.potatoAndOnionOmelette"));
        recipe.setRecipeText(new Text(BeanUtil.getMessage("recipe.potatoAndOnionOmelette.text")));
        recipe.setServes(1);
        recipe.setProject(project);
        recipe.setCookingTime(new BigDecimal(10));
        recipe.setCookingTimeMeasurement(TimeMeasurement.Minutes);
        recipe = (Recipe)save(entityManager, recipe, cache)
      }
      RecipeItemDAO.createDefaultRecipeItems(entityManager, recipe, system, cache);
     
      if(contained) {
View Full Code Here

 
  @Override
  public void setSelected(Recipe selected) {
    super.setSelected(selected);
   
    final Recipe selectedSet = getSelected();
    if(selectedSet != null) {
      selectedSet.setProject(getProject());
     
      if(selectedSet.getRecipeItems() == null || selectedSet.getRecipeItems().size() == 0) {
        try {
          RecipeDAO.loadRecipeItems(selectedSet, getCache());
        } catch (Exception e) {
          Logger.getLogger(RecipeManager.class.getName()).log(Level.WARNING, "Unable to load RecipeItem list", e);
          e.printStackTrace();
View Full Code Here

    }
  }
 
  public synchronized String removeRecipe() {
    boolean success = true;
    Recipe selected = getSelected();
    if(selected != null) {
      EntityManager entityManager = EMFListener.get()
      EntityTransaction transaction = entityManager.getTransaction();
      EntityCachingManager cache = getCache();
      try {
        transaction.begin();
       
        for(RecipeItem item : selected.getRecipeItems()) {
          //RecipeItemDAO.delete(entityManager,  item, cache);
          selected = entityManager.merge(selected);
          item.setRecipe(selected);
        }
       
View Full Code Here

 
  @Override
  public synchronized String editStart() {
    String returnStr = super.editStart();
   
    Recipe selected = getSelected();   
    if(selected == null) {
      Recipe recipe = new Recipe();
      selected = recipe;
      recipe.setProject(getProject());
      recipe.setCookingTime(BigDecimal.ZERO);
    }
    getWizard().setEntity(selected);   
    return returnStr;
  }
View Full Code Here

TOP

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

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.