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

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

parent 90b8d8ec
Loading
Loading
Loading
Loading

.attach_pid10635

0 → 100644
+0 −0

Empty file added.

.attach_pid17913

0 → 100644
+0 −0

Empty file added.

.attach_pid32277

0 → 100644
+0 −0

Empty file added.

.attach_pid8686

0 → 100644
+0 −0

Empty file added.

+45 −39
Original line number Diff line number Diff line
@@ -18,30 +18,36 @@ public class Tatup2SsoarBundleFilter implements BundleFilter {
	@Override
	public boolean test(Bundle bundle) {

        boolean result;
		boolean result = false;
		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();
		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 dateIssuedValue = Integer.parseInt(dateIssuedString);
                // for test changed to 2020 , normally it is 2017 
                if ( dateIssuedValue >= 2017 ) {
				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 {
				} 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() );
			} catch (NumberFormatException e) {
				LOG.warn("unparsable dc.source.volume={} for bundle.reference={}", volumeString, bundle.getReference());
				result = true;
			}

        }
        else {
		} else {
			result = true;
		}

Loading