Package balu.pizza.webapp.services
Class TypeService
java.lang.Object
balu.pizza.webapp.services.TypeService
Type of ingredient Service
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreate
(TypeIngredient type) Creating and saving new Type ingredientfindAll()
Searches all typesSearches all typesfindById
(int id) Searches TypeIngredient by IDfindByName
(String name) Searches Type ingredient by nameupdateName
(TypeIngredient type) Update name of TypeIngredient
-
Constructor Details
-
TypeService
Implements repository- Parameters:
typesRepository
- Type of ingredient Repository
-
-
Method Details
-
findAll
Searches all types- Returns:
- List of all types from DB
-
findAllSorted
Searches all types- Returns:
- Sorted by id list of all types from DB
-
create
Creating and saving new Type ingredient- Parameters:
type
-- Returns:
- saved Type
-
findByName
Searches Type ingredient by name- Parameters:
name
- Type name- Returns:
- An object that may contain a TypeIngredient or be empty
-
findById
Searches TypeIngredient by ID- Parameters:
id
- type id- Returns:
- if successful: TypeIngredient
- Throws:
NotFoundException
- If the TypeIngredient was not found
-
updateName
Update name of TypeIngredient- Parameters:
type
- new TypeIngredient name- Returns:
- updated TypeIngredient
-