Commit 2af3c4e1 authored by Steinberg, Jan's avatar Steinberg, Jan

adding tatup filter for date issued >= 2017

parent 29e94a85
......@@ -12,6 +12,7 @@ import org.gesis.dda.filter.impl.Doabooks2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Fqs2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Jfr2SsoarBundleFilter;
import org.gesis.dda.filter.impl.SsoarTargetRepositoryBundleFilter;
import org.gesis.dda.filter.impl.Tatup2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Wbv2SsoarBundleFilter;
import org.gesis.dda.filter.impl.Wzb2SsoarBundleFilter;
import org.gesis.dda.persist.PersistableHelper;
......@@ -150,6 +151,10 @@ public class FeedingContextFactory {
log.info("using Doabooks2SsoarBundleFilter");
result = new Doabooks2SsoarBundleFilter();
break;
case "https://www.tatup.de/index.php/tatup/oai$$ssoar":
log.info("using Tatup2SsoarBundleFilter");
result = new Tatup2SsoarBundleFilter();
break;
default:
log.debug("using default IdentityMetadataTransformer");
result = new AcceptAnyBundleFilter();
......
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 Tatup2SsoarBundleFilter implements BundleFilter {
private final static Logger LOG = LoggerFactory.getLogger(Tatup2SsoarBundleFilter.class);
/**
* Filter away everything published before 2017
*/
@Override
public boolean test(Bundle bundle) {
boolean result;
Set<Metadatum> metadata = bundle.getMetadata();
Metadatum dateIssued = metadata.stream().filter( m -> m.getKey().equals("dc.date.issued") ).findFirst().orElse(null);
if (null != dateIssued) {
String dateIssuedString = dateIssued.getValue();
try {
int dateIssuedValue = Integer.parseInt(dateIssuedString);
if ( dateIssuedValue >= 2017 ) {
result = true;
}
else {
LOG.info("Tatup2SsoarBundleFilter - filtering away bundle.reference={}", bundle.getReference() );
result = false;
}
}
catch (NumberFormatException e) {
LOG.warn("unparsable dc.source.volume={} for bundle.reference={}", dateIssuedString, bundle.getReference() );
result = true;
}
}
else {
result = true;
}
return result;
}
}
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