diff --git a/indexer/src/main/java/au/org/aodn/esindexer/service/StacCollectionMapperService.java b/indexer/src/main/java/au/org/aodn/esindexer/service/StacCollectionMapperService.java index a222207e..547569f6 100644 --- a/indexer/src/main/java/au/org/aodn/esindexer/service/StacCollectionMapperService.java +++ b/indexer/src/main/java/au/org/aodn/esindexer/service/StacCollectionMapperService.java @@ -542,7 +542,18 @@ List mapLinks(MDMetadataType source) { linkModel.setType(Objects.equals(ciOnlineResource.getProtocol().getCharacterString().getValue().toString(), "WWW:LINK-1.0-http--link") ? "text/html" : ""); } linkModel.setHref(ciOnlineResource.getLinkage().getCharacterString().getValue().toString()); - linkModel.setRel(RelationType.RELATED.getValue()); + + // an empty string by default + linkModel.setRel(""); + + // WMS or WFS links shouldn't be displayed in the link panel) + safeGet(() -> ciOnlineResource.getProtocol().getCharacterString().getValue().toString()) + .ifPresent(protocol -> { + if (!LinkUtils.isWmsOrWfs(protocol)) { + linkModel.setRel(RelationType.RELATED.getValue()); + } + }); + linkModel.setTitle(getOnlineResourceName(ciOnlineResource)); results.add(linkModel); } diff --git a/indexer/src/main/java/au/org/aodn/esindexer/utils/LinkUtils.java b/indexer/src/main/java/au/org/aodn/esindexer/utils/LinkUtils.java new file mode 100644 index 00000000..ebfcac7f --- /dev/null +++ b/indexer/src/main/java/au/org/aodn/esindexer/utils/LinkUtils.java @@ -0,0 +1,52 @@ +package au.org.aodn.esindexer.utils; + +import java.util.Arrays; +import java.util.List; + +/** + * Protocols here are referenced from old portal project(Grails). Currently, didn't + * implement all of them. Others can be added if needed. + */ +@SuppressWarnings("unused") +public class LinkUtils { + + // protocols as reference + private final static List WMS = Arrays.asList( + "OGC:WMS-1.1.1-http-get-map", + "OGC:WMS-1.3.0-http-get-map", + "OGC:WMS", + "IMOS:NCWMS--proto" + ) ; + + private final static List WFS = Arrays.asList( + "OGC:WFS-1.0.0-http-get-capabilities", + "OGC:WFS-1.0.0-http-get-feature--shapefile", + "OGC:WFS" + ); + + private final static List DATA_FILE = Arrays.asList( + "WWW:DOWNLOAD-1.0-http--download", + "WWW:DOWNLOAD-1.0-http--downloadother", + "WWW:DOWNLOAD-1.0-http--downloaddata", + "WWW:LINK-1.0-http--downloaddata" + ); + + private final static List SUPPLEMENTARY= Arrays.asList( + "WWW:LINK-1.0-http--link", + "WWW:LINK-1.0-http--downloaddata", + "WWW:LINK-1.0-http--related", + "WWW:DOWNLOAD-1.0-ftp--download" + ); + + private final static List METADATA_RECORD = List.of( + "WWW:LINK-1.0-http--metadata-URL" + ); + + public static boolean isWmsOrWfs (String protocol) { + return protocol.startsWith("OGC:WMS") + || protocol.startsWith("OGC:WFS") + || protocol.startsWith("IMOS:NCWMS") + ; + } + +} diff --git a/indexer/src/test/resources/canned/sample10_stac.json b/indexer/src/test/resources/canned/sample10_stac.json index 9f71b1f3..a4493faa 100644 --- a/indexer/src/test/resources/canned/sample10_stac.json +++ b/indexer/src/test/resources/canned/sample10_stac.json @@ -1068,7 +1068,7 @@ }, { "href": "http://geoserver-123.aodn.org.au/geoserver/wms", - "rel": "related", + "rel": "", "type": "", "title": "imos:anmn_velocity_timeseries_map" }, diff --git a/indexer/src/test/resources/canned/sample15_stac.json b/indexer/src/test/resources/canned/sample15_stac.json index 7172fcdb..84a02772 100644 --- a/indexer/src/test/resources/canned/sample15_stac.json +++ b/indexer/src/test/resources/canned/sample15_stac.json @@ -366,13 +366,13 @@ "links": [ { "href": "https://geoserver.imas.utas.edu.au/geoserver/seamap/wfs?version=1.0.0&request=GetFeature&typeName=SeamapAus_QLD_GBRWHA_seagrass&outputFormat=SHAPE-ZIP", - "rel": "related", + "rel": "", "type": "", "title": "SHAPE-ZIP" }, { "href": "https://geoserver.imas.utas.edu.au/geoserver/seamap/wms", - "rel": "related", + "rel": "", "type": "", "title": "seamap:SeamapAus_QLD_GBRWHA_seagrass" }, diff --git a/indexer/src/test/resources/canned/sample4_stac.json b/indexer/src/test/resources/canned/sample4_stac.json index 2dabd783..7f520fc6 100644 --- a/indexer/src/test/resources/canned/sample4_stac.json +++ b/indexer/src/test/resources/canned/sample4_stac.json @@ -206,37 +206,37 @@ "title" : "NetCDF files via THREDDS catalog" }, { "href" : "http://geoserver-123.aodn.org.au/geoserver/ncwms", - "rel" : "related", + "rel" : "", "type" : "", "title" : "csiro_oa_reconstruction_url/SST" }, { "href" : "http://geoserver-123.aodn.org.au/geoserver/ncwms", - "rel" : "related", + "rel" : "", "type" : "", "title" : "csiro_oa_reconstruction_url/SSS" }, { "href" : "http://geoserver-123.aodn.org.au/geoserver/ncwms", - "rel" : "related", + "rel" : "", "type" : "", "title" : "csiro_oa_reconstruction_url/ALK" }, { "href" : "http://geoserver-123.aodn.org.au/geoserver/ncwms", - "rel" : "related", + "rel" : "", "type" : "", "title" : "csiro_oa_reconstruction_url/DIC" }, { "href" : "http://geoserver-123.aodn.org.au/geoserver/ncwms", - "rel" : "related", + "rel" : "", "type" : "", "title" : "csiro_oa_reconstruction_url/OMEGA_A" }, { "href" : "http://geoserver-123.aodn.org.au/geoserver/ncwms", - "rel" : "related", + "rel" : "", "type" : "", "title" : "csiro_oa_reconstruction_url/OMEGA_C" }, { "href" : "http://geoserver-123.aodn.org.au/geoserver/ncwms", - "rel" : "related", + "rel" : "", "type" : "", "title" : "csiro_oa_reconstruction_url/pH_T" }, { diff --git a/indexer/src/test/resources/canned/sample_multiple_temporal1_stac.json b/indexer/src/test/resources/canned/sample_multiple_temporal1_stac.json index 2fa2091c..87aead52 100644 --- a/indexer/src/test/resources/canned/sample_multiple_temporal1_stac.json +++ b/indexer/src/test/resources/canned/sample_multiple_temporal1_stac.json @@ -506,7 +506,7 @@ }, { "href": "https://geoserver.apps.aims.gov.au/aims/ows", - "rel": "related", + "rel": "", "type": "", "title": "aims:weather_data" }, @@ -518,7 +518,7 @@ }, { "href": "https://geoserver.apps.aims.gov.au/aims/wms", - "rel": "related", + "rel": "", "type": "", "title": "aims:weather_deployment" }, diff --git a/indexer/src/test/resources/canned/sample_multiple_temporal2_stac.json b/indexer/src/test/resources/canned/sample_multiple_temporal2_stac.json index 935928be..60897eee 100644 --- a/indexer/src/test/resources/canned/sample_multiple_temporal2_stac.json +++ b/indexer/src/test/resources/canned/sample_multiple_temporal2_stac.json @@ -506,7 +506,7 @@ }, { "href": "https://geoserver.apps.aims.gov.au/aims/ows", - "rel": "related", + "rel": "", "type": "", "title": "aims:weather_data" }, @@ -518,7 +518,7 @@ }, { "href": "https://geoserver.apps.aims.gov.au/aims/wms", - "rel": "related", + "rel": "", "type": "", "title": "aims:weather_deployment" },