From b0ec128b9125b50be0147d48e71d814b4aec5293 Mon Sep 17 00:00:00 2001
From: "Stefan E. Funk" <funk@sub.uni-goettingen.de>
Date: Thu, 5 Jan 2023 17:18:25 +0100
Subject: [PATCH] fix: add geolocation for dariah openaire

---
 .../middleware/RecordDelivererDatacite.java         | 13 ++++++-------
 .../main/webapp/WEB-INF/oaipmh.dariah.properties    |  2 +-
 .../main/webapp/WEB-INF/oaipmh.textgrid.properties  |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererDatacite.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererDatacite.java
index 4268d0a3..0ec286af 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererDatacite.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererDatacite.java
@@ -412,15 +412,13 @@ public class RecordDelivererDatacite extends RecordDelivererAbstract {
 
     for (String geoLocationField : this.oarGeoLocationFields) {
       GeoLocation geoLocation = new GeoLocation();
-      geoLocation.setGeoLocationPlace(
-          OaipmhUtilities.firstEnrtryFieldLoader(this.jsonObj, geoLocationField + DOT_VALUE));
-      geoLocations.getGeoLocation().add(geoLocation);
+      String place = OaipmhUtilities.firstEnrtryFieldLoader(this.jsonObj, geoLocationField);
+      geoLocation.setGeoLocationPlace(place);
+      if (!place.isEmpty()) {
+        geoLocations.getGeoLocation().add(geoLocation);
+      }
     }
 
-    // if (geoLocations.getGeoLocation().get(0).getGeoLocationPlace() != null) {
-    // this.resource.setGeoLocations(geoLocations);
-    // }
-
     return geoLocations;
   }
 
@@ -492,6 +490,7 @@ public class RecordDelivererDatacite extends RecordDelivererAbstract {
             relatedID.setValue(i);
           }
           // Relation type is REFERENCES for the time being (coming from dc:relation at the moment).
+          // TODO Check if we can use isPartOf for subcollections and sub objects!
           relatedID.setRelationType(RelationType.REFERENCES);
           relatedIdentifiers.getRelatedIdentifier().add(relatedID);
         }
diff --git a/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.dariah.properties b/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.dariah.properties
index 5f40dab6..53d0e0a4 100644
--- a/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.dariah.properties
+++ b/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.dariah.properties
@@ -66,7 +66,7 @@ oar.rightsFields = descriptiveMetadata.dc:rights
 oar.descriptionFields = descriptiveMetadata.dc:description
 oar.relatedIdentifierFields = descriptiveMetadata.dc:relation
 oar.geoLocationFields = descriptiveMetadata.dc:coverage
-oar.versionFields =
+oar.versionFields = administrativeMetadata.dcterms:modified
 oar.subjectFields = descriptiveMetadata.dc:subject
         
 ##########################
diff --git a/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.textgrid.properties b/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.textgrid.properties
index d8634b38..3228bbf4 100644
--- a/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.textgrid.properties
+++ b/oaipmh-webapp/src/main/webapp/WEB-INF/oaipmh.textgrid.properties
@@ -65,7 +65,7 @@ oar.formatFields = format
 oar.rightsFields = edition.license
 oar.descriptionFields = work.abstract
 oar.relatedIdentifierFields = edition.isEditionOf
-oar.geoLocationFields = edition.source.bibliographicCitation.placeOfPublication
+oar.geoLocationFields = edition.source.bibliographicCitation.placeOfPublication.value
 oar.versionFields = revision
 oar.subjectFields = work.subject
 
-- 
GitLab