Package com.xffffff.wellfed.recipe
Class RecipeController
- java.lang.Object
-
- com.xffffff.wellfed.recipe.RecipeController
-
public class RecipeController extends java.lang.ObjectHandles the business logic for the Recipes
-
-
Constructor Summary
Constructors Constructor Description RecipeController(androidx.fragment.app.FragmentActivity activity)Constructor that initializes the db connection and the adapter for the recipes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddRecipe(Recipe recipe)Adds the recipe to db and notifies the adaptervoiddeleteRecipe(Recipe recipe)Requests the database to delete a Recipe and handles the resultvoideditRecipe(Recipe recipe)Requests the database to edit a Recipe and handles the resultRecipeAdaptergetRecipeAdapter()Gets the RecipeAdapter that connects the list of Recipes to the DBRecipeDBgetRecipeDB()voidsearch(java.lang.String field)voidsort(java.lang.String field)Gets the sorted query of recipes.
-
-
-
Method Detail
-
getRecipeDB
public RecipeDB getRecipeDB()
- Returns:
- recipeDB connection
-
editRecipe
public void editRecipe(Recipe recipe)
Requests the database to edit a Recipe and handles the result- Parameters:
recipe- the recipe to edit in the database
-
deleteRecipe
public void deleteRecipe(Recipe recipe)
Requests the database to delete a Recipe and handles the result- Parameters:
recipe- of the recipe to delete
-
addRecipe
public void addRecipe(Recipe recipe)
Adds the recipe to db and notifies the adapter- Parameters:
recipe- the recipe to add
-
sort
public void sort(java.lang.String field)
Gets the sorted query of recipes.- Parameters:
field- the field to sort by
-
getRecipeAdapter
public RecipeAdapter getRecipeAdapter()
Gets the RecipeAdapter that connects the list of Recipes to the DB- Returns:
- the RecipeAdapter
-
search
public void search(java.lang.String field)
-
-