Skip to content

Commit 266cf36

Browse files
authored
Merge pull request #119 from davidblasby/_ogcapi_json
Change GeoJSON to be used for f=json, add f=elastic-json for old format
2 parents dd235b3 + 8e550d5 commit 266cf36

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

modules/library/common-search/src/main/java/org/fao/geonet/common/search/GnMediaType.java

+4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ public GnMediaType(String type) {
4343
public static final String APPLICATION_GEOJSON_VALUE = "application/geo+json";
4444
public static final MediaType APPLICATION_GEOJSON;
4545

46+
public static final String APPLICATION_ELASTICJSON_VALUE = "application/gnindex+json";
47+
public static final MediaType APPLICATION_ELASTICJSON;
48+
4649

4750
static {
4851
TEXT_TURTLE = new MediaType("text", "turtle");
@@ -55,5 +58,6 @@ public GnMediaType(String type) {
5558
APPLICATION_GN_XML = new MediaType("application", "gn+xml");
5659
APPLICATION_JSON_LD = new MediaType("application", "ld+json");
5760
APPLICATION_GEOJSON = new MediaType("application", "geo+json");
61+
APPLICATION_ELASTICJSON = new MediaType("application", "gnindex+json");
5862
}
5963
}

modules/library/common-search/src/main/resources/application.yml

+8-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ gn:
6060
-
6161
name: json
6262
mimeType: application/json
63-
responseProcessor: JsonUserAndSelectionAwareResponseProcessorImpl
63+
responseProcessor: GeoJsonResponseProcessorImpl
6464
operations:
6565
- root
6666
- conformance
@@ -111,6 +111,12 @@ gn:
111111
responseProcessor: RssResponseProcessorImpl
112112
operations:
113113
- items
114+
- name : gnindex-json
115+
mimeType : application/gnindex+json
116+
responseProcessor : JsonUserAndSelectionAwareResponseProcessorImpl
117+
operations :
118+
- items
119+
- item
114120
-
115121
name : geojson
116122
mimeType : application/geo+json
@@ -130,4 +136,4 @@ gn:
130136
- "allKeywords"
131137
- "contactForResource"
132138
- "cl_status"
133-
- "edit"
139+
- "edit"

modules/services/ogc-api-records/src/main/java/org/fao/geonet/ogcapi/records/controller/ItemApiController.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ public class ItemApiController {
134134
GnMediaType.APPLICATION_RDF_XML_VALUE,
135135
GnMediaType.APPLICATION_DCAT2_XML_VALUE,
136136
GnMediaType.TEXT_TURTLE_VALUE,
137-
GnMediaType.APPLICATION_GEOJSON_VALUE})
137+
GnMediaType.APPLICATION_GEOJSON_VALUE,
138+
GnMediaType.APPLICATION_ELASTICJSON_VALUE})
138139
@ResponseStatus(HttpStatus.OK)
139140
@ApiResponses(value = {
140141
@ApiResponse(responseCode = "200", description = "Describe a collection item.")
@@ -216,6 +217,7 @@ public ResponseEntity<Void> collectionsCollectionIdItemsRecordIdGet(
216217
GnMediaType.APPLICATION_DCAT2_XML_VALUE,
217218
MediaType.TEXT_HTML_VALUE,
218219
GnMediaType.APPLICATION_GEOJSON_VALUE,
220+
GnMediaType.APPLICATION_ELASTICJSON_VALUE
219221
})
220222
@ResponseStatus(HttpStatus.OK)
221223
@ApiResponses(value = {
@@ -284,15 +286,19 @@ public ResponseEntity<Void> collectionsCollectionIdItemsGet(
284286
|| mediaType.equals(GnMediaType.APPLICATION_DCAT2_XML)
285287
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
286288
|| mediaType.equals(MediaType.APPLICATION_RSS_XML)
287-
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)) {
289+
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)
290+
|| mediaType.equals(GnMediaType.APPLICATION_ELASTICJSON)) {
288291

289292
boolean allSourceFields =
290293
mediaType.equals(GnMediaType.APPLICATION_DCAT2_XML)
291294
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
295+
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
292296
|| mediaType.equals(GnMediaType.APPLICATION_GEOJSON)
293297
|| mediaType.equals(GnMediaType.APPLICATION_JSON_LD)
294298
|| mediaType.equals(MediaType.APPLICATION_JSON)
295-
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML);
299+
|| mediaType.equals(GnMediaType.APPLICATION_RDF_XML)
300+
|| mediaType.equals(GnMediaType.APPLICATION_ELASTICJSON);
301+
296302

297303
return collectionsCollectionIdItemsGetInternal(
298304
query,

0 commit comments

Comments
 (0)