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;
|
||||
|
||||
public class MissingConceptDoiException extends Throwable {
|
||||
|
|
|
@ -12,14 +12,12 @@ import okhttp3.*;
|
|||
|
||||
public class ZenodoAPIClient implements Serializable {
|
||||
|
||||
|
||||
String urlString;
|
||||
String bucket;
|
||||
|
||||
String deposition_id;
|
||||
String access_token;
|
||||
|
||||
|
||||
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");
|
||||
|
@ -40,7 +38,9 @@ public class ZenodoAPIClient implements Serializable {
|
|||
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 {
|
||||
|
||||
|
@ -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
|
||||
*
|
||||
* @return response code
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -86,6 +87,7 @@ public class ZenodoAPIClient implements Serializable {
|
|||
|
||||
/**
|
||||
* Upload files in Zenodo.
|
||||
*
|
||||
* @param is the inputStream for the file to upload
|
||||
* @param file_name the name of the file as it will appear on Zenodo
|
||||
* @param len the size of the file
|
||||
|
@ -110,6 +112,7 @@ public class ZenodoAPIClient implements Serializable {
|
|||
|
||||
/**
|
||||
* Associates metadata information to the current deposition
|
||||
*
|
||||
* @param metadata the metadata
|
||||
* @return response code
|
||||
* @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
|
||||
*
|
||||
* @return response code
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -166,11 +170,12 @@ public class ZenodoAPIClient implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* To create a new version of an already published deposition.
|
||||
* It sets the deposition_id and the bucket to be used 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:
|
||||
* DOI: 10.xxx/zenodo.656930 concept_rec_id = 656930
|
||||
* To create a new version of an already published deposition. It sets the deposition_id and the bucket to be used
|
||||
* 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: DOI: 10.xxx/zenodo.656930
|
||||
* concept_rec_id = 656930
|
||||
* @return response code
|
||||
* @throws IOException
|
||||
* @throws MissingConceptDoiException
|
||||
|
@ -205,8 +210,8 @@ public class ZenodoAPIClient implements Serializable {
|
|||
|
||||
ZenodoModelList zenodoModelList = new Gson().fromJson(getPrevDepositions(), ZenodoModelList.class);
|
||||
|
||||
for(ZenodoModel zm : zenodoModelList){
|
||||
if (zm.getConceptrecid().equals(concept_rec_id)){
|
||||
for (ZenodoModel zm : zenodoModelList) {
|
||||
if (zm.getConceptrecid().equals(concept_rec_id)) {
|
||||
deposition_id = zm.getId();
|
||||
return;
|
||||
}
|
||||
|
@ -255,12 +260,10 @@ public class ZenodoAPIClient implements Serializable {
|
|||
// Get response body
|
||||
ZenodoModel zenodoModel = new Gson().fromJson(response.body().string(), ZenodoModel.class);
|
||||
|
||||
|
||||
return zenodoModel.getLinks().getBucket();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
package eu.dnetlib.dhp.common.api.zenodo;
|
||||
|
||||
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