Skip to content

Commit

Permalink
Merge pull request #119 from davidblasby/_ogcapi_json
Browse files Browse the repository at this point in the history
Change GeoJSON to be used for f=json, add f=elastic-json for old format
  • Loading branch information
davidblasby authored Oct 23, 2024
2 parents dd235b3 + 8e550d5 commit 266cf36
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public GnMediaType(String type) {
public static final String APPLICATION_GEOJSON_VALUE = "application/geo+json";
public static final MediaType APPLICATION_GEOJSON;

public static final String APPLICATION_ELASTICJSON_VALUE = "application/gnindex+json";
public static final MediaType APPLICATION_ELASTICJSON;


static {
TEXT_TURTLE = new MediaType("text", "turtle");
Expand All @@ -55,5 +58,6 @@ public GnMediaType(String type) {
APPLICATION_GN_XML = new MediaType("application", "gn+xml");
APPLICATION_JSON_LD = new MediaType("application", "ld+json");
APPLICATION_GEOJSON = new MediaType("application", "geo+json");
APPLICATION_ELASTICJSON = new MediaType("application", "gnindex+json");
}
}
10 changes: 8 additions & 2 deletions modules/library/common-search/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ gn:
-
name: json
mimeType: application/json
responseProcessor: JsonUserAndSelectionAwareResponseProcessorImpl
responseProcessor: GeoJsonResponseProcessorImpl
operations:
- root
- conformance
Expand Down Expand Up @@ -111,6 +111,12 @@ gn:
responseProcessor: RssResponseProcessorImpl
operations:
- items
- name : gnindex-json
mimeType : application/gnindex+json
responseProcessor : JsonUserAndSelectionAwareResponseProcessorImpl
operations :
- items
- item
-
name : geojson
mimeType : application/geo+json
Expand All @@ -130,4 +136,4 @@ gn:
- "allKeywords"
- "contactForResource"
- "cl_status"
- "edit"
- "edit"
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public class ItemApiController {
GnMediaType.APPLICATION_RDF_XML_VALUE,
GnMediaType.APPLICATION_DCAT2_XML_VALUE,
GnMediaType.TEXT_TURTLE_VALUE,
GnMediaType.APPLICATION_GEOJSON_VALUE})
GnMediaType.APPLICATION_GEOJSON_VALUE,
GnMediaType.APPLICATION_ELASTICJSON_VALUE})
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Describe a collection item.")
Expand Down Expand Up @@ -216,6 +217,7 @@ public ResponseEntity<Void> collectionsCollectionIdItemsRecordIdGet(
GnMediaType.APPLICATION_DCAT2_XML_VALUE,
MediaType.TEXT_HTML_VALUE,
GnMediaType.APPLICATION_GEOJSON_VALUE,
GnMediaType.APPLICATION_ELASTICJSON_VALUE
})
@ResponseStatus(HttpStatus.OK)
@ApiResponses(value = {
Expand Down Expand Up @@ -284,15 +286,19 @@ public ResponseEntity<Void> collectionsCollectionIdItemsGet(
|| mediaType.equals(GnMediaType.APPLICATION_DCAT2_XML)
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
|| mediaType.equals(MediaType.APPLICATION_RSS_XML)
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)) {
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)
|| mediaType.equals(GnMediaType.APPLICATION_ELASTICJSON)) {

boolean allSourceFields =
mediaType.equals(GnMediaType.APPLICATION_DCAT2_XML)
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)
|| mediaType.equals(GnMediaType.APPLICATION_JSON_LD)
|| mediaType.equals(MediaType.APPLICATION_JSON)
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML);
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
|| mediaType.equals(GnMediaType.APPLICATION_ELASTICJSON);


return collectionsCollectionIdItemsGetInternal(
query,
Expand Down

0 comments on commit 266cf36

Please sign in to comment.