Package com.xffffff.wellfed.recipe
Class RecipeController
- java.lang.Object
-
- com.xffffff.wellfed.recipe.RecipeController
-
public class RecipeController extends java.lang.Object
Handles 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 void
addRecipe(Recipe recipe)
Adds the recipe to db and notifies the adaptervoid
deleteRecipe(Recipe recipe)
Requests the database to delete a Recipe and handles the resultvoid
editRecipe(Recipe recipe)
Requests the database to edit a Recipe and handles the resultRecipeAdapter
getRecipeAdapter()
Gets the RecipeAdapter that connects the list of Recipes to the DBRecipeDB
getRecipeDB()
void
search(java.lang.String field)
void
sort(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)
-
-