Commit 73c11e6a authored by Fischer, Tim's avatar Fischer, Tim
Browse files

Date filter for budrich, only 2012 to 2019

parent 0f428d01
......@@ -8,6 +8,7 @@ import org.gesis.dda.feeder.NextIncrementalHarvestingIntervalStrategy;
import org.gesis.dda.filter.BundleFilter;
import org.gesis.dda.filter.impl.AcceptAnyBundleFilter;
import org.gesis.dda.filter.impl.Aseas2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Budrich2SSOARBundleFilter;
import org.gesis.dda.filter.impl.Doabooks2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Fqs2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Jfr2SsoarBundleFilter;
......@@ -137,6 +138,10 @@ public class FeedingContextFactory {
log.info("using Aseas2SsoarBundleFilter");
result = new Aseas2SsoarBundleFilter();
break;
case "https://www.budrich-journals.de/index.php/fgs/oai/$$ssoar":
log.info("using Budrich2SSOARBundleFilter");
result = new Budrich2SSOARBundleFilter();
break;
case "https://ubp.uni-bamberg.de/jfr/index.php/jfr/oai/$$ssoar":
case "https://ubp.uni-bamberg.de/jfr/index.php/jfr/oai$$ssoar":
log.info("using Jfr2SsoarBundleFilter");
......
package org.gesis.dda.filter.impl;
import java.util.Set;
import org.gesis.dda.filter.BundleFilter;
import org.gesis.dda.publishing.domain.Bundle;
import org.gesis.dda.publishing.domain.Metadatum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class Budrich2SSOARBundleFilter implements BundleFilter {
private final static Logger LOG = LoggerFactory.getLogger(Budrich2SSOARBundleFilter.class);
/**
* FZG is only supposed to be harvested between 2012 and 2019
*/
@Override
public boolean test(Bundle bundle) {
boolean harvest = false;
Set<Metadatum> metadata = bundle.getMetadata();
Metadatum yearIssued = metadata.stream().filter( m -> m.getKey().equals("dc.date.issued") ).findFirst().orElse(null);
if (null != yearIssued) {
String yearIssuedValueString = yearIssued.getValue();
LOG.debug("year issued: {}", yearIssuedValueString);
try {
int yearIssuedValue = Integer.parseInt(yearIssuedValueString);
if ( yearIssuedValue >= 2012 && yearIssuedValue <= 2019 ) {
LOG.info("Budrich2SSOARBundleFilter - '{}' is newer than 2012 but older than 2020", yearIssuedValueString);
harvest = true;
}
}
catch (NumberFormatException e) {
LOG.warn("Budrich2SSOARBundleFilter - unparsable dc.date.issued={} for bundle.reference={}", yearIssuedValueString, bundle.getReference() );
}
}
return harvest;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment