From d86adb82a750c84db53a7b15beb66c5dee9f171b Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Tue, 7 Jul 2020 18:20:51 +0200 Subject: [PATCH] - --- .../eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java index 64cbe41c0..a4ffca2ef 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/SendToZenodo.java @@ -3,6 +3,7 @@ package eu.dnetlib.dhp.oa.graph.dump; import java.io.File; import java.io.Serializable; +import java.util.Arrays; import javax.management.Query; @@ -15,7 +16,10 @@ import org.apache.hadoop.fs.LocatedFileStatus; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.RemoteIterator; +import com.google.gson.Gson; + import eu.dnetlib.dhp.application.ArgumentApplicationParser; +import eu.dnetlib.dhp.oa.graph.dump.zenodo.*; import eu.dnetlib.dhp.utils.ISLookupClientFactory; public class SendToZenodo implements Serializable { @@ -61,14 +65,13 @@ public class SendToZenodo implements Serializable { String tmp = p_string.substring(0, p_string.lastIndexOf("/")); String community = tmp.substring(tmp.lastIndexOf("/") + 1); log.info("Sending information for community: " + community); - String community_name = communityMap.get(community).replace(" ", "_"); + String community_name = communityMap.get(community).replace(" ", "_") + ".zip"; log.info("Copying information for community: " + community); fileSystem.copyToLocalFile(p, new Path("/tmp/" + community_name)); File f = new File("/tmp/" + community_name); try { apiClient.upload(f, community_name); - apiClient.sendMretadata(metadata); - apiClient.publish(); + } catch (Exception e) { if (f.exists()) { log.info("Deleting information for community: " + community); @@ -82,6 +85,9 @@ public class SendToZenodo implements Serializable { } } + apiClient.sendMretadata(metadata); + apiClient.publish(); + } }