|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Inject |
|
|
|
|
CategoryRepository categoryRepository; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* |
|
|
|
|
* @return All Category names that are not null/blank, |
|
|
|
|
* sorted. |
|
|
|
|
*/ |
|
|
|
|
public List<String> findCategories() { |
|
|
|
|
// TODO Auto-generated method stub
|
|
|
|
|
return null; |
|
|
|
|
return categoryRepository.findDistinctCategoryNative(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// /**
|
|
|
|
|
// *
|
|
|
|
|
// * @return All Category names that are not null/blank, sorted.
|
|
|
|
|
// */
|
|
|
|
|
// public List<String> findCategoryNames() {
|
|
|
|
|
// return categoryRepository.findDistinctCategoryNative();
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|