From f9578312b5bd086d00bf6397ab1ae0262a8f8220 Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Thu, 18 Jun 2020 11:34:15 +0200 Subject: [PATCH] - --- .../dnetlib/dhp/oa/graph/dump/APIClient.java | 25 +++++++++---------- .../eu/dnetlib/dhp/oa/graph/dump/Mapper.java | 4 +-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/APIClient.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/APIClient.java index 56b54cf8e..ce479355d 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/APIClient.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/APIClient.java @@ -4,15 +4,6 @@ package eu.dnetlib.dhp.oa.graph.dump; import java.io.*; import java.io.IOException; -//import com.cloudera.org.apache.http.HttpResponse; -//import com.cloudera.org.apache.http.client.HttpClient; -//import com.cloudera.org.apache.http.client.methods.HttpPost; -//import com.cloudera.org.apache.http.entity.StringEntity; -//import com.cloudera.org.apache.http.impl.client.DefaultHttpClient; -//import com.cloudera.org.apache.http.util.EntityUtils; -import com.google.gson.Gson; - -import eu.dnetlib.dhp.oa.graph.dump.zenodo.ZenodoModel; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; @@ -26,6 +17,15 @@ import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; +// import com.cloudera.org.apache.http.HttpResponse; +// import com.cloudera.org.apache.http.client.HttpClient; +// import com.cloudera.org.apache.http.client.methods.HttpPost; +// import com.cloudera.org.apache.http.entity.StringEntity; +// import com.cloudera.org.apache.http.impl.client.DefaultHttpClient; +// import com.cloudera.org.apache.http.util.EntityUtils; +import com.google.gson.Gson; + +import eu.dnetlib.dhp.oa.graph.dump.zenodo.ZenodoModel; public class APIClient implements Serializable { @@ -54,15 +54,13 @@ public class APIClient implements Serializable { public APIClient(String urlString) throws IOException { this.urlString = urlString; - //connect(); + // connect(); } - public int connect() throws IOException { String json = "{}"; - client = new DefaultHttpClient(); HttpPost post = new HttpPost(urlString); @@ -92,7 +90,8 @@ public class APIClient implements Serializable { HttpEntity data = MultipartEntityBuilder.create().addBinaryBody(file_name, file).build(); post.setEntity(data); - //HttpUriRequest request = RequestBuilder.post(bucket + "/" + file_name +"?access_token=5ImUj0VC1ICg4ifK5dc3AGzJhcfAB4osxrFlsr8WxHXxjaYgCE0hY8HZcDoe").setEntity(data).build(); + // HttpUriRequest request = RequestBuilder.post(bucket + "/" + file_name + // +"?access_token=5ImUj0VC1ICg4ifK5dc3AGzJhcfAB4osxrFlsr8WxHXxjaYgCE0hY8HZcDoe").setEntity(data).build(); HttpResponse response = client.execute(post); System.out.println(response.getStatusLine().getStatusCode()); diff --git a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Mapper.java b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Mapper.java index 1c31b7d5a..4be1cd048 100644 --- a/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Mapper.java +++ b/dhp-workflows/dhp-graph-mapper/src/main/java/eu/dnetlib/dhp/oa/graph/dump/Mapper.java @@ -294,8 +294,8 @@ public class Mapper implements Serializable { .ifPresent(value -> instance.setPublicationdate(value.getValue())); Optional .ofNullable(i.getRefereed()) - // .ifPresent(value -> instance.setRefereed(value.getClassname())); - .ifPresent(value -> instance.setRefereed(value.getValue())); + .ifPresent(value -> instance.setRefereed(value.getClassname())); + // .ifPresent(value -> instance.setRefereed(value.getValue())); Optional .ofNullable(i.getInstancetype()) .ifPresent(value -> instance.setType(value.getClassname()));