forked from D-Net/dnet-hadoop
refactoring due to compilation
This commit is contained in:
parent
de995970ea
commit
c7f944a533
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.common.api;
|
package eu.dnetlib.dhp.common.api;
|
||||||
|
|
||||||
public class MissingConceptDoiException extends Throwable {
|
public class MissingConceptDoiException extends Throwable {
|
||||||
|
|
|
@ -12,14 +12,12 @@ import okhttp3.*;
|
||||||
|
|
||||||
public class ZenodoAPIClient implements Serializable {
|
public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
String urlString;
|
String urlString;
|
||||||
String bucket;
|
String bucket;
|
||||||
|
|
||||||
String deposition_id;
|
String deposition_id;
|
||||||
String access_token;
|
String access_token;
|
||||||
|
|
||||||
|
|
||||||
public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
|
public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
|
||||||
|
|
||||||
private static final MediaType MEDIA_TYPE_ZIP = MediaType.parse("application/zip");
|
private static final MediaType MEDIA_TYPE_ZIP = MediaType.parse("application/zip");
|
||||||
|
@ -40,7 +38,9 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
this.bucket = bucket;
|
this.bucket = bucket;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDeposition_id(String deposition_id){this.deposition_id = deposition_id;}
|
public void setDeposition_id(String deposition_id) {
|
||||||
|
this.deposition_id = deposition_id;
|
||||||
|
}
|
||||||
|
|
||||||
public ZenodoAPIClient(String urlString, String access_token) throws IOException {
|
public ZenodoAPIClient(String urlString, String access_token) throws IOException {
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Brand new deposition in Zenodo. It sets the deposition_id and the bucket where to store the files to upload
|
* Brand new deposition in Zenodo. It sets the deposition_id and the bucket where to store the files to upload
|
||||||
|
*
|
||||||
* @return response code
|
* @return response code
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@ -86,6 +87,7 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload files in Zenodo.
|
* Upload files in Zenodo.
|
||||||
|
*
|
||||||
* @param is the inputStream for the file to upload
|
* @param is the inputStream for the file to upload
|
||||||
* @param file_name the name of the file as it will appear on Zenodo
|
* @param file_name the name of the file as it will appear on Zenodo
|
||||||
* @param len the size of the file
|
* @param len the size of the file
|
||||||
|
@ -110,6 +112,7 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Associates metadata information to the current deposition
|
* Associates metadata information to the current deposition
|
||||||
|
*
|
||||||
* @param metadata the metadata
|
* @param metadata the metadata
|
||||||
* @return response code
|
* @return response code
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
@ -140,6 +143,7 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To publish the current deposition. It works for both new deposition or new version of an old deposition
|
* To publish the current deposition. It works for both new deposition or new version of an old deposition
|
||||||
|
*
|
||||||
* @return response code
|
* @return response code
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
|
@ -166,11 +170,12 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* To create a new version of an already published deposition.
|
* To create a new version of an already published deposition. It sets the deposition_id and the bucket to be used
|
||||||
* It sets the deposition_id and the bucket to be used for the new version.
|
* for the new version.
|
||||||
* @param concept_rec_id the concept record id of the deposition for which to create a new version. It is
|
*
|
||||||
* the last part of the url for the DOI Zenodo suggests to use to cite all versions:
|
* @param concept_rec_id the concept record id of the deposition for which to create a new version. It is the last
|
||||||
* DOI: 10.xxx/zenodo.656930 concept_rec_id = 656930
|
* part of the url for the DOI Zenodo suggests to use to cite all versions: DOI: 10.xxx/zenodo.656930
|
||||||
|
* concept_rec_id = 656930
|
||||||
* @return response code
|
* @return response code
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* @throws MissingConceptDoiException
|
* @throws MissingConceptDoiException
|
||||||
|
@ -205,8 +210,8 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
|
|
||||||
ZenodoModelList zenodoModelList = new Gson().fromJson(getPrevDepositions(), ZenodoModelList.class);
|
ZenodoModelList zenodoModelList = new Gson().fromJson(getPrevDepositions(), ZenodoModelList.class);
|
||||||
|
|
||||||
for(ZenodoModel zm : zenodoModelList){
|
for (ZenodoModel zm : zenodoModelList) {
|
||||||
if (zm.getConceptrecid().equals(concept_rec_id)){
|
if (zm.getConceptrecid().equals(concept_rec_id)) {
|
||||||
deposition_id = zm.getId();
|
deposition_id = zm.getId();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -255,12 +260,10 @@ public class ZenodoAPIClient implements Serializable {
|
||||||
// Get response body
|
// Get response body
|
||||||
ZenodoModel zenodoModel = new Gson().fromJson(response.body().string(), ZenodoModel.class);
|
ZenodoModel zenodoModel = new Gson().fromJson(response.body().string(), ZenodoModel.class);
|
||||||
|
|
||||||
|
|
||||||
return zenodoModel.getLinks().getBucket();
|
return zenodoModel.getLinks().getBucket();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
package eu.dnetlib.dhp.common.api.zenodo;
|
package eu.dnetlib.dhp.common.api.zenodo;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
package eu.dnetlib.dhp.schema.dump.oaf.community;
|
||||||
|
|
||||||
|
public class CommunityInstance {
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
package eu.dnetlib.dhp.schema.dump.oaf.graph;
|
||||||
|
|
||||||
|
public class GraphResult {
|
||||||
|
}
|
Loading…
Reference in New Issue