1 | package edu.ucsb.cs156.spring.backenddemo.controllers; | |
2 | ||
3 | import org.springframework.web.bind.annotation.RestController; | |
4 | ||
5 | import edu.ucsb.cs156.spring.backenddemo.services.LocationQueryService; | |
6 | import lombok.extern.slf4j.Slf4j; | |
7 | ||
8 | import org.springframework.web.bind.annotation.GetMapping; | |
9 | import org.springframework.web.bind.annotation.RequestMapping; | |
10 | import org.springframework.web.bind.annotation.RequestParam; | |
11 | import org.springframework.beans.factory.annotation.Autowired; | |
12 | import org.springframework.http.ResponseEntity; | |
13 | ||
14 | import com.fasterxml.jackson.core.JsonProcessingException; | |
15 | import com.fasterxml.jackson.databind.ObjectMapper; | |
16 | ||
17 | import io.swagger.v3.oas.annotations.Operation; | |
18 | import io.swagger.v3.oas.annotations.Parameter; | |
19 | import io.swagger.v3.oas.annotations.tags.Tag; | |
20 | ||
21 | ||
22 | @Tag(name="Location info from USGS") | |
23 | @Slf4j | |
24 | @RestController | |
25 | @RequestMapping("/api/locations") | |
26 | public class LocationController { | |
27 | ObjectMapper mapper = new ObjectMapper(); | |
28 | ||
29 | @Autowired | |
30 | LocationQueryService locationQueryService; | |
31 | ||
32 | @Operation(summary = "Get list of locations that match a given location name", description = "Uses API documented here: https://nominatim.org/release-docs/develop/api/Search/") | |
33 | @GetMapping("/get") | |
34 | public ResponseEntity<String> getLocation( | |
35 | @Parameter(name="location", description="name to search", example="Isla Vista") @RequestParam String location | |
36 | ) throws JsonProcessingException { | |
37 | log.info("getLocation: Location={}", location); | |
38 | String result = locationQueryService.getJSON(location); | |
39 |
1
1. getLocation : replaced return value with null for edu/ucsb/cs156/spring/backenddemo/controllers/LocationController::getLocation → KILLED |
return ResponseEntity.ok().body(result); |
40 | } | |
41 | ||
42 | } | |
Mutations | ||
39 |
1.1 |