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 08cfe1e888ac31cc91945bd2bdc837dd666b8ccd..d72e98a73277546aa6db920eca854a9b9dcd3248 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDelivererIDIOM.java @@ -67,17 +67,29 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract { public void setDatestamps(String idInDatabase) { System.out.println(idInDatabase); - + String changedId = idInDatabase; /*Client oaiESClient; Settings oaiESClusterSettings = ImmutableSettings.settingsBuilder().put("cluster.name", "tg-esx1-dev-instance").build(); oaiESClient = new TransportClient(oaiESClusterSettings).addTransportAddress(new InetSocketTransportAddress("localhost", 9202));*/ + if(idInDatabase.startsWith("textgrid:")) { + changedId = idInDatabase.substring("textgrid:".length()); + System.out.println("kill textgrid: " + changedId); + } + + if(!idInDatabase.contains(".0")) { + changedId = changedId + ".0"; + System.out.println("add .0 : " + changedId); + } + + + GetRequestBuilder recordById = OAI_ESClient.getOaiESClient() .prepareGet() .setIndex("textgrid-nonpublic") .setType(OAI_ESClient.getEsType()) .setFields(TGConstants.CREATED, TGConstants.MODIFIED_FIELD) - .setId(idInDatabase.replace("textgrid:", "") + ".0"); + .setId(changedId); System.out.println("changed id: " + idInDatabase.replace("textgrid:", "") + ".0"); @@ -88,6 +100,7 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract { System.out.println("MODIFIED_FIELD " + TGConstants.MODIFIED_FIELD); System.out.println("TYPE FROM SETTER: " + OAI_ESClient.getEsType()); System.out.println("ES_Clustername: " + OAI_ESClient.getClusterName()); + System.out.println("FIELDS: " + recordById.get().getFields()); GetResponse objectInDatabase = recordById.execute().actionGet(); diff --git a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java index dea4851e94d0c8f7785fbc2e3f37c196e4a20a4d..13ba130940c819331153c4c1d075def9f9ce713e 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java @@ -62,7 +62,7 @@ public class OaiPmhTest { // sc = new // SesameClient("http://localhost:9091/openrdf-workbench/repositories/textgrid-public"); - oaiEsClient = new OAI_ESClient("localhost", "9302", "tg-esx2-instance"); + oaiEsClient = new OAI_ESClient("localhost", "9302", "tg-esx1-dev-instance"); // oaiEsClient = new OAI_ESClient("localhost", "9302", "dariah-repository-prototype"); OAI_ESClient.setEsIndex("textgrid-public"); OAI_ESClient.setEsType("metadata"); @@ -75,6 +75,7 @@ public class OaiPmhTest { record.setWorkFields(TGConstants.TGWorkFields); recordIDIOM = new RecordDelivererIDIOM(true, false); + recordIDIOM.setOaiEsClient(oaiEsClient); recordList = new RecordListDelivererDC(true, false); @@ -237,12 +238,12 @@ public class OaiPmhTest { * @throws ParseException */ @Test - @Ignore + //@Ignore public void testGetRequestGetRecordIDIOM() throws ParseException { System.out.println("Test for the verb \"GetRecord\" with succesfull response"); JAXBElement<OAIPMHType> p = - this.request.getRequest("GetRecord", "textgrid:255sn", TGConstants.METADATA_IDIOM_PREFIX, "", "", "", ""); + this.request.getRequest("GetRecord", "textgrid:vqmx.0", TGConstants.METADATA_IDIOM_PREFIX, "", "", "", ""); JAXB.marshal(p, System.out); System.out.println("-----------------------------------\n"); }