Skip to content
Snippets Groups Projects
Commit e8ba8bdb authored by mbrodhu's avatar mbrodhu
Browse files

enable recordList

parent 250d615d
No related branches found
No related tags found
No related merge requests found
......@@ -12,8 +12,9 @@
<packaging>jar</packaging>
<name>DARIAHDE :: OAI-PMH DataProvider :: Core</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<dependencies>
<dependency>
<groupId>info.textgrid.middleware</groupId>
<artifactId>crud-common</artifactId>
<version>${tgcrud.version}</version>
......@@ -84,7 +85,7 @@
<dependency>
<groupId>org.classicmayan.tools</groupId>
<artifactId>metsModsMapping</artifactId>
<version>1.1.9</version>
<version>1.1.11</version>
</dependency>
<dependency>
<groupId>de.shadowhunt.maven.plugins</groupId>
......
......@@ -418,11 +418,11 @@ public class OAIPMHImpl implements OAIPMHProducer {
&& RecordListDelivererDC.cursorCollector.containsKey(request.getResumptionToken());
boolean restokIDIOMExisting = RecordListDelivererIDIOM.cursorCollector != null
&& RecordListDelivererIDIOM.cursorCollector.containsKey(request.getResumptionToken());
System.out.println("OAIIMPL: " + request.getResumptionToken());
if (restokDCExisting) {
recListDeliv = this.recordListDC;
} else if (restokIDIOMExisting) {
System.out.println("DUMDIDUM");
recListDeliv = this.recordListIDIOM;
}
}
......
......@@ -14,6 +14,7 @@ import info.textgrid.middleware.oaipmh.GetRecordType;
import info.textgrid.middleware.oaipmh.HeaderType;
import info.textgrid.middleware.oaipmh.MetadataType;
import info.textgrid.middleware.oaipmh.RecordType;
import info.textgrid.middleware.oaipmh.StatusType;
/**
*
......@@ -162,6 +163,8 @@ public class RecordDelivererIDIOM extends RecordDelivererAbstract {
recordHeader.setIdentifier(identifier);
recordHeader.setDatestamp(OAIPMHUtilities.datestampAsString(dateOfCreation));
this.record.setHeader(recordHeader);
//recordHeader.setStatus(StatusType.DELETED);
// return recordHeader;
}
......
......@@ -61,48 +61,6 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
* @see info.textgrid.middleware.RecordListDelivererInterface#getRecords(java.lang.String,
* java.lang.String, java.lang.String, java.lang.String)
*/
/* @Override
public ListRecordsType getRecords(final String from, final String to, final String set,
final String resumptionToken) {
String resTokenValue = resumptionToken;
log.info("Started List Records with booleans for DARIAH: " + this.dariah + " and TextGrid: "
+ this.textgrid);
ListRecordsType recordList = new ListRecordsType();
List<String> artefactURIs;
Queries queries = new Queries();
if (resumptionToken == null) {
artefactURIs = queries.getArtefactList(0);
// Create resumption token for every request only (we do need the same token for resuming
// because we are using a hash map for counting the calls).
resTokenValue = UUID.randomUUID().toString();
} else {
// Use given resumption token here.
artefactURIs = queries.getArtefactList(cursorCollector.get(resumptionToken));
}
long listSize = Queries.getAmountOfArtefacts();
int i = 0;
for (String artefactURI : artefactURIs) {
RecordDelivererIDIOM idiomRecord = new RecordDelivererIDIOM(true, false);
recordList.getRecord().add(idiomRecord.getRecordById(artefactURI).getRecord());
i++;
}
// Check the need for a resumption token!
ResumptionTokenType resTokenForResponse = OAIPMHUtilities.getResumptionToken(listSize,
resumptionToken, cursorCollector, resTokenValue, 30, i);
if (resTokenForResponse != null) {
recordList.setResumptionToken(resTokenForResponse);
}
return recordList;
}*/
@Override
public ListRecordsType getRecords(final String from, final String to, final String set,
......@@ -113,9 +71,9 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
QueryBuilder recordFilterForClassicMayan;
QueryBuilder rangeQuery;
Queries queries = new Queries();
List<String> artefactURIs = queries.getArtefactList();;
//List<String> artefactURIs = queries.getArtefactList();
rangeQuery = QueryBuilders.rangeQuery("created").from(from).to(to);
rangeQuery = QueryBuilders.rangeQuery("lastModified").from(from).to(to);
recordFilterForClassicMayan = QueryBuilders.boolQuery().must(rangeQuery)
.must(QueryBuilders.matchPhraseQuery("project.id", "TGPR-0e926f53-1aba-d415-ecf6-539edcd8a318"))
.must(QueryBuilders.matchPhraseQuery("format", "text/tg.inputform+rdf+xml"))
......@@ -127,7 +85,7 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
scrollResp = OAI_ESClient.getOaiESClient()
.prepareSearch("textgrid-nonpublic")
.setScroll(new TimeValue(60000))
.setScroll(TimeValue.timeValueHours(24L))
.setTypes(OAI_ESClient.getEsType())
.addFields("lastModified", "textgridUri", "project.id")
.setQuery(recordFilterForClassicMayan)
......@@ -135,9 +93,8 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
.execute()
.actionGet();
}else {
System.out.println("resumptionToken for res: " + resumptionToken);
scrollResp = OAI_ESClient.getOaiESClient().prepareSearchScroll(resumptionToken)
.setScroll(new TimeValue(60000)).execute().actionGet();
.setScroll(TimeValue.timeValueHours(24L)).execute().actionGet();
}
String scrollID = scrollResp.getScrollId();
......@@ -150,16 +107,16 @@ public class RecordListDelivererIDIOM extends RecordListDelivererAbstract {
int i = 0;
//System.out.println("inside ");
for (SearchHit hit : scrollResp.getHits().getHits()) {
i++;
String textgridURI = hit.getFields().get("textgridUri").getValue().toString().replace(".0", "");
if(artefactURIs.contains(textgridURI)) {
RecordDelivererIDIOM idiomRecord = new RecordDelivererIDIOM(true, false);
recordList.getRecord().add(idiomRecord.getRecordById(textgridURI).getRecord());
}
System.out.println("Processing: " + textgridURI);
RecordDelivererIDIOM idiomRecord = new RecordDelivererIDIOM(true, false);
recordList.getRecord().add(idiomRecord.getRecordById(textgridURI).getRecord());
}
// Check the need for a resumption token!
System.out.println("resumptionToken: " + resumptionToken);
ResumptionTokenType resTokenForResponse = OAIPMHUtilities.getResumptionToken(
completeListSize, resumptionToken, cursorCollector, scrollID, 30, i);
if (resTokenForResponse != null) {
......
......@@ -77,6 +77,7 @@
<artifactId>oaipmh-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<finalName>oaipmh</finalName>
......
......@@ -22,12 +22,13 @@
<maven-antrun-plugin.version>1.3</maven-antrun-plugin.version>
<jaxb2-maven-plugin.version>2.5.0</jaxb2-maven-plugin.version>
<maven-deploy-plugin.version>2.8.2</maven-deploy-plugin.version>
<maven-compiler-plugin.version>3.0</maven-compiler-plugin.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
<jetty-maven-plugin.version>9.4.12.v20180830</jetty-maven-plugin.version>
<maven-eclipse-plugin.version>2.9</maven-eclipse-plugin.version>
<properties-maven-plugin.version>1.0-alpha-2</properties-maven-plugin.version>
</properties>
<url>https://projects.gwdg.de/projects/oai-pmh</url>
<scm>
<connection>scm:git@git.projects.gwdg.de:oai-pmh.git</connection>
<developerConnection>scm:git@git.projects.gwdg.de:oai-pmh.git</developerConnection>
......@@ -78,6 +79,28 @@
<artifactId>maven-deploy-plugin</artifactId>
<version>${maven-deploy-plugin.version}</version>
</plugin>
<!--plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>chronos-jmeter-maven-plugin</artifactId>
<version>1.1.0</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.15</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>jmeter</goal>
</goals>
</execution>
</executions>
</plugin-->
</plugins>
</build>
<modules>
......
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