Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DDA
dda-wizard
Commits
323c31e6
Commit
323c31e6
authored
May 11, 2018
by
Gerrit Hübbers
🃏
Browse files
Fix FQS bundle filtering to be based on correct volume number
parent
1c39370d
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gesis/dda/filter/impl/Fqs2SsoarBundleFilter.java
View file @
323c31e6
...
...
@@ -5,28 +5,42 @@ 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
Fqs2SsoarBundleFilter
implements
BundleFilter
{
private
final
static
Logger
LOG
=
LoggerFactory
.
getLogger
(
Fqs2SsoarBundleFilter
.
class
);
/**
* SSOAR already has everything up to and including dc.source.volume=1
6
dc.source.issue=3 ->
* there are only three issues in volume=1
6
-> therefore:
if volume <= 16, then filter away bundle
* SSOAR already has everything up to and including dc.source.volume=1
7
dc.source.issue=3 ->
* there are only three issues in volume=1
7
-> therefore:
harvest everything starting with volume>=18
*/
@Override
public
boolean
test
(
Bundle
bundle
)
{
boolean
result
;
Set
<
Metadatum
>
metadata
=
bundle
.
getMetadata
();
Metadatum
volume
=
metadata
.
stream
().
filter
(
m
->
m
.
getKey
().
equals
(
"dc.source.volume"
)
).
findFirst
().
orElse
(
null
);
if
(
null
!=
volume
)
{
String
volumeValueString
=
volume
.
getValue
();
int
volumeValue
=
Integer
.
parseInt
(
volumeValueString
);
if
(
volumeValue
<=
16
)
{
result
=
false
;
try
{
int
volumeValue
=
Integer
.
parseInt
(
volumeValueString
);
if
(
volumeValue
>=
18
)
{
result
=
true
;
}
else
{
LOG
.
info
(
"filtering away bundle.reference={}"
,
bundle
.
getReference
()
);
result
=
false
;
}
}
else
{
catch
(
NumberFormatException
e
)
{
LOG
.
warn
(
"unparsable dc.source.volume={} for bundle.reference={}"
,
volumeValueString
,
bundle
.
getReference
()
);
result
=
true
;
}
}
else
{
result
=
true
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment