| | |
| | | public void insert(@RequestBody Highway highway) { |
| | | this.logger.debug("----- insert -----"); |
| | | |
| | | // this.highwayRepository. |
| | | this.highwayRepository.save(highway); |
| | | |
| | | this.logger.debug("Inserted: " + highway); |
| | | } |
| | |
| | | @GetMapping("/{ID}") |
| | | public Highway findById(@PathVariable("ID") Integer id) { |
| | | this.logger.debug("----- findById -----"); |
| | | Optional<Highway> highway = Optional.empty();//this.highwayRepository. |
| | | Optional<Highway> highway = this.highwayRepository.findById(id); |
| | | highway.ifPresent(h -> this.logger.debug(id+": "+h)); |
| | | return highway.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND)); |
| | | |