From 689ca1d47acd72d88ee0cd38bd45cf48d5c31645 Mon Sep 17 00:00:00 2001
From: "Stefan E. Funk" <funk@sub.uni-goettingen.de>
Date: Wed, 21 Sep 2022 17:46:56 +0200
Subject: [PATCH] feat: re-factor idiom image handling, use new idiom metsmods
 lib 2.0.0

---
 .../info/textgrid/middleware/IDIOMImages.java |  25 ++--
 .../IdentifierListDelivererIDIOM.java         |  25 +++-
 .../{OaiPmhClient.java => OAIPMHClient.java}  |   4 +-
 .../info/textgrid/middleware/OAIPMHImpl.java  |  17 ++-
 .../middleware/RecordDelivererIDIOM.java      | 139 +++++++-----------
 .../middleware/RecordListDelivererIDIOM.java  |   8 +-
 .../online/tg/TestClassicMayanOnline.java     |   2 +-
 .../test/online/tg/TestTGGetRecordOnline.java |   4 +-
 .../tg/TestTGListIdentifiersOnline.java       |   2 +-
 .../online/tg/TestTGListRecordsOnline.java    |   4 +-
 ...oaipmh.test.dev-textgridlab-org.properties |   8 +-
 .../src/main/webapp/WEB-INF/beans.xml         |  43 ++++--
 pom.xml                                       |   2 +-
 13 files changed, 150 insertions(+), 133 deletions(-)
 rename oaipmh-core/src/main/java/info/textgrid/middleware/{OaiPmhClient.java => OAIPMHClient.java} (94%)

diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/IDIOMImages.java b/oaipmh-core/src/main/java/info/textgrid/middleware/IDIOMImages.java
index 59ec3281..78018c03 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/IDIOMImages.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/IDIOMImages.java
@@ -21,13 +21,14 @@ import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 import org.classicmayan.tools.ImageMetsMods;
 import org.classicmayan.tools.MediaHarvester;
-import org.classicmayan.tools.TextGridUri;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
+import info.textgrid.clients.CrudClient;
 import info.textgrid.clients.tgcrud.CrudClientException;
+import info.textgrid.clients.tgcrud.TextGridObject;
 import info.textgrid.middleware.oaipmh.GetRecordType;
 import info.textgrid.middleware.oaipmh.HeaderType;
 import info.textgrid.middleware.oaipmh.ListIdentifiersType;
@@ -190,7 +191,7 @@ public class IDIOMImages implements RecordDelivererInterface, RecordListDelivere
     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
     DocumentBuilder builder;
 
-    ImageMetsMods immByTGURI = null;
+    ImageMetsMods immByTGObject = null;
 
     String changedID = id;
     if (!id.startsWith("textgrid:")) {
@@ -202,25 +203,31 @@ public class IDIOMImages implements RecordDelivererInterface, RecordListDelivere
     log.fine("tgcrud rbac sid: " + OAIPMHUtilities.hideSID(this.idiomRbacSessionID));
 
     try {
-      immByTGURI = new ImageMetsMods(this.idiomTgcrudEndpoint, this.idiomRbacSessionID,
-          new TextGridUri(changedID));
 
-      log.fine("image id/title: " + immByTGURI.getID() + " / " + immByTGURI.getTitle());
+      // Get TG-crud client.
+      CrudClient cc = new CrudClient(this.idiomTgcrudEndpoint).enableGzipCompression();
+      TextGridObject tgo =
+          cc.read().setTextgridUri(changedID).setSid(this.idiomRbacSessionID).execute();
+
+      // Get image object.
+      immByTGObject = new ImageMetsMods(tgo);
+
+      log.fine("image id/title: " + immByTGObject.getID() + " / " + immByTGObject.getTitle());
 
       builder = factory.newDocumentBuilder();
 
-      log.fine("immByTGURI: " + immByTGURI.getXML());
+      log.fine("immByTGURI: " + immByTGObject.getXML());
 
-      Document doc = builder.parse(new InputSource(new StringReader(immByTGURI.getXML())));
+      Document doc = builder.parse(new InputSource(new StringReader(immByTGObject.getXML())));
       metadataMets.setAny(doc.getDocumentElement());
       conedaKorRecord.setMetadata(metadataMets);
       if (changedID.contains(".")) {
         conedaKorRecord.setHeader(buildOAIPMHRecordHeader(
-            OAIPMHUtilities.datestampAsString(immByTGURI.getCreationDate()),
+            OAIPMHUtilities.datestampAsString(immByTGObject.getCreationDate()),
             changedID.substring(0, changedID.indexOf("."))));
       } else {
         conedaKorRecord.setHeader(buildOAIPMHRecordHeader(
-            OAIPMHUtilities.datestampAsString(immByTGURI.getCreationDate()), changedID));
+            OAIPMHUtilities.datestampAsString(immByTGObject.getCreationDate()), changedID));
       }
 
       singleImageMetsMods.setRecord(conedaKorRecord);
diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererIDIOM.java b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererIDIOM.java
index 1ac7ea37..d68d8849 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererIDIOM.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDelivererIDIOM.java
@@ -22,7 +22,7 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType;
 /**
  * @author Max Brodhun, SUB Göttingen
  * @author Stefan E. Funk, SUB Göttingen
- * @version 2022-09-13
+ * @version 2022-09-21
  */
 public class IdentifierListDelivererIDIOM extends IdentifierListDelivererAbstract {
 
@@ -34,6 +34,8 @@ public class IdentifierListDelivererIDIOM extends IdentifierListDelivererAbstrac
 
   private static Map<String, Integer> cursorCollector = new Hashtable<String, Integer>();
 
+  private RecordDelivererIDIOM idiomRecord;
+
   // **
   // CLASS
   // **
@@ -122,14 +124,13 @@ public class IdentifierListDelivererIDIOM extends IdentifierListDelivererAbstrac
         String textgridURI =
             OAIPMHUtilities.fieldLoader(new JSONObject(hit.getSourceAsMap()), "textgridUri");
 
-        RecordDelivererIDIOM idiomRecord = new RecordDelivererIDIOM(true, false);
         // IF we really do need the RecordDelivererIDIOM object here, we have to set the
         // elasticsearch client!
-        idiomRecord.setOaiEsClient(this.oaiEsClient);
+        this.idiomRecord.setOaiEsClient(this.oaiEsClient);
         // FIXME BTW: We only need ID and DATESTAMP for ListIdentifiers, WHY do we get every
         // complete RECORD??
-        identifierList.getHeader()
-            .add(idiomRecord.getRecordById(textgridURI.replace(".0", "")).getRecord().getHeader());
+        identifierList.getHeader().add(this.idiomRecord
+            .getRecordById(textgridURI.replace(".0", "")).getRecord().getHeader());
       }
 
       // Check the need for a resumption token!
@@ -167,4 +168,18 @@ public class IdentifierListDelivererIDIOM extends IdentifierListDelivererAbstrac
     return cursorCollector;
   }
 
+  /**
+   * @return
+   */
+  public RecordDelivererIDIOM getIdiomRecord() {
+    return this.idiomRecord;
+  }
+
+  /**
+   * @param idiomRecord
+   */
+  public void setIdiomRecord(RecordDelivererIDIOM idiomRecord) {
+    this.idiomRecord = idiomRecord;
+  }
+
 }
diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OaiPmhClient.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHClient.java
similarity index 94%
rename from oaipmh-core/src/main/java/info/textgrid/middleware/OaiPmhClient.java
rename to oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHClient.java
index 7e23a3af..1f4e496e 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/OaiPmhClient.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHClient.java
@@ -11,7 +11,7 @@ import org.apache.cxf.jaxrs.client.JAXRSClientFactory;
 /**
  *
  */
