From bf6dfa38ed810708a30b5dd9135d083676f41f5a Mon Sep 17 00:00:00 2001
From: mbrodhu <brodhun@sub.uni-goettingen.de>
Date: Thu, 9 Apr 2015 13:08:43 +0200
Subject: [PATCH] beans error

---
 .../middleware/IdentifierListDeliverer.java   |  94 +-------------
 .../textgrid/middleware/RecordDeliverer.java  | 122 ++++++------------
 .../middleware/RecordListDeliverer.java       | 113 ++++------------
 .../textgrid/middleware/SetDeliverer.java     | 101 ++++++++++-----
 .../info/textgrid/middleware/OaiPmhTest.java  |   6 +-
 .../src/main/webapp/WEB-INF/beans.xml         |   6 +-
 6 files changed, 143 insertions(+), 299 deletions(-)

diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDeliverer.java
index 735c48f8..58ba7904 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDeliverer.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/IdentifierListDeliverer.java
@@ -42,7 +42,7 @@ public class IdentifierListDeliverer {
 	private String									repositoryObjectURIPrefix; //
 	private String									identifierField;
 	
-	private String 									set;
+	//private String 									set;
 
 	/**
 	 * In OAIPMH a ListIdentifiers request is answered by responding the
@@ -84,20 +84,6 @@ public class IdentifierListDeliverer {
 		return lit;
 	}
 
-	/*private ListIdentifiersType setListIdentifierHeaderWithSet(
-			String datestamp, String identifier, String set,
-			ListIdentifiersType lit) {
-
-		HeaderType header = new HeaderType();
-
-		header.setDatestamp(datestamp);
-		header.setIdentifier(identifier);
-		header.getSetSpec().add(set);
-
-		lit.getHeader().add(header);
-
-		return lit;
-	}*/
 
 	/**
 	 * To get the required values for the ListIdentifiers request this function
@@ -130,7 +116,7 @@ public class IdentifierListDeliverer {
 				.from(from).to(to);
 		
 		if(set!=null){
-			this.set=set;
+			//ithis.set=set;
 			
 			String queryField = "";
 			String valueField = "";
@@ -142,15 +128,8 @@ public class IdentifierListDeliverer {
 				 * "metadata.dc:relation".
 				 */
 				
-				System.out.println("DARIAH IS SET TO: " + dariah);
-				
 				queryField = "metadata.dc:relation";
 				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]);
 			}
 
 			if (this.textgrid == true) {
@@ -159,10 +138,6 @@ public class IdentifierListDeliverer {
 				if (setParts[0].equals("project")) {
 					queryField = "project.value";
 					valueField = setParts[1];
-					// setParts[0] = setParts[0].concat(".value");
-
-					System.out.println("queryField: " + queryField);
-					System.out.println("valueField: " + valueField);
 				}
 			}
 				
@@ -183,14 +158,11 @@ public class IdentifierListDeliverer {
 		SearchResponse listListIdentiferValues = getListIdentifiersValuesBuilder
 				.execute().actionGet();
 		
-		System.out.println("Total hits are: " + listListIdentiferValues.getHits().getTotalHits());
 		
 		if (listListIdentiferValues.getHits().getTotalHits() > 0) {
 			System.out.println(listListIdentiferValues.getHits().getTotalHits() + ">" + 0);
 			for (SearchHit hit : listListIdentiferValues.getHits().getHits()) {
-				System.out.println("insside loop");
-				System.out.println("textgrid is set to: " + textgrid);
-				System.out.println("dariah is set to: " + dariah);
+
 				if (this.textgrid && hit.getFields().get(formatField).getValue()
 						.toString().equals(formatToFilter)) {
 					
@@ -253,11 +225,8 @@ public class IdentifierListDeliverer {
 								.get(this.dateOfObjectCreation).getValue()
 								.toString();
 
-						System.out.println("datestamp: " + datestamp);
-						
 						datestamp = OAIPMHUtillities.convertDateFormat(
 								datestamp).toXMLFormat();
-						System.out.println("got the date in xml format");
 					} catch (ParseException e1) {
 						log.debug(e1);
 					} catch (DatatypeConfigurationException e1) {
@@ -285,61 +254,6 @@ public class IdentifierListDeliverer {
 		return lit;
 	}
 
-	/*public ListIdentifiersType getIdentifierListWithSet(String from, String to,
-			String set) throws ParseException {
-
-		ListIdentifiersType lit = new ListIdentifiersType();
-
-		String identifier;
-
-		String[] setParts = set.split(":");
-
-		QueryBuilder rangeQuery = QueryBuilders.rangeQuery(rangeField).from(from).to(to);
-
-		QueryBuilder fieldQuer = QueryBuilders.matchPhraseQuery(setParts[0],setParts[1]);
-
-		QueryBuilder boolQuery = QueryBuilders.boolQuery().must(rangeQuery).must(fieldQuer);
-
-		SearchRequestBuilder getListIdentifiersValuesBuilder = oaiEsClient
-				.getOaiESClient().prepareSearch(oaiEsClient.getEsIndex())
-				.setTypes(oaiEsClient.getEsType())
-				.addFields(identifierListFields).setQuery(boolQuery)
-				.setSize(10);
-
-		SearchResponse listListIdentiierValues = getListIdentifiersValuesBuilder.execute().actionGet();
-
-		if (listListIdentiierValues.getHits().getTotalHits() > 0) {
-
-			for (SearchHit hit : listListIdentiierValues.getHits().getHits()) {
-
-				datestamp = hit.getFields().get(dateOfObjectCreation)
-						.getValue().toString();
-
-				try {
-					// XMLGregorianCalendar convertedDateFormat=
-					// OAIPMHUtillities.convertDateFormat(datestamp);
-					datestamp = OAIPMHUtillities.convertDateFormat(datestamp)
-							.toXMLFormat();
-				} catch (DatatypeConfigurationException e) {
-					log.debug(e);
-				}
-
-				identifier = hit.getFields().get(repositoryObjectURIPrefix)
-						.getValue().toString();
-
-				lit = setListIdentifierHeaderWithSet(datestamp, identifier,
-						set, lit);
-
-			}
-
-		} else {
-
-			lit = null;
-		}
-
-		return lit;
-	}*/
-
 	/**
 	 * checking the request if all necessary values are set or not allowed
 	 * values are not set
@@ -412,8 +326,6 @@ public class IdentifierListDeliverer {
 		this.rangeField = fieldForRange;
 	}
 	
-	//FIXME set function to get/setIdentifierField
-	
 	public String getIdentifierField() {
 		return identifierField;
 	}
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 82031eed..168a59a7 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordDeliverer.java
@@ -39,7 +39,7 @@ public class RecordDeliverer {
 	private String									dateOfObjectCreation;
 	private String									relationToFurtherMetadataObject;
 	private String									repositoryObjectURIPrefix;
-	private String									identifierPrefix;
+	private String									identifierField;
 
 	/*
 	 * Lists for the Dublin Core elements. Lists are needed since each DC fields
@@ -122,17 +122,14 @@ public class RecordDeliverer {
 		GetResponse tgObject = recordById.execute().actionGet();
 
 		if (tgObject.isExists()) {
-			// FIXME PUT CHECK INTO TEXTGRID CONDITIONAL BELOW!!!
-			// if(tgObject.isExists() &&
-			// tgObject.getField(formatField).getValue()
-			// .toString().equals(formatToFilter)){
+
 
 			String identifier;
 
 			if (this.dariah == true) {
 				putContentIntoDCFieldLists(tgObject);
 				// FIXME MAX!!!! DO CONFIGURE!!!!
-				identifier = tgObject.getField(this.identifierPrefix)
+				identifier = tgObject.getField(this.identifierField)
 						.getValue().toString();
 				String dateOfCreation = "NO_DATE_SET!";
 				if (tgObject.getField(this.dateOfObjectCreation) != null) {
@@ -143,14 +140,14 @@ public class RecordDeliverer {
 				setRecordHeader(dateOfCreation, identifier, record, dbc);
 			}
 
-			if (this.textgrid == true) {
+			if (this.textgrid == true && tgObject.getField(formatField).getValue().toString().equals(formatToFilter) ) {
 				String workUri = tgObject
 						.getField(this.relationToFurtherMetadataObject)
 						.getValue().toString();
 				workUri = workUri.substring(this.repositoryObjectURIPrefix
 						.length());
 				putContentIntoDCFieldLists(tgObject, furtherDCElements(workUri));
-				identifier = tgObject.getField(this.identifierPrefix)
+				identifier = tgObject.getField(this.identifierField)
 						.getValue().toString();
 				String dateOfCreation = tgObject
 						.getField(this.dateOfObjectCreation).getValue()
@@ -185,8 +182,6 @@ public class RecordDeliverer {
 
 	public GetResponse furtherDCElements(String id) {
 
-		System.out.println("workUri: " + id);
-
 		if (!id.endsWith(".0")) {
 			id = id.concat(".0");
 		}
@@ -216,76 +211,42 @@ public class RecordDeliverer {
 	public void putContentIntoDCFieldLists(GetResponse responseWorkValues,
 			GetResponse relatedWorkObject) {
 
-		this.contributors = DublinCoreFieldLoader.setContributor(
-				responseWorkValues, this.contributorList);
-		this.formats = DublinCoreFieldLoader.setFormat(responseWorkValues,
-				this.formatList);
-		this.identifiers = DublinCoreFieldLoader.setIdentifier(
-				responseWorkValues, this.identifierList);
-		this.languages = DublinCoreFieldLoader.setLanguage(responseWorkValues,
-				this.languageList);
-		this.publishers = DublinCoreFieldLoader.setPublisher(
-				responseWorkValues, this.publisherList);
-		this.relations = DublinCoreFieldLoader.setRelationForWork(
-				responseWorkValues, this.relationList);
-		this.rights = DublinCoreFieldLoader.setRights(responseWorkValues,
-				this.rightList);
-		this.sources = DublinCoreFieldLoader.setSources(responseWorkValues,
-				this.sourceList);
-		this.titles = DublinCoreFieldLoader.setTitle(responseWorkValues,
-				this.titleList);
-		this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,
-				this.coverageList);
-		this.creators = DublinCoreFieldLoader.setCreator(relatedWorkObject,
-				this.creatorList);
-		this.dates = DublinCoreFieldLoader.setDate(relatedWorkObject,
-				this.dateList);
-		this.descriptions = DublinCoreFieldLoader.setDescription(
-				relatedWorkObject, this.descriptionList);
-		this.relations = DublinCoreFieldLoader.setRelationForWork(
-				relatedWorkObject, this.relationForWorkList);
-		this.subjects = DublinCoreFieldLoader.setSubject(relatedWorkObject,
-				this.subjectList);
-		this.types = DublinCoreFieldLoader.setType(relatedWorkObject,
-				this.typeList);
+		this.contributors = DublinCoreFieldLoader.setContributor(responseWorkValues, this.contributorList);
+		this.formats = DublinCoreFieldLoader.setFormat(responseWorkValues,this.formatList);
+		this.identifiers = DublinCoreFieldLoader.setIdentifier(responseWorkValues, this.identifierList);
+		this.languages = DublinCoreFieldLoader.setLanguage(responseWorkValues,this.languageList);
+		this.publishers = DublinCoreFieldLoader.setPublisher(responseWorkValues, this.publisherList);
+		this.relations = DublinCoreFieldLoader.setRelationForWork(responseWorkValues, this.relationList);
+		this.rights = DublinCoreFieldLoader.setRights(responseWorkValues,this.rightList);
+		this.sources = DublinCoreFieldLoader.setSources(responseWorkValues,this.sourceList);
+		this.titles = DublinCoreFieldLoader.setTitle(responseWorkValues,this.titleList);
+		this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,this.coverageList);
+		this.creators = DublinCoreFieldLoader.setCreator(relatedWorkObject,this.creatorList);
+		this.dates = DublinCoreFieldLoader.setDate(relatedWorkObject,this.dateList);
+		this.descriptions = DublinCoreFieldLoader.setDescription(relatedWorkObject, this.descriptionList);
+		this.relations = DublinCoreFieldLoader.setRelationForWork(relatedWorkObject, this.relationForWorkList);
+		this.subjects = DublinCoreFieldLoader.setSubject(relatedWorkObject,this.subjectList);
+		this.types = DublinCoreFieldLoader.setType(relatedWorkObject,this.typeList);
 
 	}
 
 	public void putContentIntoDCFieldLists(GetResponse responseWorkValues) {
 
-		this.contributors = DublinCoreFieldLoader.setContributor(
-				responseWorkValues, this.contributorList);
-		this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,
-				this.coverageList);
-		this.creators = DublinCoreFieldLoader.setCreator(responseWorkValues,
-				this.creatorList);
-		this.dates = DublinCoreFieldLoader.setDate(responseWorkValues,
-				this.dateList);
-		this.descriptions = DublinCoreFieldLoader.setDescription(
-				responseWorkValues, this.descriptionList);
-		this.formats = DublinCoreFieldLoader.setFormat(responseWorkValues,
-				this.formatList);
-		this.identifiers = DublinCoreFieldLoader.setIdentifier(
-				responseWorkValues, this.identifierList);
-		this.languages = DublinCoreFieldLoader.setLanguage(responseWorkValues,
-				this.languageList);
-		this.publishers = DublinCoreFieldLoader.setPublisher(
-				responseWorkValues, this.publisherList);
-		this.relations = DublinCoreFieldLoader.setRelation(responseWorkValues,
-				this.relationList);
-		// relations =
-		// DublinCoreFieldLoader.setRelationForWork(responseWorkValues,
-		// relationForWorkList);
-		this.rights = DublinCoreFieldLoader.setRights(responseWorkValues,
-				this.rightList);
-		this.sources = DublinCoreFieldLoader.setSources(responseWorkValues,
-				this.sourceList);
-		this.subjects = DublinCoreFieldLoader.setSubject(responseWorkValues,
-				this.subjectList);
-		this.titles = DublinCoreFieldLoader.setTitle(responseWorkValues,
-				this.titleList);
-		this.types = DublinCoreFieldLoader.setType(responseWorkValues,
-				this.typeList);
+		this.contributors = DublinCoreFieldLoader.setContributor(responseWorkValues, this.contributorList);
+		this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,this.coverageList);
+		this.creators = DublinCoreFieldLoader.setCreator(responseWorkValues,this.creatorList);
+		this.dates = DublinCoreFieldLoader.setDate(responseWorkValues,this.dateList);
+		this.descriptions = DublinCoreFieldLoader.setDescription(responseWorkValues, this.descriptionList);
+		this.formats = DublinCoreFieldLoader.setFormat(responseWorkValues,this.formatList);
+		this.identifiers = DublinCoreFieldLoader.setIdentifier(responseWorkValues, this.identifierList);
+		this.languages = DublinCoreFieldLoader.setLanguage(responseWorkValues,this.languageList);
+		this.publishers = DublinCoreFieldLoader.setPublisher(responseWorkValues, this.publisherList);
+		this.relations = DublinCoreFieldLoader.setRelation(responseWorkValues,this.relationList);
+		this.rights = DublinCoreFieldLoader.setRights(responseWorkValues,this.rightList);
+		this.sources = DublinCoreFieldLoader.setSources(responseWorkValues,this.sourceList);
+		this.subjects = DublinCoreFieldLoader.setSubject(responseWorkValues,this.subjectList);
+		this.titles = DublinCoreFieldLoader.setTitle(responseWorkValues,this.titleList);
+		this.types = DublinCoreFieldLoader.setType(responseWorkValues,this.typeList);
 	}
 
 	/**
@@ -297,8 +258,7 @@ public class RecordDeliverer {
 	 *            jaxb object factory the DublinCore elements
 	 */
 
-	public void setDCObject(OaiDcType odt, ObjectFactory of,
-			DublinCoreBuilder dbc) {
+	public void setDCObject(OaiDcType odt, ObjectFactory of, DublinCoreBuilder dbc) {
 
 		dbc.setContributor(this.contributors);
 		dbc.setCoverage(this.coverages);
@@ -369,12 +329,12 @@ public class RecordDeliverer {
 		this.repositoryObjectURIPrefix = repositoryObjectURIPrefix;
 	}
 
-	public String getIdentifierPrefix() {
-		return this.identifierPrefix;
+	public String getIdentifierField() {
+		return this.identifierField;
 	}
 
-	public void setIdentifierPrefix(String identifierPrefix) {
-		this.identifierPrefix = identifierPrefix;
+	public void setIdentifierField(String identifierPrefix) {
+		this.identifierField = identifierPrefix;
 	}
 
 	public void setFields(String[] fields) {
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 b71d8b5c..03ba4331 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/RecordListDeliverer.java
@@ -26,12 +26,8 @@ import info.textgrid.middleware.oaipmh.RecordType;
 import info.textgrid.middleware.oaipmh.RequestType;
 
 /**
- * TODO Make aggregator URL configurable!
- * 
+ ** 
  * TODO Care about repeatable fields as done in TITLE!
- * 
- * TODO Replace CregId with "dariah:collection:", use static final or even
- * config file value!
  */
 
 public class RecordListDeliverer {
@@ -64,7 +60,7 @@ public class RecordListDeliverer {
 	private String									repositoryObjectURIPrefix;
 	private String									rangeField;
 	private boolean									foundItems;
-	private String									collectionTitle;
+
 
 	// **
 	// DC-Field Lists
@@ -103,10 +99,6 @@ public class RecordListDeliverer {
 	private String[]								titleList;
 	private String[]								typeList;
 
-	// TODO Make configurable!
-	// private String aggregatorURL =
-	// "http://textgrid-esx2.gwdg.de/1.0/aggregator/teicorpus/";
-
 	/**
 	 * @param oaiEsClient
 	 */
@@ -132,7 +124,6 @@ public class RecordListDeliverer {
 		try {
 			id = URLDecoder.decode(id, "UTF-8");
 		} catch (UnsupportedEncodingException e) {
-			// TODO Auto-generated catch block
 			e.printStackTrace();
 		}
 
@@ -143,11 +134,11 @@ public class RecordListDeliverer {
 
 		GetResponse responseWorkValues = getWorkValues.execute().actionGet();
 
-		if (this.dariah == true
+		/*if (this.dariah == true
 				&& responseWorkValues.getField("metadata.dc:title") != null) {
 			this.collectionTitle = responseWorkValues
 					.getField("metadata.dc:title").getValue().toString();
-		}
+		}*/
 
 		return responseWorkValues;
 	}
@@ -170,11 +161,6 @@ public class RecordListDeliverer {
 
 		SearchResponse getRecordListItems = getRecordList.execute().actionGet();
 
-		// FIXME REMOVE DEBUG OUTPUT
-		// System.out.println("totalHits: "
-		// + getRecordListItems.getHits().totalHits());
-		// FIXME REMOVE DEBUG OUTPUT
-
 		if (getRecordListItems != null
 				&& getRecordListItems.getHits().totalHits() > 0) {
 			setFoundItems(true);
@@ -198,14 +184,8 @@ public class RecordListDeliverer {
 					// The date stamp from textgrid is in not compatible format
 					// so it has to be transformed
 					try {
-
-						String datestamp = hit.getFields()
-								.get(this.dateOfObjectCreation).getValue()
-								.toString();
-
-						datestamp = OAIPMHUtillities.convertDateFormat(
-								datestamp).toXMLFormat();
-
+						String datestamp = hit.getFields().get(this.dateOfObjectCreation).getValue().toString();
+						datestamp = OAIPMHUtillities.convertDateFormat(datestamp).toXMLFormat();
 					} catch (ParseException e1) {
 						log.debug(e1);
 					} catch (DatatypeConfigurationException e1) {
@@ -216,7 +196,8 @@ public class RecordListDeliverer {
 					// is in an other object than just the edition
 
 					// TextGrid search!
-					if (this.textgrid == true) {
+					if (this.textgrid == true && hit.getFields().get(formatField).values()
+							.get(0).toString().equals(formatToFilter)) {
 						String workUri = hit
 								.getFields()
 								.get(this.relationToFurtherMetadataObject)
@@ -236,27 +217,8 @@ public class RecordListDeliverer {
 						listClearer();
 					}
 
-					// DARIAH search!
-					// SearchHitField shf = hit.getFields().get(
-					// relationToFurtherMetadataObject);
-
-					// if (dariah == true && shf != null) {
 					if (this.dariah == true) {
 
-						// String collectionUri = shf.values().toString();
-						//
-						// collectionUri = collectionUri.substring(
-						// collectionUri.indexOf("hdl:"),
-						// collectionUri.length() - 1);
-						//
-						// try {
-						// collectionUri = URLEncoder.encode(collectionUri,
-						// "UTF-8");
-						// } catch (UnsupportedEncodingException e) {
-						// // TODO Auto-generated catch block
-						// e.printStackTrace();
-						// }
-
 						putContentIntoDCFieldLists2(
 								hit,
 								furtherDCElements(hit.getId(), this.oaiEsClient));
@@ -265,7 +227,6 @@ public class RecordListDeliverer {
 					}
 
 				}
-				// }
 			}
 		} else {
 			setFoundItems(false);
@@ -279,33 +240,22 @@ public class RecordListDeliverer {
 	public void putContentIntoDCFieldLists(SearchHit hit,
 			GetResponse responseWorkValues) {
 
-		this.contributors = DublinCoreFieldLoader.setContributor(hit,
-				this.contributorList);
-		this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,
-				this.coverageList);
-		this.creators = DublinCoreFieldLoader.setCreator(responseWorkValues,
-				this.creatorList);
-		this.dates = DublinCoreFieldLoader.setDate(responseWorkValues,
-				this.dateList);
-		this.descriptions = DublinCoreFieldLoader.setDescription(
-				responseWorkValues, this.descriptionList);
+		this.contributors = DublinCoreFieldLoader.setContributor(hit,this.contributorList);
+		this.coverages = DublinCoreFieldLoader.setCoverage(responseWorkValues,this.coverageList);
+		this.creators = DublinCoreFieldLoader.setCreator(responseWorkValues,this.creatorList);
+		this.dates = DublinCoreFieldLoader.setDate(responseWorkValues,this.dateList);
+		this.descriptions = DublinCoreFieldLoader.setDescription(responseWorkValues, this.descriptionList);
 		this.formats = DublinCoreFieldLoader.setFormat(hit, this.formatList);
-		this.identifiers = DublinCoreFieldLoader.setIdentifier(hit,
-				this.identifierList);
-		this.languages = DublinCoreFieldLoader.setLanguage(hit,
-				this.languageList);
-		this.publishers = DublinCoreFieldLoader.setPublisher(hit,
-				this.publisherList);
-		this.relations = DublinCoreFieldLoader.setRelation(hit,
-				this.relationList);
-		this.relations = DublinCoreFieldLoader.setRelationForWork(
-				responseWorkValues, this.relationForWorkList);
+		this.identifiers = DublinCoreFieldLoader.setIdentifier(hit,this.identifierList);
+		this.languages = DublinCoreFieldLoader.setLanguage(hit,this.languageList);
+		this.publishers = DublinCoreFieldLoader.setPublisher(hit,this.publisherList);
+		this.relations = DublinCoreFieldLoader.setRelation(hit,this.relationList);
+		this.relations = DublinCoreFieldLoader.setRelationForWork(responseWorkValues, this.relationForWorkList);
 		this.rights = DublinCoreFieldLoader.setRights(hit, this.rightList);
 		this.sources = DublinCoreFieldLoader.setSources(hit, this.sourceList);
 		this.subjects = DublinCoreFieldLoader.setSubject(hit, this.subjectList);
 		this.titles = DublinCoreFieldLoader.setTitle(hit, this.titleList);
-		this.types = DublinCoreFieldLoader.setType(responseWorkValues,
-				this.typeList);
+		this.types = DublinCoreFieldLoader.setType(responseWorkValues,this.typeList);
 
 	}
 
@@ -316,26 +266,16 @@ public class RecordListDeliverer {
 	public void putContentIntoDCFieldLists2(SearchHit hit,
 			GetResponse responseWorkValues) {
 
-		this.contributors = DublinCoreFieldLoader.setContributor(hit,
-				this.contributorList);
-		this.coverages = DublinCoreFieldLoader.setCoverage(hit,
-				this.coverageList);
+		this.contributors = DublinCoreFieldLoader.setContributor(hit,this.contributorList);
+		this.coverages = DublinCoreFieldLoader.setCoverage(hit,this.coverageList);
 		this.creators = DublinCoreFieldLoader.setCreator(hit, this.creatorList);
 		this.dates = DublinCoreFieldLoader.setDate(hit, this.dateList);
-		this.descriptions = DublinCoreFieldLoader.setDescription(hit,
-				this.descriptionList);
+		this.descriptions = DublinCoreFieldLoader.setDescription(hit,this.descriptionList);
 		this.formats = DublinCoreFieldLoader.setFormat(hit, this.formatList);
-		this.identifiers = DublinCoreFieldLoader.setIdentifier(hit,
-				this.identifierList);
-		this.languages = DublinCoreFieldLoader.setLanguage(hit,
-				this.languageList);
-		this.publishers = DublinCoreFieldLoader.setPublisher(hit,
-				this.publisherList);
-		this.relations = DublinCoreFieldLoader.setRelation(hit,
-				this.relationList);
-		// relations =
-		// DublinCoreFieldLoader.setRelationForWork(responseWorkValues,
-		// relationForWorkList);
+		this.identifiers = DublinCoreFieldLoader.setIdentifier(hit,this.identifierList);
+		this.languages = DublinCoreFieldLoader.setLanguage(hit,	this.languageList);
+		this.publishers = DublinCoreFieldLoader.setPublisher(hit, this.publisherList);
+		this.relations = DublinCoreFieldLoader.setRelation(hit,	this.relationList);
 		this.rights = DublinCoreFieldLoader.setRights(hit, this.rightList);
 		this.sources = DublinCoreFieldLoader.setSources(hit, this.sourceList);
 		this.subjects = DublinCoreFieldLoader.setSources(hit, this.subjectList);
@@ -363,7 +303,6 @@ public class RecordListDeliverer {
 		if (!this.identifiers.isEmpty()) {
 			recordHeader.setIdentifier(this.identifiers.get(0));
 		}
-		// TODO Why take the 0th date here?
 		if (!this.dates.isEmpty()) {
 			recordHeader.setDatestamp(this.dates.get(0));
 		}
diff --git a/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java b/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java
index c88cef01..09fae875 100644
--- a/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java
+++ b/oaipmh-core/src/main/java/info/textgrid/middleware/SetDeliverer.java
@@ -3,9 +3,8 @@ package info.textgrid.middleware;
 import info.textgrid.middleware.oaipmh.ListSetsType;
 import info.textgrid.middleware.oaipmh.SetType;
 
-import java.util.ArrayList;
+
 import java.util.LinkedHashSet;
-import java.util.List;
 import java.util.Set;
 
 import org.elasticsearch.action.get.GetRequestBuilder;
@@ -24,8 +23,13 @@ public class SetDeliverer {
 		this.oaiEsClient = oaiEsClient;
 	}
 
-	private Set<String>	dariahCollections	= new LinkedHashSet<String>();
 	private Set<String>	identifier			= new LinkedHashSet<String>();
+    private String formatField;
+    private String formatToFilter;
+    private String identifierField;
+    private String repositoryObjectURIPrefix;
+    private String specField;
+    private String specFieldPrefix;
 
 	public ListSetsType setListBuilder() {
 
@@ -36,22 +40,18 @@ public class SetDeliverer {
 		SearchRequestBuilder request = this.oaiEsClient.getOaiESClient()
 				.prepareSearch(this.oaiEsClient.getEsIndex())
 				.setTypes(this.oaiEsClient.getEsType()).setQuery(aggQuery)
-				.addField("metadata.dc:format")
-				.addField("metadata.dc:identifier").setSize(100000);
+				.addField(formatField)//metadata.dc:format
+				.addField(identifierField).setSize(100000); //"metadata.dc:identifier"
 
 		SearchResponse getRecordListItems = request.execute().actionGet();
 
 		for (SearchHit hit : getRecordListItems.getHits().getHits()) {
 
-			// FIXME DO PUT INTO CONFIG FILE!!!
-			if (hit.getFields().get("metadata.dc:format") != null
-					&& hit.getFields().get("metadata.dc:format").value()
-							.equals(DARIAHConstants.COLLECTION_MIMETYPE)) {
-				// dariahCollections.add(hit.getFields().get("metadata.dc:title").values().get(0)
-				// .toString());
+			if(hit.getFields().get(formatField) != null && hit.getFields().get(formatField).value()
+			.equals(formatToFilter)) {
 
 				this.identifier.add(hit.getFields()
-						.get("metadata.dc:identifier").values().get(0)
+						.get(identifierField).values().get(0)
 						.toString());
 			}
 		}
@@ -60,51 +60,84 @@ public class SetDeliverer {
 
 			String id = identifierSetSpec;
 			if (identifierSetSpec
-					.startsWith(DARIAHConstants.ITEM_IDENTIFIER_PREFIX)) {
+					.startsWith(repositoryObjectURIPrefix)) { //hdl:
 				id = identifierSetSpec
-						.substring(DARIAHConstants.ITEM_IDENTIFIER_PREFIX
+						.substring(repositoryObjectURIPrefix
 								.length());
 			}
 
-			System.out.println("id: " + id);
-
 			GetRequestBuilder collectionNameById = this.oaiEsClient
 					.getOaiESClient().prepareGet()
 					.setIndex(this.oaiEsClient.getEsIndex())
 					.setType(this.oaiEsClient.getEsType())
-					.setFields("metadata.dc:title").setId(id);
+					.setFields(specField).setId(id); //metadata.dc:title
 
-			System.out.println("  ##  " + identifierSetSpec);
 
 			GetResponse setSpec = collectionNameById.execute().actionGet();
 
-			System.out.println((setSpec != null ? setSpec : "NULL"));
-
-			String collectionName = "";
+			String setName = "";
 			if (setSpec != null
-					&& setSpec.getField("metadata.dc:title") != null) {
-				collectionName = setSpec.getField("metadata.dc:title")
+					&& setSpec.getField(specField) != null) {
+				setName = setSpec.getField(specField)
 						.getValue().toString();
 			}
 
 			SetType set = new SetType();
 
-			set.setSetName(collectionName);
-			set.setSetSpec(DARIAHConstants.COLLECTIONREGISTRY_PREFIX + ":" + id);
+			set.setSetName(setName);
+			set.setSetSpec(specFieldPrefix + ":" + id);
 
 			setList.getSet().add(set);
 		}
 
-		/*
-		 * for (String collection : dariahCollections){ SetType set = new
-		 * SetType();
-		 * 
-		 * set.setSetName(collection); set.setSetSpec(collection);
-		 * 
-		 * setList.getSet().add(set); }
-		 */
-
 		return setList;
 
 	}
+	
+	public String getFormatField() {
+		return formatField;
+	}
+	public void setFormatField(String formatField) {
+		this.formatField = formatField;
+	}
+
+	public String getFormatToFilter() {
+		return formatToFilter;
+	}
+
+	public void setFormatToFilter(String formatToFilter) {
+		this.formatToFilter = formatToFilter;
+	}
+
+	public String getIdentifierField() {
+		return identifierField;
+	}
+
+	public void setIdentifierField(String identifierField) {
+		this.identifierField = identifierField;
+	}
+
+	public String getRepositoryObjectURIPrefix() {
+		return repositoryObjectURIPrefix;
+	}
+
+	public void setRepositoryObjectURIPrefix(String repositoryObjectURIPrefix) {
+		this.repositoryObjectURIPrefix = repositoryObjectURIPrefix;
+	}
+
+	public String getTitleField() {
+		return specField;
+	}
+
+	public void setTitleField(String titleField) {
+		this.specField = titleField;
+	}
+
+	public String getSpecFieldPrefix() {
+		return specFieldPrefix;
+	}
+
+	public void setSpecFieldPrefix(String specFieldPrefix) {
+		this.specFieldPrefix = specFieldPrefix;
+	}
 }
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 e3ad964c..999ddaa6 100644
--- a/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java
+++ b/oaipmh-core/src/test/java/info/textgrid/middleware/OaiPmhTest.java
@@ -219,7 +219,7 @@ public class OaiPmhTest {
 				.setRelationToFurtherMetadataObject(TGConstants.EDITION_ISEDITIONOF);
 		this.record
 				.setRepositoryObjectURIPrefix(TGConstants.ITEM_IDENTIFIER_PREFIX);
-		this.record.setIdentifierPrefix("textgridUri");
+		this.record.setIdentifierField("textgridUri");
 
 		System.out
 				.println("Test for the verb \"GetRecord\" with succesfull response");
@@ -259,7 +259,7 @@ public class OaiPmhTest {
 		// record.setRelationToFurtherMetadataObject(DARIAHConstants.EDITION_ISEDITIONOF);
 		this.record
 				.setRepositoryObjectURIPrefix(DARIAHConstants.ITEM_IDENTIFIER_PREFIX);
-		this.record.setIdentifierPrefix("metadata.dc:identifier");
+		this.record.setIdentifierField("metadata.dc:identifier");
 
 		System.out
 				.println("Test for the verb \"GetRecord\" with succesfull response");
@@ -465,7 +465,7 @@ public class OaiPmhTest {
 	}
 	
 	@Test
-	//@Ignore
+	@Ignore
 	public void testListIdentifiersDARIAH() throws ParseException {
 		this.identifierList.setFieldForRange(DARIAHConstants.RANGE_FIELD);
 		this.identifierList	.setIdentifierListFields(DARIAHConstants.IDENTIFIER_LIST_FIELDS);
diff --git a/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml b/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml
index 89fe121f..e7770d64 100644
--- a/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml
+++ b/oaipmh-webapp/src/main/webapp/WEB-INF/beans.xml
@@ -125,7 +125,7 @@
 		<property name="dateOfObjectCreation" value="${dateOfObjectCreation}" />
 		<property name="relationToFurtherMetadataObject" value="${relationToFurtherMetadataObject}" />
 		<property name="repositoryObjectURIPrefix" value="${repositoryObjectURIPrefix}" />
-		<property name="identifierPrefix" value="${identifierField}" />
+		<property name="identifierField" value="${identifierField}" />
 		<property name="fields" value="${fields}" />
 		<property name="contributor" value="${contributorList}" />
 		<property name="coverage" value="${coverageList}" />
@@ -188,8 +188,8 @@
 		<constructor-arg ref="MetadataFormatList" />
 		<constructor-arg ref="SetDeliverer" />
 		<constructor-arg ref="ListIdentifier" />
-		<property name="TextGrid" value="${textgrid}">	
-		<property name="Dariah" value="${dariah}">		
+		<property name="TextGrid" value="${textgrid}" />	
+		<property name="Dariah" value="${dariah}" />		
 	</bean>
 
 	<jaxrs:server id="root" address="/root"
-- 
GitLab