Commit 5fe442f4 authored by Steinberg, Jan's avatar Steinberg, Jan

changed tatup filter for letting through every item with volume 19 issue 3 and higher

parent 90b8d8ec
...@@ -9,43 +9,49 @@ import org.slf4j.Logger; ...@@ -9,43 +9,49 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class Tatup2SsoarBundleFilter implements BundleFilter { public class Tatup2SsoarBundleFilter implements BundleFilter {
private final static Logger LOG = LoggerFactory.getLogger(Tatup2SsoarBundleFilter.class); private final static Logger LOG = LoggerFactory.getLogger(Tatup2SsoarBundleFilter.class);
/** /**
* Filter away everything published before 2017 * Filter away everything published before 2017
*/ */
@Override @Override
public boolean test(Bundle bundle) { public boolean test(Bundle bundle) {
boolean result; boolean result = false;
Set<Metadatum> metadata = bundle.getMetadata(); Set<Metadatum> metadata = bundle.getMetadata();
Metadatum dateIssued = metadata.stream().filter( m -> m.getKey().equals("dc.date.issued") ).findFirst().orElse(null); Metadatum volume = metadata.stream().filter(m -> m.getKey().equals("dc.source.volume")).findFirst()
if (null != dateIssued) { .orElse(null);
String dateIssuedString = dateIssued.getValue(); Metadatum issue = metadata.stream().filter(m -> m.getKey().equals("dc.source.issue")).findFirst().orElse(null);
if (null != volume) {
try { String volumeString = volume.getValue();
int dateIssuedValue = Integer.parseInt(dateIssuedString);
// for test changed to 2020 , normally it is 2017 try {
if ( dateIssuedValue >= 2017 ) { int volumeValue = Integer.parseInt(volumeString);
result = true; if (volumeValue > 19) {
} result = true;
else { } else if (volumeValue == 19) {
LOG.info("Tatup2SsoarBundleFilter - filtering away bundle.reference={}", bundle.getReference() ); if (null != issue) {
result = false; String issueString = issue.getValue();
} int issueValue = Integer.parseInt(issueString);
} if (issueValue >= 3) {
catch (NumberFormatException e) { result = true;
LOG.warn("unparsable dc.source.volume={} for bundle.reference={}", dateIssuedString, bundle.getReference() ); }
result = true; }
} } else {
LOG.info("Tatup2SsoarBundleFilter - filtering away bundle.reference={}", bundle.getReference());
} result = false;
else { }
result = true; } catch (NumberFormatException e) {
} LOG.warn("unparsable dc.source.volume={} for bundle.reference={}", volumeString, bundle.getReference());
result = true;
return result; }
}
} else {
result = true;
}
return result;
}
} }
This diff is collapsed.
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