From 41bada9d5543f752a4c9ccc39788861d9e97f6f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Tue, 30 Apr 2024 16:23:49 +0200 Subject: [PATCH 01/38] Standards / ISO19115-3 / Cleanup project specific template (#7940) Element visibility can also be configured in https://github.com/geonetwork/core-geonetwork/blob/main/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/schema-ident.xml#L129-L163 --- .../iso19115-3.2018/update-fixed-info.xsl | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/update-fixed-info.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/update-fixed-info.xsl index d29146657b6..41027c3c2d6 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/update-fixed-info.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/update-fixed-info.xsl @@ -569,29 +569,6 @@ - - - - - - - - - - - - - - - - - - - Date: Tue, 30 Apr 2024 16:32:18 +0200 Subject: [PATCH 02/38] Standard / ISO19115-3 / Ensure dqm namespace is on top of the document. Remove gts namespace which is ISO19139. (#7960) --- .../convert/ISO19139/utility/create19115-3Namespaces.xsl | 1 + .../src/main/plugin/iso19115-3.2018/layout/config-editor.xml | 1 - .../src/main/plugin/iso19115-3.2018/layout/evaluate.xsl | 1 - .../plugin/iso19115-3.2018/layout/layout-custom-fields.xsl | 1 - .../src/main/plugin/iso19115-3.2018/layout/layout.xsl | 3 +-- 5 files changed, 2 insertions(+), 5 deletions(-) diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/ISO19139/utility/create19115-3Namespaces.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/ISO19139/utility/create19115-3Namespaces.xsl index c2aa0e1cd2d..29c9fbab46e 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/ISO19139/utility/create19115-3Namespaces.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/convert/ISO19139/utility/create19115-3Namespaces.xsl @@ -54,6 +54,7 @@ + diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/config-editor.xml b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/config-editor.xml index 60341bfdd00..30d0871920a 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/config-editor.xml +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/config-editor.xml @@ -23,7 +23,6 @@ xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:mac="http://standards.iso.org/iso/19115/-3/mac/2.0" xmlns:gfc="http://standards.iso.org/iso/19110/gfc/1.1" - xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink"> diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/evaluate.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/evaluate.xsl index 09c4094c630..efb90a3012a 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/evaluate.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/evaluate.xsl @@ -22,7 +22,6 @@ xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:mac="http://standards.iso.org/iso/19115/-3/mac/2.0" xmlns:gfc="http://standards.iso.org/iso/19110/gfc/1.1" - xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/layout-custom-fields.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/layout-custom-fields.xsl index f4eae6b607d..e051138e622 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/layout-custom-fields.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/layout-custom-fields.xsl @@ -7,7 +7,6 @@ xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/2.0" xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:mrs="http://standards.iso.org/iso/19115/-3/mrs/1.0" - xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gn="http://www.fao.org/geonetwork" diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/layout.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/layout.xsl index bebe44e585c..4f807c0ecde 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/layout.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/layout.xsl @@ -18,7 +18,6 @@ xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:gfc="http://standards.iso.org/iso/19110/gfc/1.1" xmlns:gmx="http://standards.iso.org/iso/19115/-3/gmx" - xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:xlink="http://www.w3.org/1999/xlink" @@ -39,7 +38,7 @@ From 3315078b1885b9e6b6dacbd83181e41774fc1d81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Tue, 30 Apr 2024 16:45:24 +0200 Subject: [PATCH 03/38] Standard / ISO19115-3 / Feature catalogue improvements (#7919) * Standard / ISO19115-3 / Editor / Add missing namespace When creating custom editor related to feature catalogue, the `cat` namespace may be used. Error is returned when evaluating XPath: ``` Error on line 41 of evaluate.xsl: XPST0003: Static error in XPath expression supplied to saxon:evaluate: XPath syntax error at char 37 in {...rc:featureCatalogue/*/cat:n...}: Prefix cat has not been declared ``` eg. ```xml
``` Funded by Ifremer * Standard / ISO19115-3 / Formatter / Display feature catalogue simple elements * Standard / ISO19115-3 / Feature catalogue / Improve french translation. --- .../iso19115-3.2018/formatter/xsl-view/view.xsl | 15 ++------------- .../plugin/iso19115-3.2018/layout/evaluate.xsl | 1 + .../plugin/iso19115-3.2018/loc/fre/labels.xml | 6 +++--- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/xsl-view/view.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/xsl-view/view.xsl index 20687234b3c..0ec0957098b 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/xsl-view/view.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/xsl-view/view.xsl @@ -394,18 +394,6 @@ - - diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/evaluate.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/evaluate.xsl index efb90a3012a..1986d1c51ff 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/evaluate.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/layout/evaluate.xsl @@ -21,6 +21,7 @@ xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/2.0" xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:mac="http://standards.iso.org/iso/19115/-3/mac/2.0" + xmlns:cat="http://standards.iso.org/iso/19115/-3/cat/1.0" xmlns:gfc="http://standards.iso.org/iso/19110/gfc/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml/3.2" diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/loc/fre/labels.xml b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/loc/fre/labels.xml index a4d38f63adb..b17c9b295b2 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/loc/fre/labels.xml +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/loc/fre/labels.xml @@ -8814,11 +8814,11 @@ http://www.sandre.eaufrance.fr/?urn=urn:sandre:ensembledonnees:BDCarthage:FXX::: - + - + @@ -8882,7 +8882,7 @@ http://www.sandre.eaufrance.fr/?urn=urn:sandre:ensembledonnees:BDCarthage:FXX::: - + From 9429fccc2acf405fbb381451f3993553578d8eff Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Wed, 28 Feb 2024 15:50:10 +0100 Subject: [PATCH 04/38] Record view / Service / Add service type, version and coupling type. --- .../iso19115-3.2018/index-fields/index.xsl | 12 +++----- .../plugin/iso19139/index-fields/index.xsl | 12 +++----- .../resources/catalog/locales/en-core.json | 1 + .../templates/recordView/technical.html | 28 +++++++++++++++++++ 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/index-fields/index.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/index-fields/index.xsl index c2a0bd62de6..23fa0afdb68 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/index-fields/index.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/index-fields/index.xsl @@ -912,14 +912,10 @@ - - - - - + + + + diff --git a/schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl b/schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl index 77ed029bba7..37b3dc03111 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/index-fields/index.xsl @@ -879,14 +879,10 @@ - - - - - + + + + diff --git a/web-ui/src/main/resources/catalog/locales/en-core.json b/web-ui/src/main/resources/catalog/locales/en-core.json index eb02fe05434..834426eec24 100644 --- a/web-ui/src/main/resources/catalog/locales/en-core.json +++ b/web-ui/src/main/resources/catalog/locales/en-core.json @@ -87,6 +87,7 @@ "chi": "中文", "city": "City", "cl_status": "Status", + "cl_couplingType": "Coupling type", "associatedResources": "Associated resources", "brothersAndSisters": "Siblings", "moreInfoOnRecord": " more ...", diff --git a/web-ui/src/main/resources/catalog/views/default/templates/recordView/technical.html b/web-ui/src/main/resources/catalog/views/default/templates/recordView/technical.html index b55cd0de787..904d7f974db 100644 --- a/web-ui/src/main/resources/catalog/views/default/templates/recordView/technical.html +++ b/web-ui/src/main/resources/catalog/views/default/templates/recordView/technical.html @@ -22,6 +22,34 @@

{{date.type | translate}}

+
+ + + +
+

serviceType

+

+ {{mdView.current.record.serviceType}} + + ({{mdView.current.record.serviceTypeVersion}}) +

+
+
+ +
+ + + +
+

cl_couplingType

+

{{c.default}}

+
+
+
Date: Wed, 28 Feb 2024 15:50:58 +0100 Subject: [PATCH 05/38] Record view / Metadata info / Add standard name and version. --- .../default/templates/recordView/metadata.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/web-ui/src/main/resources/catalog/views/default/templates/recordView/metadata.html b/web-ui/src/main/resources/catalog/views/default/templates/recordView/metadata.html index 264c44a8b17..d7f21b3e451 100644 --- a/web-ui/src/main/resources/catalog/views/default/templates/recordView/metadata.html +++ b/web-ui/src/main/resources/catalog/views/default/templates/recordView/metadata.html @@ -25,6 +25,22 @@

metadataLanguage

+ +
+ + + +
+

documentStandard

+

+ {{mdView.current.record.standardName}} + ({{mdView.current.record.standardVersion}}) +

+
+
+ +
From e13c93be193b198372418f7b2c662fc7fce66e8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Thu, 2 May 2024 11:04:01 +0200 Subject: [PATCH 06/38] Status dashboard / Don't include indexing warnings as errors --- .../health/NoIndexErrorsHealthCheck.java | 5 +- .../js/admin/DashboardStatusController.js | 73 +++++++++++++++++-- .../resources/catalog/locales/en-admin.json | 3 +- .../main/resources/catalog/locales/en-v4.json | 2 +- .../templates/admin/dashboard/status.html | 7 +- 5 files changed, 75 insertions(+), 15 deletions(-) diff --git a/healthmonitor/src/main/java/org/fao/geonet/monitor/health/NoIndexErrorsHealthCheck.java b/healthmonitor/src/main/java/org/fao/geonet/monitor/health/NoIndexErrorsHealthCheck.java index d3afc90e4f1..3c60aa7f000 100644 --- a/healthmonitor/src/main/java/org/fao/geonet/monitor/health/NoIndexErrorsHealthCheck.java +++ b/healthmonitor/src/main/java/org/fao/geonet/monitor/health/NoIndexErrorsHealthCheck.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2023 Food and Agriculture Organization of the + * Copyright (C) 2001-2024 Food and Agriculture Organization of the * United Nations (FAO-UN), United Nations World Food Programme (WFP) * and United Nations Environment Programme (UNEP) * @@ -44,7 +44,8 @@ protected Result check() throws Exception { GeonetContext gc = (GeonetContext) context.getHandlerContext(Geonet.CONTEXT_NAME); EsSearchManager searchMan = gc.getBean(EsSearchManager.class); - long numDocs = searchMan.getNumDocs("+" + IndexFields.INDEXING_ERROR_FIELD + ":true"); + long numDocs = searchMan.getNumDocs("-" + IndexFields.INDEXING_ERROR_MSG + ".type:warning +" + + IndexFields.INDEXING_ERROR_FIELD + ":true"); if (numDocs > 0) { return Result.unhealthy(String.format("Found %d metadata that had errors during indexing", numDocs)); diff --git a/web-ui/src/main/resources/catalog/js/admin/DashboardStatusController.js b/web-ui/src/main/resources/catalog/js/admin/DashboardStatusController.js index 061890c2d84..34b80a5f072 100644 --- a/web-ui/src/main/resources/catalog/js/admin/DashboardStatusController.js +++ b/web-ui/src/main/resources/catalog/js/admin/DashboardStatusController.js @@ -67,6 +67,7 @@ $scope.threadSortReverse = false; $scope.threadInfoLoading = false; $scope.hasIndexingError = false; + $scope.hasIndexingWarning = false; $scope.indexStatus = null; function getIndexStatus() { @@ -76,21 +77,77 @@ } getIndexStatus(); - function getRecordsWithIndexingErrors() { + function getRecords(queryFilter) { return $http.post("../api/search/records/_search?bucket=ie", { - query: { - bool: { - must: { terms: { indexingError: [true] } } - } - }, + query: queryFilter, from: 0, size: 0 }); } - getRecordsWithIndexingErrors().then(function (r) { + + /** + * Get the metadata that have indexing errors (including warnings). + * + * @returns {*} + */ + function getRecordsWithIndexingErrors() { + return getRecords({ + bool: { + must: { terms: { indexingError: [true] } } + } + }); + } + + /** + * Get the metadata that have indexing errors (excluding warnings) + * + * @returns {*} + */ + function getRecordsWithIndexingErrorsNoWarnings() { + return getRecords({ + bool: { + must: [ + { + query_string: { + query: "(-indexingErrorMsg.type:warning)", + default_operator: "AND" + } + }, + { terms: { indexingError: [true] } } + ] + } + }); + } + + getRecordsWithIndexingErrorsNoWarnings().then(function (r) { $scope.hasIndexingError = r.data.hits.total.value > 0; }); + /** + * Get the metadata that have indexing warnings. + * + * @returns {*} + */ + function getRecordsWithIndexingWarnings() { + return getRecords({ + bool: { + must: [ + { + query_string: { + query: "(+indexingErrorMsg.type:warning)", + default_operator: "AND" + } + }, + { terms: { indexingError: [true] } } + ] + } + }); + } + + getRecordsWithIndexingWarnings().then(function (r) { + $scope.hasIndexingWarning = r.data.hits.total.value > 0; + }); + $scope.setThreadSortField = function (field) { if (field === $scope.threadSortField) { $scope.threadSortReverse = !$scope.threadSortReverse; @@ -270,7 +327,7 @@ configId: "recordsWithErrors", selectionBucket: "ies", defaultParams: { - "indexingErrorMsg.type": "warning", + "indexingErrorMsg.type": ["warning", "error"], sortBy: "changeDate", sortOrder: "desc" } diff --git a/web-ui/src/main/resources/catalog/locales/en-admin.json b/web-ui/src/main/resources/catalog/locales/en-admin.json index 90bc3d6b27e..fc15214f39b 100644 --- a/web-ui/src/main/resources/catalog/locales/en-admin.json +++ b/web-ui/src/main/resources/catalog/locales/en-admin.json @@ -445,8 +445,7 @@ "metadataIdentifierTemplateDeletedError": "An error occurred deleting the Metadata identifier template", "metadataInternalId": "Choose a metadata internal identifier", "metadataStatus": "Metadata information", - "metadataWithIndexingErrors": "Metadata with indexing errors", - "indexRecordsWithErrors": "Index records with errors", + "metadataWithIndexingErrors": "Metadata with indexing errors / warnings", "top10IndexingErrors": "Top 10 indexing errors:", "metadataErrorReport": "Error report", "moreExamples": "More examples", diff --git a/web-ui/src/main/resources/catalog/locales/en-v4.json b/web-ui/src/main/resources/catalog/locales/en-v4.json index 9d173a75901..9be366bb179 100644 --- a/web-ui/src/main/resources/catalog/locales/en-v4.json +++ b/web-ui/src/main/resources/catalog/locales/en-v4.json @@ -150,7 +150,7 @@ "isPublishedToAll-false": "Restricted records", "dateTypeForStatus": "Date type", "dateValueForStatus": "Date", - "indexRecordsWithErrors": "Index records with errors", + "indexRecordsWithErrors": "Index records with errors / warnings", "top10IndexingErrors": "Top 10 indexing errors:", "facet-indexingErrorMsg": "Indexing errors", "facet-indexingWarningMsg": "Indexing warnings", diff --git a/web-ui/src/main/resources/catalog/templates/admin/dashboard/status.html b/web-ui/src/main/resources/catalog/templates/admin/dashboard/status.html index 60f0827f9b5..4d894c0da85 100644 --- a/web-ui/src/main/resources/catalog/templates/admin/dashboard/status.html +++ b/web-ui/src/main/resources/catalog/templates/admin/dashboard/status.html @@ -148,10 +148,13 @@

{{info.name}}

class="form-horizontal" role="form" data-ng-search-form="" - data-ng-if="hasIndexingError" + data-ng-if="hasIndexingError || hasIndexingWarning" data-runSearch="true" > -
+
metadataWithIndexingErrors From 4ff5da2e8e990908eac33dcbdbfd60f453118b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Mon, 6 May 2024 10:40:50 +0200 Subject: [PATCH 07/38] API / Extent / Add geometry collection support. (#7911) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * API / Extent / Add geometry collection support. To make full view more consistent with the default view, add support for geometry collection to the extent API. This allows to have all bounding boxes in the same map in the side panel. eg. http://localhost:8080/geonetwork/srv/api/regions/geom.png?geomsrs=EPSG:4326&geom=GEOMETRYCOLLECTION(POINT(-32.277667%2037.291833),%20POINT(-44.949833%2023.367667),%20POINT(-31.556167%2037.841167))&width=600&strokeColor=255,255,0,255 http://localhost:8080/geonetwork/srv/api/regions/geom.png?geomsrs=EPSG:4326&geom=GEOMETRYCOLLECTION(POLYGON((10.5253%206.7632,10.5253%2023.2401,-18.3746%2023.2401,-18.3746%206.7632,10.5253%206.7632)),POLYGON((-28.8471%20-34.1253,-28.8471%205.2718,-73.9828%205.2718,-73.9828%20-34.1253,-28.8471%20-34.1253))) http://localhost:8080/geonetwork/srv/api/regions/geom.png?geomsrs=EPSG:4326&geom=GEOMETRYCOLLECTION(POINT(2.4%2048.5),POINT(29%2030),POINT(33%2033)) Also improve point visibility based on image size and add stroke/fill color parameter similar to record extent API. Follow up of https://github.com/geonetwork/core-geonetwork/pull/7882 Funded by Ifremer * Update web/src/main/webapp/WEB-INF/data/data/formatter/xslt/render-functions.xsl Co-authored-by: Jose García --------- Co-authored-by: Jose García --- .../formatter/xsl-view/view.xsl | 4 +- .../iso19139/formatter/xsl-view/view.xsl | 4 +- .../api/records/extent/MapRenderer.java | 20 +++++++-- .../api/records/extent/MetadataExtentApi.java | 8 ++-- .../fao/geonet/api/regions/RegionsApi.java | 8 +++- .../records/extent/MetadataExtentApiTest.java | 25 +++++------ .../geonet/api/regions/RegionsApiTest.java | 41 +++++++++++++++++++ .../data/formatter/xslt/render-functions.xsl | 37 +++++++++++++++++ 8 files changed, 121 insertions(+), 26 deletions(-) diff --git a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/xsl-view/view.xsl b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/xsl-view/view.xsl index 0ec0957098b..15461042dff 100644 --- a/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/xsl-view/view.xsl +++ b/schemas/iso19115-3.2018/src/main/plugin/iso19115-3.2018/formatter/xsl-view/view.xsl @@ -230,9 +230,7 @@ - - + diff --git a/schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl b/schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl index 25b56ac77cb..f9a71750d5d 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl @@ -206,9 +206,7 @@ - - + diff --git a/services/src/main/java/org/fao/geonet/api/records/extent/MapRenderer.java b/services/src/main/java/org/fao/geonet/api/records/extent/MapRenderer.java index 72d285cd9ed..63fd8125da9 100644 --- a/services/src/main/java/org/fao/geonet/api/records/extent/MapRenderer.java +++ b/services/src/main/java/org/fao/geonet/api/records/extent/MapRenderer.java @@ -35,7 +35,11 @@ import org.geotools.geometry.jts.JTS; import org.geotools.geometry.jts.ReferencedEnvelope; import org.geotools.referencing.CRS; +import org.locationtech.jts.awt.IdentityPointTransformation; +import org.locationtech.jts.awt.PointShapeFactory; +import org.locationtech.jts.awt.PointTransformation; import org.locationtech.jts.awt.ShapeWriter; +import org.locationtech.jts.geom.Coordinate; import org.locationtech.jts.geom.Envelope; import org.locationtech.jts.geom.Geometry; import org.geotools.api.metadata.extent.Extent; @@ -47,6 +51,7 @@ import java.awt.*; import java.awt.geom.AffineTransform; +import java.awt.geom.Point2D; import java.awt.image.BufferedImage; import java.util.Collection; import java.util.Map; @@ -54,6 +59,8 @@ import static java.lang.Math.pow; import static java.lang.Math.sqrt; +import static org.locationtech.jts.geom.Geometry.TYPENAME_GEOMETRYCOLLECTION; +import static org.locationtech.jts.geom.Geometry.TYPENAME_POINT; public class MapRenderer { @@ -166,7 +173,10 @@ public BufferedImage render(String id, String srs, Integer width, Integer height } } BufferedImage image; - boolean isPoint = geom.getGeometryType().equals("Point"); + boolean isPoint = geom.getGeometryType().equals(TYPENAME_POINT) + || (geom.getGeometryType().equals(TYPENAME_GEOMETRYCOLLECTION) + && geom.getNumGeometries() == 1 + && geom.getGeometryN(0).getGeometryType().equals(TYPENAME_POINT)); int pointBufferSize = 150; Envelope bboxOfImage = new Envelope(isPoint ? @@ -213,10 +223,14 @@ public BufferedImage render(String id, String srs, Integer width, Integer height if (error != null) { graphics.drawString(error.getMessage(), 0, imageDimensions.height / 2); } - ShapeWriter shapeWriter = new ShapeWriter(); - Color geomFillColor = getColor(fillColor, new Color(0, 0, 0, 50)); + + Color geomFillColor = getColor(fillColor, new Color(0, 0, 0, 30)); Color geomStrokeColor = getColor(strokeColor, new Color(0, 0, 0, 255)); AffineTransform worldToScreenTransform = worldToScreenTransform(bboxOfImage, imageDimensions); + int pointSize = 5; + ShapeWriter shapeWriter = new ShapeWriter(new IdentityPointTransformation(), + new PointShapeFactory.Circle(pointSize * bboxOfImage.getWidth() / imageDimensions.getWidth())); + for (int i = 0; i < geom.getNumGeometries(); i++) { Geometry geomExtent = MapRenderer.getGeometryExtent(geom.getGeometryN(i), srs, useGeodesicExtents); // draw each included geometry separately to ensure they are filled correctly diff --git a/services/src/main/java/org/fao/geonet/api/records/extent/MetadataExtentApi.java b/services/src/main/java/org/fao/geonet/api/records/extent/MetadataExtentApi.java index dce9ac2cddd..a1039d588bd 100644 --- a/services/src/main/java/org/fao/geonet/api/records/extent/MetadataExtentApi.java +++ b/services/src/main/java/org/fao/geonet/api/records/extent/MetadataExtentApi.java @@ -99,8 +99,8 @@ public class MetadataExtentApi { private static final String API_PARAM_WIDTH_DESCRIPTION = "(optional) width of the image that is created. Only one of width and height are permitted"; private static final String API_PARAM_HEIGHT_DESCRIPTION = "(optional) height of the image that is created. Only one of width and height are permitted"; private static final String API_PARAM_BG_DESCRIPTION = "(optional) URL for loading a background image for regions or a key that references the namedBackgrounds (configured in config-spring-geonetwork.xml). A WMS GetMap request is the typical example. The URL must be parameterized with the following parameters: minx, maxx, miny, maxy, width, height"; - private static final String API_PARAM_FILL_DESCRIPTION = "(optional) Fill color with format RED,GREEN,BLUE,ALPHA"; - private static final String API_PARAM_STROKE_DESCRIPTION = "(optional) Stroke color with format RED,GREEN,BLUE,ALPHA"; + public static final String API_PARAM_FILL_DESCRIPTION = "(optional) Fill color with format RED,GREEN,BLUE,ALPHA"; + public static final String API_PARAM_STROKE_DESCRIPTION = "(optional) Stroke color with format RED,GREEN,BLUE,ALPHA"; private static final String EXTENT_XPATH = ".//*[local-name() ='extent']/*/*[local-name() = 'geographicElement']/*"; private static final String EXTENT_DESCRIPTION_XPATH = "ancestor::*[local-name() = 'EX_Extent']/*[local-name() = 'description']/*/text()"; @@ -139,7 +139,7 @@ public HttpEntity getAllRecordExtentAsImage( @Parameter(description = API_PARAM_BG_DESCRIPTION) @RequestParam(value = BACKGROUND_PARAM, required = false, defaultValue = "settings") String background, @Parameter(description = API_PARAM_FILL_DESCRIPTION) - @RequestParam(value = "", required = false, defaultValue = "0,0,0,50") + @RequestParam(value = "", required = false, defaultValue = "0,0,0,30") String fillColor, @Parameter(description = API_PARAM_STROKE_DESCRIPTION) @RequestParam(value = "", required = false, defaultValue = "0,0,0,255") @@ -251,7 +251,7 @@ public HttpEntity getOneRecordExtentAsImage( @Parameter(description = API_PARAM_BG_DESCRIPTION) @RequestParam(value = BACKGROUND_PARAM, required = false, defaultValue = "settings") String background, @Parameter(description = API_PARAM_FILL_DESCRIPTION) - @RequestParam(value = "", required = false, defaultValue = "0,0,0,50") + @RequestParam(value = "", required = false, defaultValue = "0,0,0,30") String fillColor, @Parameter(description = API_PARAM_STROKE_DESCRIPTION) @RequestParam(value = "", required = false, defaultValue = "0,0,0,255") diff --git a/services/src/main/java/org/fao/geonet/api/regions/RegionsApi.java b/services/src/main/java/org/fao/geonet/api/regions/RegionsApi.java index 434f10a5aec..69197e66e58 100644 --- a/services/src/main/java/org/fao/geonet/api/regions/RegionsApi.java +++ b/services/src/main/java/org/fao/geonet/api/regions/RegionsApi.java @@ -226,6 +226,12 @@ public HttpEntity getGeomAsImage( @RequestParam(value = GEOM_TYPE_PARAM, defaultValue = "WKT") String geomType, @Parameter(description = "") @RequestParam(value = GEOM_SRS_PARAM, defaultValue = "EPSG:4326") String geomSrs, + @Parameter(description = API_PARAM_FILL_DESCRIPTION) + @RequestParam(value = "", required = false, defaultValue = "0,0,0,30") + String fillColor, + @Parameter(description = API_PARAM_STROKE_DESCRIPTION) + @RequestParam(value = "", required = false, defaultValue = "0,0,0,255") + String strokeColor, @Parameter(hidden = true) NativeWebRequest nativeWebRequest, @Parameter(hidden = true) @@ -268,7 +274,7 @@ public HttpEntity getGeomAsImage( } MapRenderer renderer = new MapRenderer(context); - BufferedImage image = renderer.render(regionId, srs, width, height, background, geomParam, geomType, geomSrs, null, null); + BufferedImage image = renderer.render(regionId, srs, width, height, background, geomParam, geomType, geomSrs, fillColor, strokeColor); if (image == null) return null; diff --git a/services/src/test/java/org/fao/geonet/api/records/extent/MetadataExtentApiTest.java b/services/src/test/java/org/fao/geonet/api/records/extent/MetadataExtentApiTest.java index 0d2b789d3d8..20ab40561e6 100644 --- a/services/src/test/java/org/fao/geonet/api/records/extent/MetadataExtentApiTest.java +++ b/services/src/test/java/org/fao/geonet/api/records/extent/MetadataExtentApiTest.java @@ -71,7 +71,6 @@ @ContextConfiguration(inheritLocations = true, locations = "classpath:extents-test-context.xml") public class MetadataExtentApiTest extends AbstractServiceIntegrationTest { - private static boolean DO_NOT_SAVE_IMAGE_TO_DISK = true; @Autowired private DataManager dataManager; @@ -126,7 +125,7 @@ public void getOneRecordExtentAsImage() throws Exception { .andReturn().getResponse().getContentAsByteArray(); saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName()); - assertEquals("0e7de4f5705ceb5a6c35f0d85d1fb4cd", DigestUtils.md5DigestAsHex(reponseBuffer)); + assertEquals("f4a5b9c2c6b49db0f2f5bdbefd3736aa", DigestUtils.md5DigestAsHex(reponseBuffer)); } @Test @@ -156,7 +155,8 @@ public void lastModifiedModified() throws Exception { .andExpect(content().contentType(API_PNG_EXPECTED_ENCODING)) .andReturn().getResponse().getContentAsByteArray(); - assertEquals("0e7de4f5705ceb5a6c35f0d85d1fb4cd", DigestUtils.md5DigestAsHex(reponseBuffer)); + saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName()); + assertEquals("f4a5b9c2c6b49db0f2f5bdbefd3736aa", DigestUtils.md5DigestAsHex(reponseBuffer)); } @Test @@ -173,7 +173,7 @@ public void aggregatedWithTwoExtent() throws Exception { .andReturn().getResponse().getContentAsByteArray(); saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName()); - assertEquals("b381a4e5bde396b92ba4d798980f30fb", DigestUtils.md5DigestAsHex(reponseBuffer)); + assertEquals("e8971ac1840c77b7bdc3cb026e921455", DigestUtils.md5DigestAsHex(reponseBuffer)); } @Test @@ -198,7 +198,7 @@ public void twoExtentFirstOneWithBothBoundingBoxAndPolygon() throws Exception { .andReturn().getResponse().getContentAsByteArray(); saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName() + "-1"); - assertEquals("1972e020a2955353b54035fb9328cebf", DigestUtils.md5DigestAsHex(reponseBuffer)); + assertEquals("c4818d1c164fdcbcb66ac581780423c9", DigestUtils.md5DigestAsHex(reponseBuffer)); reponseBuffer = mockMvc.perform(get(String.format("/srv/api/records/%s/extents/2.png", uuid)) .session(mockHttpSession) @@ -208,7 +208,7 @@ public void twoExtentFirstOneWithBothBoundingBoxAndPolygon() throws Exception { .andReturn().getResponse().getContentAsByteArray(); saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName() + "-2"); - assertEquals("aeab4dba0d59418fa8ec209cc6a4efa0", DigestUtils.md5DigestAsHex(reponseBuffer)); + assertEquals("87416d6291ec1d19d0635d3bf17f10b4", DigestUtils.md5DigestAsHex(reponseBuffer)); reponseBuffer = mockMvc.perform(get(String.format("/srv/api/records/%s/extents/3.png", uuid)) .session(mockHttpSession) @@ -218,7 +218,7 @@ public void twoExtentFirstOneWithBothBoundingBoxAndPolygon() throws Exception { .andReturn().getResponse().getContentAsByteArray(); saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName() + "-3"); - assertEquals("a5cd33942f207a48d230b636505318dc", DigestUtils.md5DigestAsHex(reponseBuffer)); + assertEquals("323634b78d6bc2cba92912d78401e954", DigestUtils.md5DigestAsHex(reponseBuffer)); } @@ -244,7 +244,7 @@ public void threeExtentThirdOne() throws Exception { .andReturn().getResponse().getContentAsByteArray(); saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName()); - assertEquals("df9dc5ff0300a3891d6af9ce42c1847f", DigestUtils.md5DigestAsHex(reponseBuffer)); + assertEquals("827f96a4c37ef13f0dc2c33b92196afe", DigestUtils.md5DigestAsHex(reponseBuffer)); } @Test @@ -269,7 +269,7 @@ public void threeExtentThirdOne115_3() throws Exception { .andReturn().getResponse().getContentAsByteArray(); saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName()); - assertEquals("649e43578b03e4ff74d8c0d8272da1a9", DigestUtils.md5DigestAsHex(reponseBuffer)); + assertEquals("64494e094033417a86dfd66304379d2c", DigestUtils.md5DigestAsHex(reponseBuffer)); } @Test @@ -286,7 +286,7 @@ public void threeExtentThirdOneIsABoundingBox() throws Exception { .andReturn().getResponse().getContentAsByteArray(); saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName()); - assertEquals("a5cd33942f207a48d230b636505318dc", DigestUtils.md5DigestAsHex(reponseBuffer)); + assertEquals("323634b78d6bc2cba92912d78401e954", DigestUtils.md5DigestAsHex(reponseBuffer)); } private String createTestData() throws Exception { @@ -344,8 +344,9 @@ private String createMdFromXmlRessources(Element sampleMetadataXml) throws Excep return uuid; } - private void saveImageToDiskIfConfiguredToDoSo(byte[] reponseBuffer, String methodName) throws IOException { - if (DO_NOT_SAVE_IMAGE_TO_DISK) { + public static void saveImageToDiskIfConfiguredToDoSo(byte[] reponseBuffer, String methodName) throws IOException { + boolean SAVE_IMAGE_TO_DISK = false; + if (!SAVE_IMAGE_TO_DISK) { return; } BufferedImage imag= ImageIO.read(new ByteArrayInputStream(reponseBuffer)); diff --git a/services/src/test/java/org/fao/geonet/api/regions/RegionsApiTest.java b/services/src/test/java/org/fao/geonet/api/regions/RegionsApiTest.java index 7a877488de3..bb6fb024ea9 100644 --- a/services/src/test/java/org/fao/geonet/api/regions/RegionsApiTest.java +++ b/services/src/test/java/org/fao/geonet/api/regions/RegionsApiTest.java @@ -23,17 +23,23 @@ package org.fao.geonet.api.regions; import org.fao.geonet.services.AbstractServiceIntegrationTest; +import org.junit.Rule; import org.junit.Test; +import org.junit.rules.TestName; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.mock.web.MockHttpSession; +import org.springframework.test.context.ContextConfiguration; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; +import org.springframework.util.DigestUtils; import org.springframework.web.context.WebApplicationContext; +import static org.fao.geonet.api.records.extent.MetadataExtentApiTest.saveImageToDiskIfConfiguredToDoSo; import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.hasSize; +import static org.junit.Assert.assertEquals; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; @@ -44,11 +50,15 @@ * * @author Jose García */ +@ContextConfiguration(inheritLocations = true, locations = "classpath:extents-test-context.xml") public class RegionsApiTest extends AbstractServiceIntegrationTest { @Autowired private WebApplicationContext wac; + @Rule + public TestName name = new TestName(); + private MockMvc mockMvc; private MockHttpSession mockHttpSession; @@ -81,10 +91,41 @@ public void getRegionsForType() throws Exception { .andExpect(status().isOk()) .andExpect(content().contentType(API_JSON_EXPECTED_ENCODING)) .andExpect(jsonPath("$.regions", hasSize(6))); + } + @Test + public void getMapOfMultiPoint() throws Exception { + MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + MockHttpSession mockHttpSession = loginAsAdmin(); + + byte[] reponseBuffer = mockMvc.perform(get("/srv/api/regions/geom.png?geomsrs=EPSG:4326&geom=GEOMETRYCOLLECTION(POINT(-32.277667%2037.291833),%20POINT(-44.949833%2023.367667),%20POINT(-31.556167%2037.841167))&width=600&strokeColor=255,255,0,255") + .session(mockHttpSession) + .accept(MediaType.IMAGE_PNG_VALUE)) + .andExpect(status().is2xxSuccessful()) + .andExpect(content().contentType(API_PNG_EXPECTED_ENCODING)) + .andReturn().getResponse().getContentAsByteArray(); + + saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName()); + assertEquals("3a817d8835c902dc86c65d833d9e4a55", DigestUtils.md5DigestAsHex(reponseBuffer)); + } + @Test + public void getMapOfMultiBbox() throws Exception { + MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(wac).build(); + MockHttpSession mockHttpSession = loginAsAdmin(); + + byte[] reponseBuffer = mockMvc.perform(get("/srv/api/regions/geom.png?geomsrs=EPSG:4326&geom=GEOMETRYCOLLECTION(POLYGON((10.5253%206.7632,10.5253%2023.2401,-18.3746%2023.2401,-18.3746%206.7632,10.5253%206.7632)),POLYGON((-28.8471%20-34.1253,-28.8471%205.2718,-73.9828%205.2718,-73.9828%20-34.1253,-28.8471%20-34.1253)))") + .session(mockHttpSession) + .accept(MediaType.IMAGE_PNG_VALUE)) + .andExpect(status().is2xxSuccessful()) + .andExpect(content().contentType(API_PNG_EXPECTED_ENCODING)) + .andReturn().getResponse().getContentAsByteArray(); + + saveImageToDiskIfConfiguredToDoSo(reponseBuffer, name.getMethodName()); + assertEquals("f82fa4618ad696a3561c0d4159bc5f1b", DigestUtils.md5DigestAsHex(reponseBuffer)); } + @Test public void getRegionTypes() throws Exception { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); diff --git a/web/src/main/webapp/WEB-INF/data/data/formatter/xslt/render-functions.xsl b/web/src/main/webapp/WEB-INF/data/data/formatter/xslt/render-functions.xsl index 83ce19ccb57..e9c4bb48a0f 100644 --- a/web/src/main/webapp/WEB-INF/data/data/formatter/xslt/render-functions.xsl +++ b/web/src/main/webapp/WEB-INF/data/data/formatter/xslt/render-functions.xsl @@ -29,6 +29,43 @@ else $key"/> + + + + + + + + + + + + + + + + +
+ +
+
+ + From f20b83aa23efbedfb3ea87e177a26128da882ab7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Mon, 6 May 2024 13:32:04 +0200 Subject: [PATCH 08/38] Map / Add scale. (#7967) * Map / Add scale. * Update gn_map_default.less --- .../catalog/components/viewer/ViewerDirective.js | 4 ++++ web-ui/src/main/resources/catalog/js/CatController.js | 3 ++- web-ui/src/main/resources/catalog/locales/en-v4.json | 1 + .../catalog/views/default/less/gn_map_default.less | 11 ++++++++++- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/web-ui/src/main/resources/catalog/components/viewer/ViewerDirective.js b/web-ui/src/main/resources/catalog/components/viewer/ViewerDirective.js index 2c980c5baa9..3c45168e492 100644 --- a/web-ui/src/main/resources/catalog/components/viewer/ViewerDirective.js +++ b/web-ui/src/main/resources/catalog/components/viewer/ViewerDirective.js @@ -496,6 +496,10 @@ setTimeout(function () { scope.map.updateSize(); }, 300); + + if (gnViewerSettings.mapConfig.disabledTools.scaleLine === false) { + scope.map.addControl(new ol.control.ScaleLine()); + } } }; } diff --git a/web-ui/src/main/resources/catalog/js/CatController.js b/web-ui/src/main/resources/catalog/js/CatController.js index 974d772ffb0..e08a07cae1f 100644 --- a/web-ui/src/main/resources/catalog/js/CatController.js +++ b/web-ui/src/main/resources/catalog/js/CatController.js @@ -827,7 +827,8 @@ graticule: false, mousePosition: true, syncAllLayers: false, - drawVector: false + drawVector: false, + scaleLine: false }, defaultTool: "layers", defaultToolAfterMapLoad: "layers", diff --git a/web-ui/src/main/resources/catalog/locales/en-v4.json b/web-ui/src/main/resources/catalog/locales/en-v4.json index 9be366bb179..c1cb282d849 100644 --- a/web-ui/src/main/resources/catalog/locales/en-v4.json +++ b/web-ui/src/main/resources/catalog/locales/en-v4.json @@ -414,6 +414,7 @@ "application/vnd.geo+json": "GeoJSON", "application/json": "JSON", "shape-zip": "ESRI Shapefile", + "scaleLineTool": "Map scale", "text/xml; subtype=gml/2.1.2": "GML 2.1.2", "text/xml; subtype=gml/3.1.1": "GML 3.1.1", "text/xml; subtype=gml/3.2": "GML 3.2", diff --git a/web-ui/src/main/resources/catalog/views/default/less/gn_map_default.less b/web-ui/src/main/resources/catalog/views/default/less/gn_map_default.less index b407d7c683e..3fff351c769 100644 --- a/web-ui/src/main/resources/catalog/views/default/less/gn_map_default.less +++ b/web-ui/src/main/resources/catalog/views/default/less/gn_map_default.less @@ -37,8 +37,8 @@ } .ol-attribution { .gn-attribution(); - bottom: 1em; left: 1em; + bottom: 1em; button { background-color: @brand-primary; } @@ -48,6 +48,15 @@ } } + .ol-scale-line { + bottom: 1em; + left: 180px; + @media screen and (max-height: 768px) { + left: auto; + right: 180px; + } + } + .panel-tools { .panel-heading { background-color: transparent; From c55d4c1414c967272ffb09f44ca8001d2cf9872a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Mon, 6 May 2024 15:00:41 +0200 Subject: [PATCH 09/38] ISO19139 metadata full view / display citation titles (#8003) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * ISO19139 metadata full view / display citation titles. Additionally, improve the specification title label. * Update schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl Co-authored-by: François Prunayre --------- Co-authored-by: François Prunayre --- .../main/plugin/iso19139/formatter/xsl-view/view.xsl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl b/schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl index f9a71750d5d..0015ecd785f 100644 --- a/schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl +++ b/schemas/iso19139/src/main/plugin/iso19139/formatter/xsl-view/view.xsl @@ -88,7 +88,7 @@ @@ -342,7 +342,7 @@
- +
@@ -439,7 +439,7 @@
- +
@@ -655,7 +655,7 @@
- + @@ -1068,7 +1068,7 @@ - + @@ -1084,7 +1084,7 @@ - + From 523f4fc88798e6a3762e2a9654a6e56232f2b209 Mon Sep 17 00:00:00 2001 From: Jody Garnett Date: Mon, 6 May 2024 07:39:01 -0700 Subject: [PATCH 10/38] Merge pull request from GHSA-52rf-25hq-5m33 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * EsHTTProxy header allow list configuration option * Simplify EsHTTPProxy header class with streams * Update web/src/main/webResources/WEB-INF/config.properties Co-authored-by: Juan Luis Rodríguez Ponce * Update services/src/main/java/org/fao/geonet/api/es/EsHTTPProxy.java Co-authored-by: Juan Luis Rodríguez Ponce --------- Co-authored-by: Jose García Co-authored-by: Juan Luis Rodríguez Ponce --- .../org/fao/geonet/api/es/EsHTTPProxy.java | 74 ++++++++++--------- .../webResources/WEB-INF/config.properties | 3 + 2 files changed, 42 insertions(+), 35 deletions(-) diff --git a/services/src/main/java/org/fao/geonet/api/es/EsHTTPProxy.java b/services/src/main/java/org/fao/geonet/api/es/EsHTTPProxy.java index 62b99fcae25..a2a0cd1bcb2 100644 --- a/services/src/main/java/org/fao/geonet/api/es/EsHTTPProxy.java +++ b/services/src/main/java/org/fao/geonet/api/es/EsHTTPProxy.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001-2023 Food and Agriculture Organization of the + * Copyright (C) 2018-2024 Food and Agriculture Organization of the * United Nations (FAO-UN), United Nations World Food Programme (WFP) * and United Nations Environment Programme (UNEP) * @@ -98,6 +98,11 @@ @Tag(name = "search", description = "Proxy for Elasticsearch catalog search operations") @Controller +/** + * Proxy from GeoNetwork {@code /{portal}}/api} to Elasticsearch service. + * + * The portal and privileges are included the search provided by the user. + */ public class EsHTTPProxy { public static final String[] _validContentTypes = { "application/json", "text/plain" @@ -134,6 +139,14 @@ public class EsHTTPProxy { @Value("${es.password}") private String password; + @Value("${es.proxy.headers:content-type,content-encoding,transfer-encoding}") + private String[] proxyHeadersAllowedList; + + /** + * Ignore list of headers handled by proxy implementation directly. + */ + private String[] proxyHeadersIgnoreList = {"Content-Length"}; + @Autowired private EsRestClient client; @@ -599,7 +612,7 @@ private void handleRequest(ServiceContext context, } // copy headers from the remote server's response to the response to send to the client - copyHeadersFromConnectionToResponse(response, connectionWithFinalHost, "Content-Length"); + copyHeadersFromConnectionToResponse(response, connectionWithFinalHost, proxyHeadersIgnoreList); if (!contentType.split(";")[0].equals("application/json")) { addPermissions = false; @@ -746,44 +759,35 @@ private String getContentEncoding(Map> headerFields) { private void copyHeadersFromConnectionToResponse(HttpServletResponse response, HttpURLConnection uc, String... ignoreList) { Map> map = uc.getHeaderFields(); for (String headerName : map.keySet()) { - - if (!isInIgnoreList(headerName, ignoreList)) { - - // concatenate all values from the header - List valuesList = map.get(headerName); - StringBuilder sBuilder = new StringBuilder(); - valuesList.forEach(sBuilder::append); - - // add header to HttpServletResponse object - if (headerName != null) { - if ("Transfer-Encoding".equalsIgnoreCase(headerName) && "chunked".equalsIgnoreCase(sBuilder.toString())) { - // do not write this header because Tomcat already assembled the chunks itself - continue; - } - response.addHeader(headerName, sBuilder.toString()); - } + if (headerName == null) { + continue; } + if (Arrays.stream(ignoreList).anyMatch(headerName::equalsIgnoreCase)) { + // Ignore list reflects headers that are handled by ESHTTPProxy directly + continue; + } + if (Arrays.stream(proxyHeadersAllowedList).noneMatch(headerName::equalsIgnoreCase)) { + // Allow list is provided as a configuration option and may need to be adjusted + // as Elasticsearch API changes over time. + continue; + } + // concatenate all values from the header + List valuesList = map.get(headerName); + StringBuilder sBuilder = new StringBuilder(); + valuesList.forEach(sBuilder::append); + + if ("Transfer-Encoding".equalsIgnoreCase(headerName) && "chunked".equalsIgnoreCase(sBuilder.toString())) { + // do not write this header + value because Tomcat already assembled the chunks itself + continue; + } + // add header to HttpServletResponse object + response.addHeader(headerName, sBuilder.toString()); } } /** - * Helper function to detect if a specific header is in a given ignore list - * - * @return true: in, false: not in - */ - private boolean isInIgnoreList(String headerName, String[] ignoreList) { - if (headerName == null) return false; - - for (String headerToIgnore : ignoreList) { - if (headerName.equalsIgnoreCase(headerToIgnore)) - return true; - } - return false; - } - - /** - * Copy client's headers in the request to send to the final host - * Trick the host by hiding the proxy indirection and keep useful headers information + * Copy client's headers in the request to send to the final host. + * Trick the host by hiding the proxy indirection and keep useful headers information. * * @param uc Contains now headers from client request except Host */ diff --git a/web/src/main/webResources/WEB-INF/config.properties b/web/src/main/webResources/WEB-INF/config.properties index 5e32be30320..6e53082b1fe 100644 --- a/web/src/main/webResources/WEB-INF/config.properties +++ b/web/src/main/webResources/WEB-INF/config.properties @@ -37,6 +37,9 @@ kb.url=${kb.url} es.index.checker.interval=0/5 * * * * ? +# Headers allowed for the portal/search proxy to Elasticsearch +es.proxy.headers=content-type,content-encoding,transfer-encoding + jms.url=${jms.url} # If using a scaled environment with more than one node, From c8bc70f1331a521355501d0b1c1b06d7bd2da353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Tue, 14 May 2024 08:32:43 +0200 Subject: [PATCH 11/38] Search tab map is blank on first page load. Fixes #7961 (#8026) --- .../main/resources/catalog/views/default/module.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web-ui/src/main/resources/catalog/views/default/module.js b/web-ui/src/main/resources/catalog/views/default/module.js index 405c5d3e0b7..11568e19645 100644 --- a/web-ui/src/main/resources/catalog/views/default/module.js +++ b/web-ui/src/main/resources/catalog/views/default/module.js @@ -495,6 +495,17 @@ setActiveTab(); $scope.$on("$locationChangeSuccess", setActiveTab); + $scope.$on("$locationChangeSuccess", function (next, current) { + if ( + gnSearchLocation.isSearch() && + (!angular.isArray(searchMap.getSize()) || searchMap.getSize()[0] < 0) + ) { + setTimeout(function () { + searchMap.updateSize(); + }, 0); + } + }); + var sortConfig = gnSearchSettings.sortBy.split("#"); angular.extend($scope.searchObj, { advancedMode: false, From a79641b751dcbb9343d0155b8a35dcb9e9ac9696 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Garc=C3=ADa?= Date: Tue, 14 May 2024 08:36:16 +0200 Subject: [PATCH 12/38] Map viewer / ESRIREST layers / Scale the layer extent to show the symbology of the features in the corners of the extent. (#8027) Fixes #8025 --- .../components/common/map/mapService.js | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/web-ui/src/main/resources/catalog/components/common/map/mapService.js b/web-ui/src/main/resources/catalog/components/common/map/mapService.js index b54b66474ee..2d27ae3dfbe 100644 --- a/web-ui/src/main/resources/catalog/components/common/map/mapService.js +++ b/web-ui/src/main/resources/catalog/components/common/map/mapService.js @@ -1835,13 +1835,25 @@ .then(function (results) { var layerInfo = results[0]; var legendUrl = results[1]; + + var layerExtent; + + // Scale the layer extent. See https://github.com/geonetwork/core-geonetwork/issues/8025 + if (layerInfo.extent) { + layerExtent = [ + layerInfo.extent.xmin, + layerInfo.extent.ymin, + layerInfo.extent.xmax, + layerInfo.extent.ymax + ]; + + var geomExtent = ol.geom.Polygon.fromExtent(layerExtent); + geomExtent.scale(1.1); + layerExtent = geomExtent.getExtent(); + } + var extent = layerInfo.extent - ? [ - layerInfo.extent.xmin, - layerInfo.extent.ymin, - layerInfo.extent.xmax, - layerInfo.extent.ymax - ] + ? layerExtent : map.getView().calculateExtent(); if ( layerInfo.extent && From 7ccd91d66019c46f8baffd9edce726f55288508f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Prunayre?= Date: Wed, 15 May 2024 13:43:53 +0200 Subject: [PATCH 13/38] Mail / Log / Remove debug level Avoid displaying mail server configuration and other detailed information in the log. ``` DEBUG: JavaMail version 1.5.6 DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers ... ``` --- core/src/main/java/org/fao/geonet/util/MailUtil.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/core/src/main/java/org/fao/geonet/util/MailUtil.java b/core/src/main/java/org/fao/geonet/util/MailUtil.java index fc0c743c6fe..517a292b99f 100644 --- a/core/src/main/java/org/fao/geonet/util/MailUtil.java +++ b/core/src/main/java/org/fao/geonet/util/MailUtil.java @@ -364,9 +364,6 @@ private static void configureBasics(String hostName, Integer smtpPort, email.setAuthenticator(new DefaultAuthenticator(username, password)); } - - email.setDebug(true); - if (tls != null && tls) { email.setStartTLSEnabled(tls); email.setStartTLSRequired(tls); From 57d2690b9d995327c2c2e2b150277ee5e7f51bde Mon Sep 17 00:00:00 2001 From: Francois Prunayre Date: Mon, 29 Apr 2024 15:52:36 +0200 Subject: [PATCH 14/38] Editor / Add custom element in distribution and associated record directive MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the possibility to add custom elements in the panel of `data-gn-distribution-resources-panel` or `data-gn-associated-resources-panel`. Common use case is to add explanatory text or add action for shortcuts eg. ```xml
A specific representation of a dataset. A dataset might be available in multiple serializations that may differ in various ways, including natural language, media-type or format, schematic organization, temporal and spatial resolution, level of detail or profiles (which might specify any or all of the above).
``` Also add support for `${uuid}` placeholder in snippet to dynamically create snippet for current record. --- schemas/config-editor.xsd | 19 +++++++++++++ .../metadataactions/RelatedDirective.js | 2 ++ .../partials/associatedResourcesPanel.html | 3 +-- .../partials/distributionResourcesPanel.html | 3 +-- .../webapp/xslt/ui-metadata/edit/edit.xsl | 21 ++++++++------- .../webapp/xslt/ui-metadata/form-builder.xsl | 27 ++++++++++++++----- .../xslt/ui-metadata/form-configurator.xsl | 4 +++ 7 files changed, 59 insertions(+), 20 deletions(-) diff --git a/schemas/config-editor.xsd b/schemas/config-editor.xsd index c3a97def85a..c648ad2739a 100644 --- a/schemas/config-editor.xsd +++ b/schemas/config-editor.xsd @@ -2164,6 +2164,19 @@ An XML snippet with replacement for each key defined in that field. +A snippet can also contains a `${uuid}` placeholder to be replaced when added to the form. +This can allow to build dynamic snippet based on the current record. + +.. code-block:: xml + +