Skip to content
Snippets Groups Projects
Commit 7b7604b8 authored by Stefan E. Funk's avatar Stefan E. Funk
Browse files

Remove double implemented divider code

parent 7f07430d
No related branches found
No related tags found
No related merge requests found
......@@ -40,8 +40,6 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
private static Log log = LogFactory.getLog(IdentifierListDelivererDC.class);
private static final int lifeTimeResToken = 100;
private static final String DH_ES_DIVIDER_CHAR = ".";
private static final String DH_ES_DIVIDER_REGEXP = "\\.";
// private static org.apache.commons.logging.Log log =
// LogFactory.getLog(IdentifierListDelivererDC.class);
......@@ -197,34 +195,10 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
JSONObject json = new JSONObject(hit.getSourceAsMap());
// Get modifiedDate field.
if (this.dateOfObjectCreation.contains(DH_ES_DIVIDER_CHAR)) {
// FIXME Möglicherweise doppelt gemoppelt? Sind auch einzelne Abfragefelder in
// OAIPMHUtilities.fieldLoader() abgebildet?
if (this.dateOfObjectCreation.contains(OAIPMHUtilities.ES_DIVIDER_CHAR)) {
this.datestamp = OAIPMHUtilities.fieldLoader(json, this.dateOfObjectCreation);
// // Divide object.
// String dateOfObjectCreationEntries[] =
// this.dateOfObjectCreation.split(DH_ES_DIVIDER_REGEXP);
//
// // System.out.println(" ## divider --> " + DH_ES_DIVIDER_CHAR);
// // System.out.println(" ## length of dOOCD --> " + dateOfObjectCreationEntries.length);
// // System.out.println(" ## dOOCD --> " + dateOfObjectCreationEntries);
//
// if (dateOfObjectCreationEntries.length != 2) {
// // FIXME Go to ERROR state!
// } else {
// String prefix = dateOfObjectCreationEntries[0];
// String suffix = dateOfObjectCreationEntries[1];
//
// if (hit.getSourceAsMap().containsKey(prefix)) {
//
// HashMap<String, Object> prefixMap =
// (HashMap<String, Object>) hit.getSourceAsMap().get(prefix);
//
// // System.out.println(" ## prefix value (" + prefix + ") --> " + prefixMap);
//
// this.datestamp = prefixMap.get(suffix).toString();
// }
// }
} else {
this.datestamp = hit.getSourceAsMap().get(this.dateOfObjectCreation).toString();
}
......@@ -247,33 +221,10 @@ public class IdentifierListDelivererDC extends IdentifierListDelivererAbstract {
// Get identifier field.
String identifier = "";
if (this.identifierField.contains(DH_ES_DIVIDER_CHAR)) {
// FIXME Möglicherweise doppelt gemoppelt? Sind auch einzelne Abfragefelder in
// OAIPMHUtilities.fieldLoader() abgebildet?
if (this.identifierField.contains(OAIPMHUtilities.ES_DIVIDER_CHAR)) {
identifier = OAIPMHUtilities.fieldLoader(json, this.identifierField);
// // Divide object.
// String identifierEntries[] = this.identifierField.split(DH_ES_DIVIDER_REGEXP);
//
// // System.out.println(" ## divider --> " + DH_ES_DIVIDER_CHAR);
// // System.out.println(" ## length of iE --> " + identifierEntries.length);
// // System.out.println(" ## iE --> " + identifierEntries);
//
// if (identifierEntries.length != 2) {
// // FIXME Go to ERROR state!
// } else {
// String prefix = identifierEntries[0];
// String suffix = identifierEntries[1];
//
// if (hit.getSourceAsMap().containsKey(prefix)) {
//
// HashMap<String, Object> prefixMap =
// (HashMap<String, Object>) hit.getSourceAsMap().get(prefix);
//
// // System.out.println(" ## prefix value (" + prefix + ") --> " + prefixMap);
//
// identifier = prefixMap.get(suffix).toString();
// }
// }
} else {
identifier = hit.getSourceAsMap().get(this.identifierField).toString();
}
......
package info.textgrid.middleware;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringWriter;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
......@@ -18,31 +14,16 @@ import java.util.Map;
import java.util.Properties;
import java.util.TimeZone;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.DatatypeFactory;
import javax.xml.datatype.XMLGregorianCalendar;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamConstants;
import javax.xml.stream.XMLStreamException;
import javax.xml.stream.XMLStreamReader;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchScrollRequest;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.index.query.QueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.json.JSONArray;
import org.json.JSONException;
......@@ -52,15 +33,12 @@ import info.textgrid.clients.tgauth.AuthClientException;
import info.textgrid.middleware.oaipmh.GetRecordType;
import info.textgrid.middleware.oaipmh.HeaderType;
import info.textgrid.middleware.oaipmh.ListMetadataFormatsType;
import info.textgrid.middleware.oaipmh.ListRecordsType;
import info.textgrid.middleware.oaipmh.MetadataFormatType;
import info.textgrid.middleware.oaipmh.MetadataType;
import info.textgrid.middleware.oaipmh.OAIPMHtype;
import info.textgrid.middleware.oaipmh.RecordType;
import info.textgrid.middleware.oaipmh.Resource;
import info.textgrid.middleware.oaipmh.ResumptionTokenType;
import info.textgrid.namespaces.middleware.tgauth.ProjectInfo;
import info.textgrid.middleware.common.TextGridMimetypes;
/**
* <p>
......@@ -92,11 +70,13 @@ public class OAIPMHUtilities {
"https://dublincore.org/schemas/xmls/simpledc20021212.xsd";
public static final String METS_NAMESPACE = "http://www.loc.gov/METS/";
public static final String METS_SCHEMA_LOCATION = "http://www.loc.gov/standards/mets/mets.xsd";
public static final String OPEN_AIRE_SCHEMA_LOCATION =
"https://www.openaire.eu/schema/1.0/oaf-1.0.xsd";
public static final String OPEN_AIRE_NAMESPACE = "oai_datacite";
public static final String ES_DIVIDER_CHAR = ".";
public static final String ES_DIVIDER_REGEXP = "\\.";
// **
// CLASS
// **
......@@ -459,7 +439,7 @@ public class OAIPMHUtilities {
List<String> fieldResulsts = new ArrayList<String>();
for (String field : fields) {
String[] fieldPathForESIndex = field.split("\\.");
String[] fieldPathForESIndex = field.split(ES_DIVIDER_REGEXP);
JSONObject singlePath = resultFromGetRequestInES;
for (int i = 0; i < fieldPathForESIndex.length; i++) {
if (i < fieldPathForESIndex.length - 1) {
......@@ -502,7 +482,7 @@ public class OAIPMHUtilities {
log.debug("Inside fieldLoader for field: " + field);
String[] fieldPathForESIndex = field.split("\\.");
String[] fieldPathForESIndex = field.split(ES_DIVIDER_REGEXP);
JSONObject singlePath = resultFromGetRequestInES;
for (int i = 0; i < fieldPathForESIndex.length; i++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment