Package balu.pizza.webapp.services
Class IngredientService
java.lang.Object
balu.pizza.webapp.services.IngredientService
Ingredient Service
-
Constructor Summary
ConstructorDescriptionIngredientService
(IngredientRepository ingredientRepository, TypesRepository typesRepository) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(Ingredient ingredient, TypeIngredient typeIngredient) Creates a new ingredient based on the data from the formfindAll()
findById
(int ingrId) Searches for an ingredient by IDfindByPizza
(Pizza pizza) List of all ingredients by PizzafindIngredientByName
(String name) Searches for an Ingredient by Nameupdate
(Ingredient ingredient) Updates Ingredient in DB
-
Constructor Details
-
IngredientService
@Autowired public IngredientService(IngredientRepository ingredientRepository, TypesRepository typesRepository) - Parameters:
ingredientRepository
- Ingredient RepositorytypesRepository
- Type of Ingredient Repository
-
-
Method Details
-
findAll
-
findByPizza
List of all ingredients by Pizza- Parameters:
pizza
-- Returns:
- Sorted list of ingredients that are part of the pizza
-
findAllSort
- Returns:
- List of all ingredients from DB
-
findIngredientByName
Searches for an Ingredient by Name- Parameters:
name
-- Returns:
- An object that may contain a Ingredient or be empty
-
create
Creates a new ingredient based on the data from the form- Parameters:
ingredient
- ingredienttypeIngredient
- Type of ingredient- Returns:
- Saved Ingredient
-
findById
Searches for an ingredient by ID- Parameters:
ingrId
-- Returns:
- An object that may contain a Ingredient or be empty
-
update
Updates Ingredient in DB- Parameters:
ingredient
-- Returns:
- updated Ingredient
-