From 7654943487ef6b8b03719d78c92b41bf9b1ad83e Mon Sep 17 00:00:00 2001
From: Maximilian Brodhun <brodhun@sub.uni-goettingen.de>
Date: Fri, 9 May 2014 13:52:41 +0200
Subject: [PATCH] deliver aggregator url and delete creator as contributor

---
 .../textgrid/middleware/RecordDeliverer.java  |  6 +++--
 .../middleware/RecordListDeliverer.java       |  8 ++++--
 .../info/textgrid/middleware/OaiPmhTest.java  | 26 +++++++++----------
 3 files changed, 23 insertions(+), 17 deletions(-)

diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java
index 946a0a5e..bb4abfa5 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java
@@ -60,6 +60,7 @@ public class RecordDeliverer {
 	private DublinCoreBuilder dbc = new DublinCoreBuilder(odt, of);
 	private OAI_ESClient oaiEsClient;
 	
+	String aggregatorURL = "http://textgrid-esx1.gwdg.de/1.0/aggregator/teicorpus/";
 	
 	public RecordDeliverer(OAI_ESClient oaiEsClient){
 		this.oaiEsClient=oaiEsClient;
@@ -101,9 +102,9 @@ public class RecordDeliverer {
 			 */
 			//System.out.println(hit.getFields().get("textgridUri").values().get(0).toString());
 			if(tgObject.getField("edition.agent.value")!=null){
-				String contributorUnformatted = tgObject.getField("edition.agent.value").getValue().toString();
+				//String contributorUnformatted = tgObject.getField("edition.agent.value").getValue().toString();
 				contributors.add(tgObject.getField("dataContributor").getValue().toString());
-				contributors.add(contributorUnformatted);
+				//contributors.add(contributorUnformatted);
 			}
 			
 			
@@ -149,6 +150,7 @@ public class RecordDeliverer {
 			if(tgObject.getField("relations.isDerivedFrom")!=null){
 				relations.add(tgObject.getField("relations.isDerivedFrom").getValue().toString());
 			}
+			relations.add(aggregatorURL.concat(tgObject.getField("textgridUri").getValue().toString()));
 			
 			/*
 			 * DC-Rights
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 51f19fe0..cb8e18fb 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java
@@ -49,6 +49,8 @@ public class RecordListDeliverer {
 	
 	private OAI_ESClient oaiEsClient;
 	
+	String aggregatorURL = "http://textgrid-esx1.gwdg.de/1.0/aggregator/teicorpus/";
+	
 	public RecordListDeliverer(OAI_ESClient oaiEsClient){
 		this.oaiEsClient=oaiEsClient;
 	}
@@ -106,9 +108,9 @@ public class RecordListDeliverer {
 			 */
 			//System.out.println(hit.getFields().get("textgridUri").values().get(0).toString());
 			if(hit.getFields().get("edition.agent.value")!=null){
-				String contributorUnformatted = hit.getFields().get("edition.agent.value").values().get(0).toString();
+				//String contributorUnformatted = hit.getFields().get("edition.agent.value").values().get(0).toString();
 				contributors.add(hit.getFields().get("dataContributor").values().get(0).toString());
-				contributors.add(contributorUnformatted);
+				//contributors.add(contributorUnformatted);
 			}
 			
 			
@@ -156,6 +158,8 @@ public class RecordListDeliverer {
 				relations.add(hit.getFields().get("relations.isDerivedFrom").values().get(0).toString());
 			}
 			
+			relations.add(aggregatorURL.concat(hit.getFields().get("textgridUri").values().get(0).toString()));
+			
 			/*
 			 * DC-Rights
 			*/
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 94fc1649..e6634c7e 100644
--- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java
+++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java
@@ -29,7 +29,7 @@ public class OaiPmhTest{
 				
 	}
 		
-	@Test
+	/*@Test
 	@Ignore
 	public void testListRecords() throws ParseException{
 		
@@ -46,10 +46,10 @@ public class OaiPmhTest{
 		JAXBElement<OAIPMHType> r = testRequest.getRequest("ListMetadataFormats", "wr67.0", "", "", "", "", "");
 		JAXB.marshal(r, System.out);
 		System.out.println("-----------------------------------\n");
-	}
+	}*/
 	
 	@Test
-	@Ignore
+	//@Ignore
 	public void testDateNow() throws DatatypeConfigurationException{
 		System.out.println("---------------Now Version-----------------");		
 		XMLGregorianCalendar nowTest = OAIPMHUtillities.getXMLGregorianCalendarNow();
@@ -58,7 +58,7 @@ public class OaiPmhTest{
 	}
 	
 	@Test
-	@Ignore
+	//@Ignore
 	public void testDateGregorianType() throws ParseException, DatatypeConfigurationException{
 		String dateformatbefore = "2012-02-06T20:48:39.614+01:00";
 		
@@ -70,7 +70,7 @@ public class OaiPmhTest{
 	}
 	
 	@Test
-	@Ignore
+	//@Ignore
 	public void testDateStringType() throws ParseException, DatatypeConfigurationException{
 		String dateformatbefore = "2012-02-06T20:48:39.614+01:00";
 		
@@ -82,7 +82,7 @@ public class OaiPmhTest{
 	}
 	
 	@Test
-	@Ignore
+	//@Ignore
 	public void testListSets() throws ParseException{
 		
 		JAXBElement<OAIPMHType> r = testRequest.getRequest("ListSets", "", "", "", "", "", "");
@@ -90,17 +90,17 @@ public class OaiPmhTest{
 		System.out.println("-----------------------------------\n");
 	}
 	
-	@Test
+	/*@Test
 	@Ignore
 	public void testListIdentifiers() throws ParseException{
 		
 		JAXBElement<OAIPMHType> r = testRequest.getRequest("ListIdentifiers", "", "oai_dc", "", "", "", "");
 		JAXB.marshal(r, System.out);
 		System.out.println("-----------------------------------\n");
-	}
+	}*/
 	
 	@Test
-	@Ignore
+	//@Ignore
 	public void testGetRequestIdentify() throws ParseException{
 		
 		System.out.println("Test for the verb \"Identify\" with succesfull response");
@@ -110,7 +110,7 @@ public class OaiPmhTest{
 	}
 	
 	@Test
-	@Ignore
+	//@Ignore
 	public void testGetRequestIdentifyVerbError() throws ParseException{
 		JAXBElement<OAIPMHType> t = testRequest.getRequest("Identify", "", "a", "", "", "", "");
 		JAXB.marshal(t, System.out);
@@ -118,7 +118,7 @@ public class OaiPmhTest{
 	}
 	
 	@Test
-	@Ignore
+	//@Ignore
 	public void testGetRequestIdentifyArgumentError() throws ParseException{
 		System.out.println("Test for the verb \"Identify\" with error response");
 		JAXBElement<OAIPMHType> z = testRequest.getRequest("Identify", "a", "", "", "", "a", "");
@@ -136,7 +136,7 @@ public class OaiPmhTest{
 	}
 	
 	@Test
-	//@Ignore
+	@Ignore
 	public void testGetRequestGetRecordError2() throws ParseException{
 		System.out.println("Test for the verb \"GetRecord\" with succesfull response");
 		JAXBElement<OAIPMHType> p = testRequest.getRequest("GetRecord", "vqmx.0", "oai_dc", "", "", "", "");
@@ -146,7 +146,7 @@ public class OaiPmhTest{
 	}
 
 	@Test
-	//@Ignore
+	@Ignore
 	public void testGetRequestGetRecordError3() throws ParseException{
 		System.out.println("Test for the verb \"GetRecord\" with succesfull response");
 		JAXBElement<OAIPMHType> p = testRequest.getRequest("GetRecord", "", "", "", "", "", "");
-- 
GitLab