Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,16 @@ public List<OAIRecord> findDeletedOaiRecordsBySetName(String setName) {
}
}

public Instant getEarliestDate() {
String queryString = "SELECT min(r.lastUpdateTime) FROM OAIRecord r";
TypedQuery<Date> query = em.createQuery(queryString, Date.class);
Date retDate = query.getSingleResult();
if (retDate != null) {
return retDate.toInstant();
}

// if there are no records yet, return the default "now"
return new Date().toInstant();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ private RepositoryConfiguration createRepositoryConfiguration() {
}
// The admin email address associated with this installation:
// (Note: if the setting does not exist, we are going to assume that they
// have a reason not to want to advertise their email address.
// have a reason not to want to configure their email address, if it is
// a developer's instance, for example; or a reason not to want to
// advertise it to the world.)
InternetAddress systemEmailAddress = MailUtil.parseSystemAddress(settingsService.getValueForKey(SettingsServiceBean.Key.SystemEmail));
String systemEmailLabel = systemEmailAddress != null ? systemEmailAddress.getAddress() : "donotreply@localhost";

Expand All @@ -207,15 +209,14 @@ private RepositoryConfiguration createRepositoryConfiguration() {
.withResumptionTokenFormat(new SimpleResumptionTokenFormat().withGranularity(Granularity.Second))
.withRepositoryName(repositoryName)
.withBaseUrl(systemConfig.getDataverseSiteUrl()+"/oai")
.withEarliestDate(Instant.EPOCH) // this is NOT something we really want to be doing, but this will be corrected once PR9316 is merged
.withEarliestDate(recordService.getEarliestDate())
.withMaxListIdentifiers(maxListIdentifiers)
.withMaxListSets(maxListSets)
.withMaxListRecords(maxListRecords)
.withDeleteMethod(DeletedRecord.TRANSIENT)
.withEnableMetadataAttributes(true)
.withRequireFromAfterEarliest(false)
.build();

.build();

return configuration;
}
Expand Down