diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/DublinCoreFieldLoader.java b/oaipmh-core/src/main/java/info/textgrid/middleware/DublinCoreFieldLoader.java index 77e012119e403a71fb921a649eefe3b2e937d073..81c7dcd2c89ae106b105849146c8709f49de8832 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/DublinCoreFieldLoader.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/DublinCoreFieldLoader.java @@ -89,8 +89,7 @@ public class DublinCoreFieldLoader { public static List<String> setCoverage(GetResponse responseWorkValues, String[] values) { if(responseWorkValues.isExists()){ for (String field : values) { - System.out.println("fieldname: " + field); - System.out.println(responseWorkValues.isExists()); + if (responseWorkValues.getField(field) != null) { coverages.add(responseWorkValues.getField(field).getValue().toString()); } @@ -120,19 +119,19 @@ public class DublinCoreFieldLoader { for (String field : values) { try { // FIXME DO SET VALUES VIA CONFIG FILE! - System.out.println("fieldname: "+ field); + if (responseWorkValues.getField(field) != null) { dates.add(OAIPMHUtillities.convertDateFormat(responseWorkValues.getField(field).getValue() .toString()).toXMLFormat()); } } catch (ParseException e) { - System.out.println("fieldname: "+ field); + // FIXME DO NOT USE INVALID DATE HERE! dates.add(responseWorkValues.getField(field).getValue().toString()); log.debug(e); } catch (DatatypeConfigurationException e) { - System.out.println("fieldname: "+ field); + // FIXME DO NOT USE INVALID DATE HERE! dates.add(responseWorkValues.getField(field).getValue().toString()); log.debug(e); diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java index 0afdb2df4724ddf179a3be940ac4a16697838096..2561b647de2ac90b7b8c9749fc95dda322ca508d 100644 --- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java +++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java @@ -198,16 +198,15 @@ public class RecordListDeliverer { // is in an other object than just the edition // TextGrid search! - if (this.textgrid == true && hit.getFields().get(formatField).values() .get(0).toString().equals(formatToFilter)) { - System.out.println("textgriduri is: " + hit.getId()); + String workUri = hit.getFields().get(this.relationToFurtherMetadataObject).values().get(0).toString() .substring(this.repositoryObjectURIPrefix.length()); if (!workUri.endsWith(".0")) { workUri = workUri.concat(".0"); - System.out.println("workuri is: " + workUri); + } putContentIntoDCFieldLists(hit, furtherDCElements(workUri, this.oaiEsClient)); @@ -235,7 +234,6 @@ public class RecordListDeliverer { */ public void putContentIntoDCFieldLists(SearchHit hit, GetResponse responseWorkValues) { - System.out.println("Check"); this.contributors = DublinCoreFieldLoader.setContributor(hit,this.contributorList); this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,this.coverageList); this.creators = DublinCoreFieldLoader.setCreator(responseWorkValues,this.creatorList); @@ -296,8 +294,6 @@ public class RecordListDeliverer { setDCObject(odt, of); - System.out.println("build Records"); - if (!this.identifiers.isEmpty()) { recordHeader.setIdentifier(this.identifiers.get(0)); } @@ -337,8 +333,6 @@ public class RecordListDeliverer { String queryField = ""; String valueField = ""; - System.out.println("set: " + set); - if (this.dariah == true) { /* * COLLECTIONREGISTRY_NAMESPACE is the name of the set Category @@ -349,8 +343,6 @@ public class RecordListDeliverer { valueField = set; // setParts[1] = setParts[1].concat(":" + setParts[2]); - System.out.println("queryField: " + queryField); - System.out.println("valueField: " + valueField); // System.out.println(setParts[0] + " : " + setParts[1]); } @@ -361,9 +353,6 @@ public class RecordListDeliverer { queryField = "project.value"; valueField = setParts[1]; // setParts[0] = setParts[0].concat(".value"); - - System.out.println("queryField: " + queryField); - System.out.println("valueField: " + valueField); } } 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 5ef947dcf588fe26bd0300fe60a0fa83b6af99c9..445f1a7d6ab6b2cae4e8f7ba1b9e0949aabc965a 100644 --- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java +++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java @@ -36,8 +36,8 @@ public class OaiPmhTest { private RecordDeliverer record = new RecordDeliverer(oaiEsClient, DARIAHConstants.DARIAHFields, false, true); private RecordListDeliverer recordList = new RecordListDeliverer( - oaiEsClient, DARIAHConstants.DARIAHFields, - DARIAHConstants.DARIAHCollectionFields, false, true); + oaiEsClient,TGConstants.TGFields, + TGConstants.TGWorkFields, true, false); private boolean textgrid; private boolean dariah; // private RecordListDeliverer recordList = new @@ -64,7 +64,7 @@ public class OaiPmhTest { // "dariah-repository-prototype"); oaiEsClient = new OAI_ESClient("localhost", 9302, - "esx-1-test-instance"); + "tg-esx2-instance"); oaiEsClient.setEsIndex("textgrid-public"); oaiEsClient.setEsType("metadata"); //oaiEsClient.setEsIndex("dariahreptest"); @@ -232,8 +232,7 @@ public class OaiPmhTest { this.record.setIdentifiers(DARIAHConstants.IDENTIFIER_LIST); this.record.setLanguages(DARIAHConstants.LANGUAGE_LIST); this.record.setPublishers(DARIAHConstants.PUBLISHER_LIST); - this.record.setRelations(DARIAHConstants.RELATIONS_LIST); - // record.setRelationsForWork(DARIAHConstants.RELATIONS_FOR_WORK_LIST); + this.record.setRelations(DARIAHConstants.RELATIONS_LIST); this.record.setRights(DARIAHConstants.RIGHTS_LIST); this.record.setSources(DARIAHConstants.SOURCE_LIST); this.record.setSubjects(DARIAHConstants.SUBJECT_LIST); @@ -243,15 +242,11 @@ public class OaiPmhTest { this.record.setFormatField(DARIAHConstants.FORMAT); this.record.setFormatToFilter("metadata"); this.record.setDateOfObjectCreation(DARIAHConstants.CREATED); - // record.setRelationToFurtherMetadataObject(DARIAHConstants.EDITION_ISEDITIONOF); - this.record - .setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); + this.record.setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX); this.record.setIdentifierField("metadata.dc:identifier"); - System.out - .println("Test for the verb \"GetRecord\" with succesfull response"); - JAXBElement<OAIPMHType> p = this.request.getRequest("GetRecord", - "hdl:11022/0000-0000-46FE-4", "oai_dc", "", "", "", ""); + System.out.println("Test for the verb \"GetRecord\" with succesfull response"); + JAXBElement<OAIPMHType> p = this.request.getRequest("GetRecord","hdl:11022/0000-0000-46FE-4", "oai_dc", "", "", "", ""); JAXB.marshal(p, System.out); System.out.println("-----------------------------------\n"); } @@ -331,8 +326,7 @@ public class OaiPmhTest { this.recordList.setLanguages(TGConstants.LANGUAGE_LIST); this.recordList.setPublishers(TGConstants.PUBLISHER_LIST); this.recordList.setRelations(TGConstants.RELATIONS_LIST); - this.recordList - .setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); + this.recordList.setRelationsForWork(TGConstants.RELATIONS_FOR_WORK_LIST); this.recordList.setRights(TGConstants.RIGHTS_LIST); this.recordList.setSources(TGConstants.SOURCE_LIST); this.recordList.setSubjects(TGConstants.SUBJECT_LIST); @@ -341,10 +335,8 @@ public class OaiPmhTest { this.recordList.setFormatField(TGConstants.FORMAT); this.recordList.setFormatToFilter(TextGridMimetypes.EDITION); this.recordList.setDateOfObjectCreation(TGConstants.CREATED); - this.recordList - .setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); - this.recordList - .setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); + this.recordList.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF); + this.recordList.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX); this.recordList.setFieldForRange(TGConstants.CREATED); JAXBElement<OAIPMHType> r = this.request.getRequest("ListRecords", "",