Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • dariah-de/dariah-de-oai-pmh-services
1 result
Show changes
Commits on Source (6)
Showing with 58 additions and 42 deletions
## [4.4.6](https://gitlab.gwdg.de/dariah-de/dariah-de-oai-pmh-services/compare/v4.4.5...v4.4.6) (2022-08-29)
### Bug Fixes
* change some identifier assignments ([574ed1a](https://gitlab.gwdg.de/dariah-de/dariah-de-oai-pmh-services/commit/574ed1aff30cd8f9b415ea061cf4e2ffda364b18))
* remove sysout, add FINE logging ([78ec0dd](https://gitlab.gwdg.de/dariah-de/dariah-de-oai-pmh-services/commit/78ec0dd589537430ab17fc3c8c91204f39fdb603))
## [4.4.5](https://gitlab.gwdg.de/dariah-de/dariah-de-oai-pmh-services/compare/v4.4.4...v4.4.5) (2022-08-19)
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>oaipmh</artifactId>
<groupId>info.textgrid.middleware</groupId>
<version>4.4.5</version>
<version>4.4.6</version>
</parent>
<artifactId>oaipmh-core</artifactId>
<packaging>jar</packaging>
......
......@@ -8,6 +8,7 @@ import java.text.ParseException;
import java.util.Hashtable;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
......@@ -41,6 +42,8 @@ import info.textgrid.middleware.oaipmh.ResumptionTokenType;
public class IDIOMImages implements RecordDelivererInterface, RecordListDelivererInterface,
IdentifierListDelivererInterface {
private static Logger log = Logger.getLogger(IDIOMImages.class.getName());
private String kindID;
private String perPage;
private String pageNumber;
......@@ -52,7 +55,9 @@ public class IDIOMImages implements RecordDelivererInterface, RecordListDelivere
/**
*
*/
public IDIOMImages() {}
public IDIOMImages() {
//
}
/**
*
......@@ -120,6 +125,7 @@ public class IDIOMImages implements RecordDelivererInterface, RecordListDelivere
}
imageMetsModsList.setResumptionToken(
buildResumptionToken(resumptionToken, getTotalHits(), useThisFrom, useThisTo));
return imageMetsModsList;
}
......@@ -174,27 +180,20 @@ public class IDIOMImages implements RecordDelivererInterface, RecordListDelivere
// ImageMetsMods imm = new ImageMetsMods(new ConedaKorID(id));
ImageMetsMods immByTGURI = null;
// System.out.println(id);
// TextGridUri asa = new TextGridUri();
System.out.println(" ++ id.1: " + id);
if (!id.startsWith("textgrid:")) {
id = "textgrid:" + id;
}
System.out.println(" ++ id.2: " + id);
log.fine("processing id: " + id);
try {
immByTGURI = new ImageMetsMods(new TextGridUri(id));
System.out
.println(" ++ image METS/MODS: " + immByTGURI.getID() + " / " + immByTGURI.getTitle());
log.fine("image id/title: " + immByTGURI.getID() + " / " + immByTGURI.getTitle());
builder = factory.newDocumentBuilder();
System.out
.println(" ++ immByTGURI: " + (immByTGURI != null ? immByTGURI.getXML() : "NULL"));
log.fine("immByTGURI: " + (immByTGURI != null ? immByTGURI.getXML() : "NULL"));
Document doc = builder.parse(new InputSource(new StringReader(immByTGURI.getXML())));
metadataMets.setAny(doc.getDocumentElement());
......@@ -211,7 +210,7 @@ public class IDIOMImages implements RecordDelivererInterface, RecordListDelivere
singleImageMetsMods.setRecord(conedaKorRecord);
} catch (ParserConfigurationException | SAXException | CrudClientException e) {
System.out.println("error " + e.getClass().getName() + ": " + e.getMessage());
log.severe("error! " + e.getClass().getName() + ": " + e.getMessage());
return null;
}
......
......@@ -54,8 +54,6 @@ public class IdentifierListDelivererIDIOM extends IdentifierListDelivererAbstrac
public ListIdentifiersType processIdentifierList(final String from, final String to,
final String set, final String resumptionToken) throws ParseException, IOException {
// String resTokenValue = resumptionToken;
ListIdentifiersType identifierList = new ListIdentifiersType();
BoolQueryBuilder recordFilterForClassicMayan;
......@@ -64,9 +62,8 @@ public class IdentifierListDelivererIDIOM extends IdentifierListDelivererAbstrac
RangeQueryBuilder rangeQuery = QueryBuilders.rangeQuery("lastModified").from(from).to(to);
BoolQueryBuilder test = QueryBuilders.boolQuery()
.must(QueryBuilders.matchPhraseQuery("project.id",
"TGPR-0e926f53-1aba-d415-ecf6-539edcd8a318"));
BoolQueryBuilder test = QueryBuilders.boolQuery().must(
QueryBuilders.matchPhraseQuery("project.id", "TGPR-0e926f53-1aba-d415-ecf6-539edcd8a318"));
BoolQueryBuilder artefact = QueryBuilders.boolQuery()
.must(QueryBuilders.matchPhraseQuery("format", "text/tg.inputform+rdf+xml"))
......
......@@ -585,8 +585,6 @@ public class OAIPMHUtilities {
}
}
log.fine(" ## omit prefix? " + identifier + " --> " + result);
return result;
}
......
......@@ -2,17 +2,20 @@ package info.textgrid.middleware;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import info.textgrid.middleware.oaipmh.RequestType;
/**
* @author Maximilian Brodhun, SUB Göttingen
* @author Stefan E. Funk, SUB Göttingen
* @version 2021-07-21
* @version 2022-08-29
* @since 2019-03-07
*/
public abstract class RecordDelivererAbstract implements RecordDelivererInterface {
protected static Logger log = Logger.getLogger(RecordDelivererAbstract.class.getName());
protected boolean textgrid;
protected boolean dariah;
......
......@@ -5,16 +5,19 @@ import java.io.StringReader;
import java.text.ParseException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.classicmayan.tools.ClassicMayanMetsMods;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.client.RequestOptions;
import org.elasticsearch.common.Strings;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import info.textgrid.middleware.oaipmh.GetRecordType;
import info.textgrid.middleware.oaipmh.HeaderType;
import info.textgrid.middleware.oaipmh.MetadataType;
......@@ -23,7 +26,7 @@ import info.textgrid.middleware.oaipmh.RecordType;
/**
* @author Maximilian Brodhun, SUB Göttingen
* @author Stefan E. Funk, SUB Göttingen
* @version 2022-08-17
* @version 2022-08-29
* @since 2019-03-12
*/
@Component
......@@ -109,42 +112,47 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
GetRecordType grt = new GetRecordType();
log.fine("identifier: " + id);
setDatestamps(id);
String textgridBaseURI_FromID;
// Get TG URI and TG base URI from ID.
String tgURI = id;
if (!id.startsWith("textgrid:")) {
textgridBaseURI_FromID = "textgrid:" + id.replace(".0", "");
} else {
textgridBaseURI_FromID = id;
tgURI = "textgrid:" + id;
}
String tgBaseURI = tgURI;
// FIXME Why we only replace ".0" here??
tgBaseURI = tgBaseURI.replace(".0", "");
log.fine("tg uri/base uri: " + tgURI + "/" + tgBaseURI);
log.fine("object type is: " + this.getObjectType());
if (this.getObjectType().equals("ARTEFACT")) {
this.metsmods = new ClassicMayanMetsMods(
textgridBaseURI_FromID,
tgBaseURI,
this.dateOfObjectCreation,
this.dateOfLastOblectModification);
this.record.setMetadata(idiomMets());
} else if (this.getObjectType().startsWith("ConedaKorMediumData")) {
GetRecordType idi = new IDIOMImages().getRecordById(id);
// Fixes #64
if (idi != null) {
this.record = idi.getRecord();
}
}
// See that IDs begin with "textgrid:"
String identifierToSet = "";
if (!id.startsWith("textgrid:")) {
identifierToSet = "textgrid:" + id;
} else {
identifierToSet = id;
}
// See, that IDs have NO revision number.
// FIXME Why we replace ALL revision numbers here?? Is there a difference to tgBaseURI with ".0"
// and ".n"??
String identifierToSet = tgURI;
if (identifierToSet.contains(".")) {
identifierToSet = identifierToSet.substring(0, identifierToSet.indexOf("."));
}
log.fine("identifier to set: " + identifierToSet);
// No setSpec needed here!
String setSpec = "";
HeaderType header =
......@@ -178,7 +186,10 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
builder = factory.newDocumentBuilder();
Document doc = builder.parse(new InputSource(new StringReader(this.metsmods.getMets())));
metadataMets.setAny(doc.getDocumentElement());
} catch (Exception e) {
} catch (JSONException | SAXException | IOException | ParseException
| ParserConfigurationException e) {
// TODO Auto-generated catch block
log.severe("error! " + e.getClass().getName() + ": " + e.getMessage());
e.printStackTrace();
}
......
......@@ -42,7 +42,7 @@ public class OaiPmhTextgridOnlineTests {
// **
private static final String PROPERTIES_FILE = "oaipmh.test.textgridlab-org.properties";
// NOTE/TODO There is NO IDIOM test data for testing on dev.textgridlab.org! So eventually all
// TODO There is NO IDIOM test data for testing on dev.textgridlab.org! So eventually all
// IDIOM tests will fail!
// private static final String PROPERTIES_FILE = "oaipmh.test.dev-textgridlab-org.properties";
......
......@@ -8,7 +8,7 @@ expectedGetRecordDC = Heidi
checkGetRecordIDIOM = textgrid:2sg18.0
expectedGetRecordIDIOM = Aguateca
checkGetRecordIDIOM_Images = textgrid:3x641.0
expectedGetRecordIDIOM_Images = Acanceh
expectedGetRecordIDIOM_Images = Aguateca
checkGetRecordDATACITE = textgrid:mq05.0
expectedGetRecordDATACITE = Weise Klugredenn
checkGetRecordIDList = textgrid:mq05.0, textgrid:jgv6.0, textgrid:w7rz.0, textgrid:w36b.0, textgrid:mcdv.0, textgrid:v0qx.0, textgrid:xkck.0, textgrid:t3m1.0, textgrid:10rsq.0, textgrid:mq05.0, textgrid:jgv6.0, textgrid:w7rz.0, textgrid:w36b.0, textgrid:mcdv.0, textgrid:v0qx.0, textgrid:xkck.0, textgrid:t3m1.0, textgrid:10rsq.0
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>oaipmh</artifactId>
<groupId>info.textgrid.middleware</groupId>
<version>4.4.5</version>
<version>4.4.6</version>
</parent>
<artifactId>oaipmh-webapp</artifactId>
<packaging>war</packaging>
......
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>info.textgrid.middleware</groupId>
<artifactId>oaipmh</artifactId>
<version>4.4.5</version>
<version>4.4.6</version>
<packaging>pom</packaging>
<name>DARIAHDE :: OAI-PMH DataProvider</name>
<properties>
......