re-activated category suggestions
This commit is contained in:
parent
3b0342429f
commit
c051751e10
|
@ -31,13 +31,4 @@ public interface RecipeRepository
|
|||
|
||||
@Query(name = "Recipe.findCusines", nativeQuery = true)
|
||||
List<String> FindCuisinesNative();
|
||||
|
||||
|
||||
// final static String SQL_FIND_CATEGORIES =
|
||||
// "SELECT DISTINCT category from categories"
|
||||
// + " where category is not null and category <> ''"
|
||||
// + " ORDER BY category ASC";
|
||||
//
|
||||
// @Query(value = SQL_FIND_CATEGORIES, nativeQuery = true)
|
||||
// public List<String> findDistinctCategoryNative();
|
||||
}
|
||||
|
|
|
@ -35,13 +35,14 @@ public class RecipeService implements Serializable {
|
|||
|
||||
@Inject
|
||||
private RecipeRepository recipeRepository;
|
||||
|
||||
|
||||
public List<Recipe> findAll() {
|
||||
return recipeRepository.findAll();
|
||||
}
|
||||
|
||||
public List<Recipe> findByTitle(String searchText) {
|
||||
return recipeRepository.findByTitleContaining(searchText);
|
||||
return recipeRepository
|
||||
.findByTitleContaining(searchText);
|
||||
}
|
||||
|
||||
public Recipe findByPrimaryKey(Long recipeId) {
|
||||
|
@ -50,30 +51,28 @@ public class RecipeService implements Serializable {
|
|||
|
||||
public Recipe findDetails(Long recipeId) {
|
||||
return recipeRepository.findDetailsById(recipeId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* final String sql = "SELECT DISTINCT cuisine from recipe"
|
||||
+ " where cuisine is not null and cuisine <> ''"
|
||||
+ " ORDER BY cuisine ASC";
|
||||
* final String sql = "SELECT DISTINCT cuisine from recipe" +
|
||||
* " where cuisine is not null and cuisine <> ''" + " ORDER
|
||||
* BY cuisine ASC";
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
public List<String> findCuisines() {
|
||||
return recipeRepository.FindCuisinesNative();
|
||||
}
|
||||
|
||||
|
||||
public void save(Recipe recipe) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void delete(Recipe recipe) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
|
||||
}
|
||||
|
||||
public List<String> findShoppingCategories() {
|
||||
|
@ -81,16 +80,15 @@ public class RecipeService implements Serializable {
|
|||
return null;
|
||||
}
|
||||
|
||||
public List<String> findCategories() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@Inject
|
||||
CategoryRepository categoryRepository;
|
||||
|
||||
// /**
|
||||
// *
|
||||
// * @return All Category names that are not null/blank, sorted.
|
||||
// */
|
||||
// public List<String> findCategoryNames() {
|
||||
// return categoryRepository.findDistinctCategoryNative();
|
||||
// }
|
||||
/**
|
||||
*
|
||||
* @return All Category names that are not null/blank,
|
||||
* sorted.
|
||||
*/
|
||||
public List<String> findCategories() {
|
||||
return categoryRepository.findDistinctCategoryNative();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,13 +53,15 @@
|
|||
label="Category"
|
||||
value="#{recipeDetailBean.category}"
|
||||
tip="One or more categories, separated by commas (ex: Entree, Soup)"
|
||||
/>
|
||||
<p:commandButton
|
||||
value="<- Suggest"
|
||||
>
|
||||
<f:ajax execute="rcategory"
|
||||
<f:ajax execute="rcategory bxCat"
|
||||
listener="#{recipeDetailBean.ajaxSuggestCategory}"
|
||||
render="rcategory"
|
||||
/>
|
||||
</p:inputText>
|
||||
<p:button value="<- Suggest">
|
||||
</p:button>
|
||||
</p:commandButton>
|
||||
<p:selectOneMenu id="bxCat"
|
||||
value="#{recipeDetailBean.catToAdd}"
|
||||
tip="Recipe category suggestions, based on previous selections"
|
||||
|
@ -200,7 +202,8 @@
|
|||
<p:column label="Amt"
|
||||
style="width: 4em"
|
||||
>
|
||||
<p:inputText id="ingAmt" size="5"
|
||||
<p:inputText id="ingAmt"
|
||||
size="5"
|
||||
value="#{item.displayAmount}"
|
||||
style="text-align: right"
|
||||
rendered="#{not item.ingGroup}"
|
||||
|
@ -211,13 +214,17 @@
|
|||
style="width: 7em"
|
||||
>
|
||||
<p:inputText id="ingUnit"
|
||||
value="#{item.unit}" size="10"
|
||||
value="#{item.unit}"
|
||||
size="10"
|
||||
rendered="#{not item.ingGroup}"
|
||||
>
|
||||
</p:inputText>
|
||||
</p:column>
|
||||
<p:column label="Item" style="width: 22em">
|
||||
<p:inputText id="ingItem" size="35"
|
||||
<p:column label="Item"
|
||||
style="width: 22em"
|
||||
>
|
||||
<p:inputText id="ingItem"
|
||||
size="35"
|
||||
value="#{item.item}"
|
||||
>
|
||||
</p:inputText>
|
||||
|
@ -234,7 +241,8 @@
|
|||
</p:column>
|
||||
<p:column label="Key">
|
||||
<p:inputText id="ingKey"
|
||||
value="#{item.ingkey}" size="20"
|
||||
value="#{item.ingkey}"
|
||||
size="20"
|
||||
rendered="#{not item.ingGroup}"
|
||||
/>
|
||||
</p:column>
|
||||
|
|
Loading…
Reference in New Issue
Block a user