From 667d23c58bb535a89fbdef9c0e10d76a1abb5b8c Mon Sep 17 00:00:00 2001 From: Claudio Atzori Date: Mon, 20 Apr 2020 16:45:21 +0200 Subject: [PATCH] finalising Actionset migration workflow --- .../dhp/actionmanager/migration/TransformActions.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-actionmanager/src/main/java/eu/dnetlib/dhp/actionmanager/migration/TransformActions.java b/dhp-workflows/dhp-actionmanager/src/main/java/eu/dnetlib/dhp/actionmanager/migration/TransformActions.java index 5001cff25..3226361cb 100644 --- a/dhp-workflows/dhp-actionmanager/src/main/java/eu/dnetlib/dhp/actionmanager/migration/TransformActions.java +++ b/dhp-workflows/dhp-actionmanager/src/main/java/eu/dnetlib/dhp/actionmanager/migration/TransformActions.java @@ -16,6 +16,7 @@ import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; import java.io.IOException; import java.io.Serializable; import java.util.LinkedList; +import java.util.Objects; import java.util.Optional; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; @@ -101,9 +102,8 @@ public class TransformActions implements Serializable { a -> eu.dnetlib.actionmanager.actions.AtomicAction.fromJSON( a._2().toString())) - .map(a -> doTransform(a)) - // .filter(Objects::isNull) - // .filter(a -> a.getPayload() == null) + .map(TransformActions::doTransform) + .filter(Objects::nonNull) .mapToPair( a -> new Tuple2<>( @@ -121,6 +121,11 @@ public class TransformActions implements Serializable { private static AtomicAction doTransform(eu.dnetlib.actionmanager.actions.AtomicAction aa) 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 Oaf oaf = ProtoConverter.convert(proto_oaf); switch (proto_oaf.getKind()) {