/** This method is called AFTER the bean is constructed */ @PostConstruct private void init() { if (!FacesContext.getCurrentInstance().isPostback()) { // TODO: view counter ++ } // Get the recipe String value = qm.get("recipe"); if (value != null) { recipe = recipesEJB.findRecipe(Integer.parseInt(value)); } // init some fields tags = new DefaultTagCloudModel(); newComment = new Comment(); newRating = new RecipeRating(); tags = new DefaultTagCloudModel(); if (recipe != null) { this.commentModel = new LazyCommentDataModel(recipe, recipesEJB); this.totalRatings = ratingEJB.countTotalRatings(recipe); Users user = ui.getUser(); getNutritionixIngredientInfo(recipe); recipesEJB.incrementViews(recipe); // Get the recipe's tags ArrayList<Tag> tagList = new ArrayList<Tag>(recipe.getTags()); if (!tagList.isEmpty()) { ListIterator i = tagList.listIterator(); while (i.hasNext()) { Tag t = (Tag) i.next(); String url = "search.xhtml?searchArg=" + t.getTagName(); this.tags.addTag(new DefaultTagCloudItem(t.getTagName(), url, tagEJB.getWeight(t))); } } else { this.tags.addTag(new DefaultTagCloudItem("#tagMe", 1)); } // Get related recipes relatedRecipes = search.getSearchRecipes(recipe); } // end if recipe is null else { this.tags.addTag(new DefaultTagCloudItem("#tagMe", 1)); } if (ui.isIsUserAuthenticated()) { user = ui.getUser(); } }