finalising Actionset migration workflow

This commit is contained in:
Claudio Atzori 2020-04-20 16:45:21 +02:00
parent 9147af7fed
commit 667d23c58b
1 changed files with 8 additions and 3 deletions

View File

@ -16,6 +16,7 @@ import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
import java.io.IOException; import java.io.IOException;
import java.io.Serializable; import java.io.Serializable;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -101,9 +102,8 @@ public class TransformActions implements Serializable {
a -> a ->
eu.dnetlib.actionmanager.actions.AtomicAction.fromJSON( eu.dnetlib.actionmanager.actions.AtomicAction.fromJSON(
a._2().toString())) a._2().toString()))
.map(a -> doTransform(a)) .map(TransformActions::doTransform)
// .filter(Objects::isNull) .filter(Objects::nonNull)
// .filter(a -> a.getPayload() == null)
.mapToPair( .mapToPair(
a -> a ->
new Tuple2<>( new Tuple2<>(
@ -121,6 +121,11 @@ public class TransformActions implements Serializable {
private static AtomicAction doTransform(eu.dnetlib.actionmanager.actions.AtomicAction aa) private static AtomicAction doTransform(eu.dnetlib.actionmanager.actions.AtomicAction aa)
throws InvalidProtocolBufferException { throws InvalidProtocolBufferException {
// dedup similarity relations had empty target value, don't migrate them
if (aa.getTargetValue().length == 0) {
return null;
}
final OafProtos.Oaf proto_oaf = OafProtos.Oaf.parseFrom(aa.getTargetValue()); final OafProtos.Oaf proto_oaf = OafProtos.Oaf.parseFrom(aa.getTargetValue());
final Oaf oaf = ProtoConverter.convert(proto_oaf); final Oaf oaf = ProtoConverter.convert(proto_oaf);
switch (proto_oaf.getKind()) { switch (proto_oaf.getKind()) {