Skip to content

Commit

Permalink
use extended class rather than modifying openapi.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
HavierD committed May 21, 2024
1 parent 39241f6 commit 2638080
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package au.org.aodn.ogcapi.server.core.mapper;

import au.org.aodn.ogcapi.features.model.*;
import au.org.aodn.ogcapi.server.core.model.ExtendedCollection;
import au.org.aodn.ogcapi.server.core.model.StacCollectionModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -50,7 +51,7 @@ default au.org.aodn.ogcapi.tile.model.Link getTileSchema(String hostname) {
*/
default <F extends StacCollectionModel> Collection getCollection(F m, String host) {

Collection collection = new Collection();
ExtendedCollection collection = new ExtendedCollection();
collection.setId(m.getUuid());
collection.setTitle(m.getTitle());
collection.setDescription(m.getDescription());
Expand Down Expand Up @@ -90,6 +91,10 @@ default <F extends StacCollectionModel> Collection getCollection(F m, String hos
.collect(Collectors.toList()));
}

if (m.getSummaries() != null) {
collection.setSummaries(m.getSummaries());
}

return collection;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package au.org.aodn.ogcapi.server.core.model;

import au.org.aodn.ogcapi.features.model.Collection;
import lombok.Getter;
import lombok.Setter;


/**
* This class is extended from Collection, and used to add more fields to the Collection class.
*/
@Setter
@Getter
public class ExtendedCollection extends Collection {

private SummariesModel summaries;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +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;
Expand Down

0 comments on commit 2638080

Please sign in to comment.