packageat.ac.tuwien.sepm.assignment.individual.endpoint;importat.ac.tuwien.sepm.assignment.individual.endpoint.dto.OwnerDto;importat.ac.tuwien.sepm.assignment.individual.endpoint.mapper.OwnerMapper;importat.ac.tuwien.sepm.assignment.individual.exception.NotFoundException;importat.ac.tuwien.sepm.assignment.individual.service.OwnerService;importjava.lang.invoke.MethodHandles;importorg.slf4j.Logger;importorg.slf4j.LoggerFactory;importorg.springframework.beans.factory.annotation.Autowired;importorg.springframework.http.HttpStatus;importorg.springframework.web.bind.annotation.*;importorg.springframework.web.server.ResponseStatusException;@RestController@RequestMapping(OwnerEndpoint.BASE_URL)publicclassOwnerEndpoint{staticfinalStringBASE_URL="/owners";privatestaticfinalLoggerLOGGER=LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());privatefinalOwnerServiceownerService;privatefinalOwnerMapperownerMapper;@AutowiredpublicOwnerEndpoint(OwnerServiceownerService,OwnerMapperownerMapper){this.ownerService=ownerService;this.ownerMapper=ownerMapper;}@GetMapping(value="/{id}")publicOwnerDtogetOneById(@PathVariable("id")Longid){LOGGER.info("GET "+BASE_URL+"/{}",id);try{returnownerMapper.entityToDto(ownerService.findOneById(id));}catch(NotFoundExceptione){thrownewResponseStatusException(HttpStatus.NOT_FOUND,"Error during reading owner",e);}}}