-public class OaiPmhClient {
+public class OAIPMHClient {
 
   private String identifier;
   private String metadataPrefix;
@@ -24,7 +24,7 @@ public class OaiPmhClient {
   /**
    * @param endpoint
    */
-  public OaiPmhClient(String endpoint) {
+  public OAIPMHClient(String endpoint) {
     this.producer = JAXRSClientFactory.create(endpoint + "/oai", OAIPMHProducer.class);
   }
 
diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java
index 99fb5f8b..915594c5 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/OAIPMHImpl.java
@@ -31,7 +31,7 @@ import info.textgrid.middleware.oaipmh.VerbType;
  * 
  * @author Maximilian Brodhun, SUB Göttingen
  * @author Stefan E. Funk, SUB Göttingen
- * @version 2022-09-20
+ * @version 2022-09-21
  * @since 2014-01-29
  */
 public class OAIPMHImpl implements OAIPMHProducer {
@@ -560,6 +560,9 @@ public class OAIPMHImpl implements OAIPMHProducer {
           recListDeliv = this.recordListDC;
         }
         if (request.getMetadataPrefix().equals(OAIPMHConstants.METADATA_IDIOM_PREFIX)) {
+
+          log.fine("  ##  creating RecordListDelivererIDIOM");
+
           recListDeliv = this.recordListIDIOM;
         }
         if (request.getMetadataPrefix().equals(OAIPMHConstants.METADATA_OPENAIRE_PREFIX)) {
@@ -577,9 +580,11 @@ public class OAIPMHImpl implements OAIPMHProducer {
           recListDeliv = this.recordListDC;
         }
         // Token is from IDIOM request.
-        else if (RecordListDelivererIDIOM.getCursorCollector() != null
-            && RecordListDelivererIDIOM.getCursorCollector()
-                .containsKey(request.getResumptionToken())) {
+        else if (RecordListDelivererIDIOM.getCursorCollector() != null && RecordListDelivererIDIOM
+            .getCursorCollector().containsKey(request.getResumptionToken())) {
+
+          log.fine("  ##  creating RecordListDelivererIDIOM restok");
+
           recListDeliv = this.recordListIDIOM;
         }
         // Token is from DATACITE request.
@@ -608,12 +613,16 @@ public class OAIPMHImpl implements OAIPMHProducer {
         }
       }
 
+      log.fine("  ##  creating ListRecordsType");
+
       ListRecordsType listRecords = recListDeliv.getRecords(
           request.getFrom(),
           request.getUntil(),
           request.getSet(),
           request.getResumptionToken());
 
+      log.fine("  ##  created ListRecordsType");
+
       if (listRecords != null) {
         oaipmhRoot.setListRecords(listRecords);
       }
diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java
index 267615b4..bbf05513 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java
@@ -24,7 +24,7 @@ import info.textgrid.middleware.oaipmh.RecordType;
 /**
  * @author Maximilian Brodhun, SUB Göttingen
  * @author Stefan E. Funk, SUB Göttingen
- * @version 2022-09-20
+ * @version 2022-09-21
  * @since 2019-03-12
  */
 @Component
@@ -32,12 +32,11 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
 
   private static Logger log = Logger.getLogger(RecordDelivererIDIOM.class.getName());
 
-  private String dateOfLastObjectModification;
-  private String objectType;
-  private String idiomRbacSessionID;
-  private String idiomTgcrudEndpoint;
+  private IDIOMImages idiomImages;
 
   RecordType record = new RecordType();
+  private String dateOfLastObjectModification;
+  private String objectType;
 
   /**
    * @param textgrid
@@ -47,46 +46,6 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
     super(textgrid, dariah);
   }
 
-  /**
-   * <p>
-   * ElasticSearch request in non-public index to get the datestamps for the object creation and
-   * last modification date in TextGridRep.
-   * </p>
-   * 
-   * @param idInDatabase
-   * @throws ParseException
-   * @throws IOException
-   */
-  public void setDatestamps(String idInDatabase) throws ParseException, IOException {
-
-    String changedId = idInDatabase;
-
-    if (idInDatabase.startsWith("textgrid:")) {
-      changedId = idInDatabase.substring("textgrid:".length());
-    }
-
-    if (!idInDatabase.contains(".0")) {
-      changedId = changedId + ".0";
-    }
-
-    log.fine("changedId: " + changedId);
-
-    JSONObject json = new JSONObject();
-    String[] fields = {TGConstants.CREATED, TGConstants.MODIFIED_FIELD, "notes"};
-
-    json = new JSONObject(OAIPMHUtilities
-        .getRcordByIDFromElasticSearch(this.oaiEsClient, changedId, fields, Strings.EMPTY_ARRAY)
-        .getSource());
-
-    this.dateOfObjectCreation =
-        OAIPMHUtilities.datestampAsString(OAIPMHUtilities.fieldLoader(json, TGConstants.CREATED));
-
-    this.dateOfLastObjectModification = OAIPMHUtilities
-        .datestampAsString(OAIPMHUtilities.fieldLoader(json, TGConstants.MODIFIED_FIELD));
-
-    this.setObjectType(OAIPMHUtilities.fieldLoader(json, "notes"));
-  }
-
   /**
    * <p>
    * Building the record XML object for the OAI-PMH response.
@@ -102,7 +61,7 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
 
     log.fine("identifier: " + id);
 
-    setDatestamps(id);
+    setDatestampsAndObjectType(id);
 
     // Get TG URI and TG base URI from ID.
     String tgURI = id;
@@ -114,13 +73,11 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
     tgBaseURI = tgBaseURI.replace(".0", "");
 
     log.fine("tg uri/base uri: " + tgURI + "/" + tgBaseURI);
-
-    log.fine("object type is: " + this.getObjectType());
-
-    log.fine(this.getObjectType() + " doc/dom: " + this.dateOfObjectCreation + "/"
+    log.fine("object type is: " + this.objectType);
+    log.fine(this.objectType + " doc/dom: " + this.dateOfObjectCreation + "/"
         + this.dateOfLastObjectModification);
 
-    if (this.getObjectType().equals("ARTEFACT")) {
+    if (this.objectType.equals("ARTEFACT")) {
 
       try {
         ClassicMayanMetsMods metsmods = new ClassicMayanMetsMods(
@@ -140,10 +97,11 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
       }
     }
 
-    else if (this.getObjectType().startsWith("ConedaKorMediumData")) {
+    else if (this.objectType.startsWith("ConedaKorMediumData")) {
+
+      log.fine("calling idiom image getRecordById()");
 
-      IDIOMImages idiomImages = new IDIOMImages(this.idiomTgcrudEndpoint, this.idiomRbacSessionID);
-      GetRecordType idi = idiomImages.getRecordById(id);
+      GetRecordType idi = this.idiomImages.getRecordById(id);
 
       // Fixes #64
       if (idi != null) {
@@ -206,50 +164,63 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
     return metadataMets;
   }
 
-  // **
-  // GETTERS & SETTERS
-  // **
-
   /**
-   * @return
+   * <p>
+   * ElasticSearch request in non-public index to get the datestamps for the object creation and
+   * last modification date in TextGridRep.
+   * </p>
+   * 
+   * @param idInDatabase
+   * @throws ParseException
+   * @throws IOException
    */
-  public String getObjectType() {
-    return this.objectType;
-  }
+  private void setDatestampsAndObjectType(String idInDatabase) throws ParseException, IOException {
 
-  /**
-   * @param objectType
-   */
-  public void setObjectType(String objectType) {
-    this.objectType = objectType;
-  }
+    String changedId = idInDatabase;
 
-  /**
-   * @return
-   */
-  public String getIdiomRbacSessionID() {
-    return this.idiomRbacSessionID;
-  }
+    if (idInDatabase.startsWith("textgrid:")) {
+      changedId = idInDatabase.substring("textgrid:".length());
+    }
 
-  /**
-   * @param idiomRbacSessionID
-   */
-  public void setIdiomRbacSessionID(String idiomRbacSessionID) {
-    this.idiomRbacSessionID = idiomRbacSessionID;
+    if (!idInDatabase.contains(".0")) {
+      changedId = changedId + ".0";
+    }
+
+    log.fine("changedId: " + changedId);
+
+    JSONObject json = new JSONObject();
+    String[] fields = {TGConstants.CREATED, TGConstants.MODIFIED_FIELD, "notes"};
+
+    json = new JSONObject(OAIPMHUtilities
+        .getRcordByIDFromElasticSearch(this.oaiEsClient, changedId, fields, Strings.EMPTY_ARRAY)
+        .getSource());
+
+    this.dateOfObjectCreation =
+        OAIPMHUtilities.datestampAsString(OAIPMHUtilities.fieldLoader(json, TGConstants.CREATED));
+
+    this.dateOfLastObjectModification = OAIPMHUtilities
+        .datestampAsString(OAIPMHUtilities.fieldLoader(json, TGConstants.MODIFIED_FIELD));
+
+    this.objectType = OAIPMHUtilities.fieldLoader(json, "notes");
   }
 
+
+  // **
+  // GETTERS & SETTERS
+  // **
+
   /**
    * @return
    */
-  public String getIdiomTgcrudEndpoint() {
-    return this.idiomTgcrudEndpoint;
+  public IDIOMImages getIdiomImages() {
+    return this.idiomImages;
   }
 
   /**
-   * @param idiomTgcrudEndpoint
+   * @param idiomImages
    */
-  public void setIdiomTgcrudEndpoint(String idiomTgcrudEndpoint) {
-    this.idiomTgcrudEndpoint = idiomTgcrudEndpoint;
+  public void setIdiomImages(IDIOMImages idiomImages) {
+    this.idiomImages = idiomImages;
   }
 
 }
diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererIDIOM.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererIDIOM.java
index 97523e4a..05bc6633 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererIDIOM.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDelivererIDIOM.java
@@ -138,6 +138,8 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
         log.fine("idi.header: " + (idi == null ? "null" : idi.getRecord().getHeader()));
 
         recordList.getRecord().add(idi.getRecord());
+
+        log.fine("record added: " + idi.getRecord().getHeader().getIdentifier());
       }
 
       // Check the need for a resumption token!
@@ -146,12 +148,12 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
       if (resTokenForResponse != null) {
         recordList.setResumptionToken(resTokenForResponse);
       }
-    } else
-
-    {
+    } else {
       setFoundItems(false);
     }
 
+    log.fine("record list size: " + recordList.getRecord().size());
+
     return recordList;
   }
 
diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestClassicMayanOnline.java b/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestClassicMayanOnline.java
index 69183aff..f574034f 100644
--- a/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestClassicMayanOnline.java
+++ b/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestClassicMayanOnline.java
@@ -18,7 +18,7 @@ import info.textgrid.middleware.IDIOMImages;
 /**
  *
  */
-@Ignore
+// @Ignore
 public class TestClassicMayanOnline {
 
   // FIXME Check ignored tests!! Do they make any sense??
diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGGetRecordOnline.java b/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGGetRecordOnline.java
index 28185505..0c10181b 100644
--- a/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGGetRecordOnline.java
+++ b/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGGetRecordOnline.java
@@ -29,10 +29,10 @@ import info.textgrid.middleware.test.online.OAIPMHUtilitiesOnline;
  * </p>
  * 
  * @author Stefan E. Funk, SUB Göttingen
- * @version 2022-09-19
+ * @version 2022-09-21
  * @since 2022-09-08
  */
-//@Ignore
+@Ignore
 public class TestTGGetRecordOnline {
 
   // **
diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGListIdentifiersOnline.java b/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGListIdentifiersOnline.java
index c60b982a..b057cd8a 100644
--- a/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGListIdentifiersOnline.java
+++ b/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGListIdentifiersOnline.java
@@ -21,7 +21,7 @@ import info.textgrid.middleware.test.online.OAIPMHUtilitiesOnline;
  * </p>
  * 
  * @author Stefan E. Funk, SUB Göttingen
- * @version 2022-09-19
+ * @version 2022-09-21
  * @since 2022-09-12
  */
 @Ignore
diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGListRecordsOnline.java b/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGListRecordsOnline.java
index e2ff02ca..8ef93995 100644
--- a/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGListRecordsOnline.java
+++ b/oaipmh-core/src/test/java/info/textgrid/middleware/test/online/tg/TestTGListRecordsOnline.java
@@ -21,10 +21,10 @@ import info.textgrid.middleware.test.online.OAIPMHUtilitiesOnline;
  * </p>
  * 
  * @author Stefan E. Funk, SUB Göttingen
- * @version 2022-09-19
+ * @version 2022-09-21
  * @since 2022-09-12
  */
- @Ignore
+// @Ignore
 public class TestTGListRecordsOnline {
 
   // **
diff --git a/oaipmh-core/src/test/resources/oaipmh.test.dev-textgridlab-org.properties b/oaipmh-core/src/test/resources/oaipmh.test.dev-textgridlab-org.properties
index 82d1854c..4d07edba 100644
--- a/oaipmh-core/src/test/resources/oaipmh.test.dev-textgridlab-org.properties
+++ b/oaipmh-core/src/test/resources/oaipmh.test.dev-textgridlab-org.properties
@@ -11,10 +11,10 @@ expectedGetRecordDATACITE = Weise Klugredenn
 checkGetRecordIDIOM = textgrid:2sg18.0
 expectedGetRecordIDIOM = Aguateca
 
-#checkGetRecordIDIOMImage = textgrid:3vcgs.0
-#expectedGetRecordIDIOMImage = Tikal, Miscellaneous Stone 13
-checkGetRecordIDIOMImage = textgrid:407sf.0
-expectedGetRecordIDIOMImage = Aguateca, Miscellaneous Text 11
+checkGetRecordIDIOMImage = textgrid:3vcgs.0
+expectedGetRecordIDIOMImage = Edzna, Hieroglyphic Stairway 1, HS.1:1-10, HS.1:45-47, HS.1:48-49
+#checkGetRecordIDIOMImage = textgrid:407sf.0
+#expectedGetRecordIDIOMImage = Acanceh, Structure 1, Stucco Frieze, Detail
 
 checkGetRecordIDList = textgrid:mq05.0, textgrid:jgv6.0, textgrid:w7rz.0, textgrid:w36b.0, textgrid:mcdv.0, textgrid:v0qx.0, textgrid:xkck.0, textgrid:t3m1.0, textgrid:10rsq.0, textgrid:mq05.0, textgrid:jgv6.0, textgrid:w7rz.0, textgrid:w36b.0, textgrid:mcdv.0, textgrid:v0qx.0, textgrid:xkck.0, textgrid:t3m1.0, textgrid:10rsq.0
 
diff --git a/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml b/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml
index ebc3ee06..9fd17263 100644
--- a/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml
+++ b/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -78,6 +78,14 @@
 		<property name="dariah" value="${dariah}" />
 	</bean>
 
+	<bean id="IDIOMImages"
+		class="info.textgrid.middleware.IDIOMImages">
+		<property name="idiomTgcrudEndpoint"
+			value="${idiomTgcrudEndpoint}" />
+		<property name="idiomRbacSessionID"
+			value="${idiomRbacSessionID}" />
+	</bean>
+
 	<!-- Define all implementing classes here, chose needed class in main config 
 		file! -->
 	<bean id="MetadataFormatListDelivererDH"
@@ -88,14 +96,6 @@
 		class="info.textgrid.middleware.MetadataFormatListDelivererTG">
 	</bean>
 
-	<bean id="IDIOMImages"
-		class="info.textgrid.middleware.IDIOMImages">
-		<property name="idiomTgcrudEndpoint"
-			value="${idiomTgcrudEndpoint}" />
-		<property name="idiomRbacSessionID"
-			value="${idiomRbacSessionID}" />
-	</bean>
-
 	<!-- Bean for verb=Identify -->
 
 	<bean id="RepIdentification"
@@ -193,10 +193,7 @@
 		<property name="oaiEsClient"
 			ref="NonpublicElasticSearchClient" />
 
-		<property name="idiomTgcrudEndpoint"
-			value="${idiomTgcrudEndpoint}" />
-		<property name="idiomRbacSessionID"
-			value="${idiomRbacSessionID}" />
+		<property name="idiomImages" ref="IDIOMImages" />
 	</bean>
 
 	<bean id="RecordDATACITE"
@@ -314,14 +311,30 @@
 		<constructor-arg index="0" value="${textgrid}" />
 		<constructor-arg index="1" value="${dariah}" />
 
-		<!-- TODO Why we don't need any property definitions here? -->
+		<property name="fields" value="${fields}" />
+		<property name="workFields" value="${workFields}" />
+		<property name="dateOfObjectCreation"
+			value="${dateOfObjectCreation}" />
+		<property name="relationToFurtherMetadataObject"
+			value="${relationToFurtherMetadataObject}" />
+		<property name="repositoryObjectURIPrefix"
+			value="${repositoryObjectURIPrefix}" />
+		<property name="modifiedField" value="${modifiedField}" />
+		<property name="identifierField" value="${identifierField}" />
+		<property name="rangeField" value="${rangeField}" />
+		<property name="formatField" value="${formatField}" />
+		<property name="formatToFilter" value="${formatToFilter}" />
+		<property name="searchResponseSize"
+			value="${searchResponseSize}" />
+		<property name="specFieldPrefix" value="${specFieldPrefix}" />
+		<property name="specField" value="${specField}" />
 
 		<property name="idiomResponseSize"
 			value="${idiomResponseSize}" />
 
-		<property name="idiomRecord" ref="RecordIDIOM" />
 		<property name="oaiEsClient"
 			ref="NonpublicElasticSearchClient" />
+		<property name="idiomRecord" ref="RecordIDIOM" />
 	</bean>
 
 	<bean id="RecordListDATACITE"
@@ -347,7 +360,6 @@
 		<property name="specFieldPrefix" value="${specFieldPrefix}" />
 		<property name="specField" value="${specField}" />
 
-		<property name="dataciteRecord" ref="RecordDATACITE" />
 		<property name="oaiEsClient" ref="ElasticSearchClient" />
 	</bean>
 
@@ -397,6 +409,7 @@
 
 		<property name="oaiEsClient"
 			ref="NonpublicElasticSearchClient" />
+		<property name="idiomRecord" ref="RecordIDIOM" />
 	</bean>
 
 	<bean id="ListIdentifierDATACITE"
diff --git a/pom.xml b/pom.xml
index 4fd43e1d..f6ab9ca1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
 		<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
 		<maven-eclipse-plugin.version>2.10</maven-eclipse-plugin.version>
 		<maven-jaxb2-plugin.version>0.14.0</maven-jaxb2-plugin.version>
-		<mets-mods-mapping.version>1.1.43-SNAPSHOT</mets-mods-mapping.version>
+		<mets-mods-mapping.version>2.0.0</mets-mods-mapping.version>
 		<package-info-maven-plugin.version>1.4.5</package-info-maven-plugin.version>
 		<properties-maven-plugin.version>1.0-alpha-2</properties-maven-plugin.version>
 		<rdf4j-repository-api.version>3.0.2</rdf4j-repository-api.version>
-- 
GitLab