Class TypeService

java.lang.Object
balu.pizza.webapp.services.TypeService

@Service @Transactional(readOnly=true) public class TypeService extends Object
Type of ingredient Service
  • Constructor Details

    • TypeService

      @Autowired public TypeService(TypesRepository typesRepository)
      Implements repository
      Parameters:
      typesRepository - Type of ingredient Repository
  • Method Details

    • findAll

      public List<TypeIngredient> findAll()
      Searches all types
      Returns:
      List of all types from DB
    • findAllSorted

      public List<TypeIngredient> findAllSorted()
      Searches all types
      Returns:
      Sorted by id list of all types from DB
    • create

      @Transactional public TypeIngredient create(TypeIngredient type)
      Creating and saving new Type ingredient
      Parameters:
      type -
      Returns:
      saved Type
    • findByName

      public Optional<TypeIngredient> findByName(String name)
      Searches Type ingredient by name
      Parameters:
      name - Type name
      Returns:
      An object that may contain a TypeIngredient or be empty
    • findById

      public TypeIngredient findById(int id)
      Searches TypeIngredient by ID
      Parameters:
      id - type id
      Returns:
      if successful: TypeIngredient
      Throws:
      NotFoundException - If the TypeIngredient was not found
    • updateName

      @Transactional public TypeIngredient updateName(TypeIngredient type)
      Update name of TypeIngredient
      Parameters:
      type - new TypeIngredient name
      Returns:
      updated TypeIngredient