| | |
| | | package de.gedoplan.seminar.jpa.exercise.rest; |
| | | |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | import org.slf4j.Logger; |
| | |
| | | * Exercise JPA_BASICS_03: Find entries by origin. |
| | | */ |
| | | @GetMapping("findByOrigin") |
| | | public Highway findByOrigin(@RequestParam(name = "origin") String origin) { |
| | | public List<Highway> findByOrigin(@RequestParam(name = "origin") String origin) { |
| | | this.logger.debug("----- findByOrigin -----"); |
| | | |
| | | Optional<Highway> highway = Optional.empty();//this.highwayRepository. |
| | | highway.ifPresent(h -> this.logger.debug(origin+": "+h)); |
| | | return highway.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); |
| | | List<Highway> highways = List.of(); //this.highwayRepository. |
| | | this.logger.debug(origin+": "+highways); |
| | | return highways; |
| | | } |
| | | |
| | | } |