This commit is contained in:
Miriam Baglioni 2020-06-18 11:34:15 +02:00
parent 8b145e6aba
commit f9578312b5
2 changed files with 14 additions and 15 deletions

View File

@ -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());

View File

@ -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()));