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

Testing getRecord

parent 2007b599
No related branches found
No related tags found
No related merge requests found
...@@ -80,21 +80,24 @@ public class OAIPMHImpl implements OAIPMHProducer { ...@@ -80,21 +80,24 @@ public class OAIPMHImpl implements OAIPMHProducer {
/** /**
* @param rep * @param rep
* @param recDelivDC * @param recordDC
* @param recDelivIDIOM * @param recordIDIOM
* @param recordDATACITE
* @param recordListDC * @param recordListDC
* @param recordListIDIOM * @param recordListIDIOM
* @param recordListDATACITE
* @param metadataFormatList * @param metadataFormatList
* @param setList * @param setList
* @param identifierList * @param identifierList
* @param identifierListIDIOM * @param identifierListIDIOM
* @param identifierListDATACITE
*/ */
public OAIPMHImpl( public OAIPMHImpl(
RepIdentification rep, // 0 RepIdentification rep, // 0
RecordDelivererDC recDelivDC, // 1 RecordDelivererDC recordDC, // 1
RecordDelivererIDIOM recDelivIDIOM, // 2 RecordDelivererIDIOM recordIDIOM, // 2
// OpenAireRecord openAireRecord, // 3 // OpenAireRecord openAireRecord, // 3
RecordDelivererDATACITE recDelivDATACITE, // 3 RecordDelivererDATACITE recordDATACITE, // 3
RecordListDelivererDC recordListDC, // 4 RecordListDelivererDC recordListDC, // 4
RecordListDelivererIDIOM recordListIDIOM, // 5 RecordListDelivererIDIOM recordListIDIOM, // 5
// OpenAireRecordList openAireRecordList, // 6 // OpenAireRecordList openAireRecordList, // 6
...@@ -108,10 +111,10 @@ public class OAIPMHImpl implements OAIPMHProducer { ...@@ -108,10 +111,10 @@ public class OAIPMHImpl implements OAIPMHProducer {
) { ) {
this.rep = rep; this.rep = rep;
this.recordDC = recDelivDC; this.recordDC = recordDC;
this.recordIDIOM = recDelivIDIOM; this.recordIDIOM = recordIDIOM;
// this.openAireRecord = openAireRecord; // this.openAireRecord = openAireRecord;
this.recordDATACITE = recDelivDATACITE; this.recordDATACITE = recordDATACITE;
this.recordListDC = recordListDC; this.recordListDC = recordListDC;
this.recordListIDIOM = recordListIDIOM; this.recordListIDIOM = recordListIDIOM;
...@@ -126,7 +129,7 @@ public class OAIPMHImpl implements OAIPMHProducer { ...@@ -126,7 +129,7 @@ public class OAIPMHImpl implements OAIPMHProducer {
this.metadataFormatList = metadataFormatList; this.metadataFormatList = metadataFormatList;
this.log this.log
.debug("MetadataFormatList Implementing Class: " + metadataFormatList.getClass().getName()); .debug("MetadataFormatList implementing class: " + metadataFormatList.getClass().getName());
this.setList = setList; this.setList = setList;
} }
......
...@@ -206,6 +206,47 @@ public class RecordDelivererDATACITE extends RecordDelivererAbstract { ...@@ -206,6 +206,47 @@ public class RecordDelivererDATACITE extends RecordDelivererAbstract {
return oaijaxb; return oaijaxb;
} }
/**
* @param idInElasticSearchIndex
* @return
* @throws ParseException
* @throws DatatypeConfigurationException
* @throws IOException
*/
@Deprecated
public GetRecordType getRecordTESTITEST(String idInElasticSearchIndex)
throws ParseException, DatatypeConfigurationException, IOException {
HeaderType header = new HeaderType();
System.out.println(" ## fields (getRecord): ");
for (int i = 0; i < this.fields.length; i++) {
System.out.println("\t" + this.fields[i]);
}
this.jsonObj =
new JSONObject(OAIPMHUtilities.getRcordByIDFromElasticSearch(OAI_ESClient.getEsIndex(),
idInElasticSearchIndex, this.fields, Strings.EMPTY_ARRAY).getSource());
// Setting the header for the oaipmh response
header.setDatestamp(OAIPMHUtilities
.datestampAsString(OAIPMHUtilities.fieldLoader(this.jsonObj, this.dateOfObjectCreation)));
// The id for the response has to be starts with "textgrid:" or "hdl:". The id in elasticsearch
// is missing. In consequence is optional in oaipmh request to write textgrid:1233.0 or
// hdl:blubb-bla or just 1233.0 or blubb-bla. For the response the prefix has to be added.
if (!idInElasticSearchIndex.startsWith(this.repositoryObjectURIPrefix)) {
header.setIdentifier(this.repositoryObjectURIPrefix + idInElasticSearchIndex);
} else {
header.setIdentifier(idInElasticSearchIndex);
}
// It is necessary to add the GetRecordType to the OAIPMH object.
GetRecordType grt = OAIPMHUtilities.getRecordType(this.setOpenAireRecord(), header);
return grt;
}
/** /**
* Adding the openaire record fields to the openaire record object * Adding the openaire record fields to the openaire record object
* *
......
...@@ -48,7 +48,8 @@ public class RecordListDelivererDATACITE extends RecordListDelivererAbstract { ...@@ -48,7 +48,8 @@ public class RecordListDelivererDATACITE extends RecordListDelivererAbstract {
try { try {
openAireRecord = new RecordDelivererDATACITE(true, false); openAireRecord = new RecordDelivererDATACITE(true, false);
GetRecordType grt = openAireRecord.getRecordById(uri.replace("textgrid:", "")); // GetRecordType grt = openAireRecord.getRecordById(uri.replace("textgrid:", ""));
GetRecordType grt = openAireRecord.getRecordTESTITEST(uri.replace("textgrid:", ""));
openAireRecordList.getRecord().add(grt.getRecord()); openAireRecordList.getRecord().add(grt.getRecord());
} catch (ParseException | DatatypeConfigurationException | IOException e) { } catch (ParseException | DatatypeConfigurationException | IOException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
......
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