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

Fix only-one-entry-a-hundred-times-bug for oai_datacite schema

parent f36b73f2
No related branches found
No related tags found
No related merge requests found
......@@ -90,8 +90,8 @@ public class RecordDelivererDATACITE extends RecordDelivererAbstract {
private String relationToWorkObject;
private String handle;
// This variable contains the XML-content for a whole OpenAire file
private Resource resource = new Resource();
// // This variable contains the XML-content for a whole OpenAire file
// private Resource resource = new Resource();
/**
* @param textgrid flag to indicate that the content of the record is context of the TextGrid repo
......@@ -202,30 +202,32 @@ public class RecordDelivererDATACITE extends RecordDelivererAbstract {
private Resource setOpenAireRecord()
throws ParseException, DatatypeConfigurationException, IOException {
this.resource.setTitles(this.addTitles());
this.resource.setPublisher(addPublisher());
this.resource.setPublicationYear(this.addPublicationYear());
this.resource.setDates(this.addDates());
this.resource.setContributors(this.addContributors());
this.resource.setLanguage(this.addLanguae());
this.resource.setAlternateIdentifiers(this.addAlternateIdentifier());
this.resource.setFormats(this.addFormats());
this.resource.setRightsList(this.addRights());
this.resource.setDescriptions(this.addDescriptions());
this.resource.setRelatedIdentifiers(this.addRelatedIdentifiers());
this.resource.setIdentifier(this.addIdentifier());
this.resource.setCreators(this.addCreators());
Resource result = new Resource();
result.setTitles(this.addTitles());
result.setPublisher(addPublisher());
result.setPublicationYear(this.addPublicationYear());
result.setDates(this.addDates());
result.setContributors(this.addContributors());
result.setLanguage(this.addLanguae());
result.setAlternateIdentifiers(this.addAlternateIdentifier());
result.setFormats(this.addFormats());
result.setRightsList(this.addRights());
result.setDescriptions(this.addDescriptions());
result.setRelatedIdentifiers(this.addRelatedIdentifiers());
result.setIdentifier(this.addIdentifier());
result.setCreators(this.addCreators());
// FIXME Check if we can have empty elements here! Was: Check for null in this.addGeoLocation()
// method!)
this.resource.setGeoLocations(this.addGeoLocation());
this.resource.setResourceType(addResourceType());
this.resource.setVersion(this.addVersion());
result.setGeoLocations(this.addGeoLocation());
result.setResourceType(addResourceType());
result.setVersion(this.addVersion());
// FIXME Check if we can have empty elements here! Was: Check for null in this.addSubjects()
// method!)
this.resource.setSubjects(this.addSubjects());
this.resource.setSizes(this.addSize());
result.setSubjects(this.addSubjects());
result.setSizes(this.addSize());
return this.resource;
return result;
}
/**
......@@ -1078,19 +1080,19 @@ public class RecordDelivererDATACITE extends RecordDelivererAbstract {
this.oarIdentifierField = oarIdentifierField;
}
/**
* @return
*/
public Resource getResource() {
return this.resource;
}
/**
* @param resource
*/
public void setResource(Resource resource) {
this.resource = resource;
}
// /**
// * @return
// */
// public Resource getResource() {
// return this.resource;
// }
//
// /**
// * @param resource
// */
// public void setResource(Resource resource) {
// this.resource = resource;
// }
/**
* @return
......
......@@ -5,6 +5,7 @@ import java.text.ParseException;
import javax.xml.datatype.DatatypeConfigurationException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import info.textgrid.middleware.oaipmh.GetRecordType;
import info.textgrid.middleware.oaipmh.ListRecordsType;
import info.textgrid.middleware.oaipmh.MetadataType;
import info.textgrid.middleware.oaipmh.RecordType;
......@@ -28,11 +29,16 @@ public class RecordListDelivererDATACITE extends RecordListDelivererAbstract {
}
/**
*
* FIXME This class is never used? Why not deleting it then?
*
* @param recordList
* @param set
* @param headerIdentifier
* @return
* @deprecated
*/
@Deprecated
public RecordType buildRecord(ListRecordsType recordList, String set, String headerIdentifier) {
MetadataType metadata = new MetadataType();
......@@ -64,8 +70,6 @@ public class RecordListDelivererDATACITE extends RecordListDelivererAbstract {
for (String uri : getUriList(from, to, set, resumptionToken)) {
log.debug("uri: " + uri);
String eventuallyChangedUri = uri;
// **
......@@ -81,15 +85,18 @@ public class RecordListDelivererDATACITE extends RecordListDelivererAbstract {
// DARIAH
// **
else if (this.dariah) {
eventuallyChangedUri = uri;
}
// else if (this.dariah) {
// Nothing to remove for DARIAH IDs here.
// }
log.debug("eventuallyChangedUri: " + eventuallyChangedUri);
log.debug("uri: " + uri + " | eventuallyChangedUri: " + eventuallyChangedUri);
try {
openAireRecordList.getRecord()
.add(openAireRecord.getRecordById(eventuallyChangedUri).getRecord());
GetRecordType grt = openAireRecord.getRecordById(eventuallyChangedUri);
RecordType rt = grt.getRecord();
openAireRecordList.getRecord().add(rt);
} catch (DatatypeConfigurationException e) {
e.printStackTrace();
}
......
......@@ -115,7 +115,7 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract {
/**
* <p>
* The fetchFields function filters all edition and fetch the specified fields
* The fetchFields function filters all edition and fetch the specified fields.
* </p>
*
* @param query
......@@ -407,6 +407,7 @@ public class RecordListDelivererDC extends RecordListDelivererAbstract {
* @param set
* @param headerIdentifier
* @param dublinCoreBuilder
* @param setSpec
* @return
*/
public RecordType buildRecord(ListRecordsType recordList, String set, String headerIdentifier,
......
package info.textgrid.middleware;
import java.io.IOException;
import java.text.ParseException;
import org.apache.commons.logging.Log;
......@@ -37,11 +36,16 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
}
/**
*
* FIXME This class is never used? Why not deleting it then?
*
* @param recordList
* @param set
* @param headerIdentifier
* @return
* @deprecated
*/
@Deprecated
public RecordType buildRecord(ListRecordsType recordList, String set, String headerIdentifier) {
MetadataType metadata = new MetadataType();
......
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