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;
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);
// for test changed to 2020 , normally it is 2017
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;
}
private final static Logger LOG = LoggerFactory.getLogger(Tatup2SsoarBundleFilter.class);
/**
* Filter away everything published before 2017
*/
@Override
public boolean test(Bundle bundle) {
boolean result = false;
Set<Metadatum> metadata = bundle.getMetadata();
Metadatum volume = metadata.stream().filter(m -> m.getKey().equals("dc.source.volume")).findFirst()
.orElse(null);
Metadatum issue = metadata.stream().filter(m -> m.getKey().equals("dc.source.issue")).findFirst().orElse(null);
if (null != volume) {
String volumeString = volume.getValue();
try {
int volumeValue = Integer.parseInt(volumeString);
if (volumeValue > 19) {
result = true;
} else if (volumeValue == 19) {
if (null != issue) {
String issueString = issue.getValue();
int issueValue = Integer.parseInt(issueString);
if (issueValue >= 3) {
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={}", volumeString, bundle.getReference());
result = true;
}
} 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