From 612fc353a8ed1ca0e31a2babd97fbf89739a730c Mon Sep 17 00:00:00 2001 From: HuaizhiDai Date: Tue, 21 May 2024 11:57:19 +1000 Subject: [PATCH] add summaries and status into collection --- .../src/main/resources/schema/features/openapi.yaml | 13 +++++++++++++ .../aodn/ogcapi/server/core/mapper/Converter.java | 8 ++++++++ .../core/model/enumeration/CQLCollectionsField.java | 5 ++++- .../core/model/enumeration/StacBasicField.java | 4 +++- .../core/model/enumeration/StacSummeries.java | 5 +++-- 5 files changed, 31 insertions(+), 4 deletions(-) diff --git a/features/src/main/resources/schema/features/openapi.yaml b/features/src/main/resources/schema/features/openapi.yaml index 9ffe73b4..c45746a3 100644 --- a/features/src/main/resources/schema/features/openapi.yaml +++ b/features/src/main/resources/schema/features/openapi.yaml @@ -592,6 +592,8 @@ components: type: string description: a description of the features in the collection example: An address. + summaries: + $ref: '#/components/schemas/summaries' links: type: array example: @@ -901,6 +903,17 @@ components: type: array items: type: number + summaries: + type: object + properties: + score: + type: string + description: score of the data + example: 0.8 + status: + type: string + description: status of the data + example: onGoing timeStamp: type: string description: This property indicates the time and date when the response was generated. diff --git a/server/src/main/java/au/org/aodn/ogcapi/server/core/mapper/Converter.java b/server/src/main/java/au/org/aodn/ogcapi/server/core/mapper/Converter.java index 320c1a1d..05ea3e64 100644 --- a/server/src/main/java/au/org/aodn/ogcapi/server/core/mapper/Converter.java +++ b/server/src/main/java/au/org/aodn/ogcapi/server/core/mapper/Converter.java @@ -90,6 +90,14 @@ default Collection getCollection(F m, String hos .collect(Collectors.toList())); } + if (m.getSummaries() != null) { + var summariesModel= m.getSummaries(); + Summaries summaries = new Summaries(); + summaries.setScore(String.valueOf(summariesModel.getScore())); + summaries.setStatus(summariesModel.getStatus()); + collection.setSummaries(summaries); + } + return collection; } } diff --git a/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/CQLCollectionsField.java b/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/CQLCollectionsField.java index 9048a545..c18768d9 100644 --- a/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/CQLCollectionsField.java +++ b/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/CQLCollectionsField.java @@ -15,7 +15,10 @@ public enum CQLCollectionsField { category(StacBasicField.DiscoveryCategories.searchField, StacBasicField.DiscoveryCategories.displayField), providers(StacBasicField.Providers.searchField, StacBasicField.Providers.displayField), discovery_categories(StacBasicField.DiscoveryCategories.searchField, StacBasicField.DiscoveryCategories.displayField), - id(StacBasicField.UUID.searchField, StacBasicField.UUID.displayField); + id(StacBasicField.UUID.searchField, StacBasicField.UUID.displayField), + links(StacBasicField.Links.searchField, StacBasicField.Links.displayField), + status(StacSummeries.Status.searchField, StacSummeries.Status.displayField), + ; private final String searchField; private final String displayField; diff --git a/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/StacBasicField.java b/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/StacBasicField.java index 170af7a8..ef09e79e 100644 --- a/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/StacBasicField.java +++ b/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/StacBasicField.java @@ -11,7 +11,9 @@ public enum StacBasicField { DiscoveryCategories( "discovery_categories", // This result in the whole themes section return "summaries.discovery_categories" - ); + ), + Links("links", "links") + ; public final String searchField; // Field in STAC object public final String displayField; // Field that is named externally diff --git a/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/StacSummeries.java b/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/StacSummeries.java index b730ac9f..dcac76ce 100644 --- a/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/StacSummeries.java +++ b/server/src/main/java/au/org/aodn/ogcapi/server/core/model/enumeration/StacSummeries.java @@ -10,8 +10,9 @@ public enum StacSummeries { Temporal("summaries.temporal", "extent.temporal", List.of(TemporalStart, TemporalEnd)), UpdateFrequency("summaries.update_frequency", "summaries.update_frequency"), DatasetProvider("summaries.dataset_provider", "summaries.dataset_provider"), - DatasetGroup("summaries.dataset_group", "summaries.dataset_group"); - + DatasetGroup("summaries.dataset_group", "summaries.dataset_group"), + Status("summaries.status", "summaries.status") + ; public final String searchField; public final String displayField; public final List subfields;