Improving solution
This commit is contained in:
parent
d75bbb53e8
commit
97b7b50bf1
|
@ -404,9 +404,8 @@ public class ZenodoSoftwareVersionExporter extends SoftwareVersionExporter {
|
||||||
gxHTTPStringRequest.header("Content-Type", "application/json");
|
gxHTTPStringRequest.header("Content-Type", "application/json");
|
||||||
gxHTTPStringRequest.header("Accept", "application/json");
|
gxHTTPStringRequest.header("Accept", "application/json");
|
||||||
|
|
||||||
String conceptDOI = softwareVersionConfig.getConceptDOIURL();
|
String conceptDOIURL = softwareVersionConfig.getConceptDOIURL();
|
||||||
|
String conceptID = getZenodoIDFromDOIURL(conceptDOIURL);
|
||||||
String conceptID = getZenodoIDFromDOIURL(softwareVersionConfig.getConceptDOIURL());
|
|
||||||
gxHTTPStringRequest.path(RECORD_PATH.replace(":id", conceptID));
|
gxHTTPStringRequest.path(RECORD_PATH.replace(":id", conceptID));
|
||||||
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
HttpURLConnection httpURLConnection = gxHTTPStringRequest.get();
|
||||||
JsonNode jsonNode = getResponse(httpURLConnection);
|
JsonNode jsonNode = getResponse(httpURLConnection);
|
||||||
|
|
|
@ -22,6 +22,8 @@ import org.gcube.common.software.utils.Utils;
|
||||||
*/
|
*/
|
||||||
public class SoftwareVersionConfig {
|
public class SoftwareVersionConfig {
|
||||||
|
|
||||||
|
public static final String PREVIOUS_CONCEPT_DOI_VALUE = "PREVIOUS";
|
||||||
|
|
||||||
public static final String NAME_PROPERTY_NAME = "name";
|
public static final String NAME_PROPERTY_NAME = "name";
|
||||||
public static final String VERSION_PROPERTY_NAME = "version";
|
public static final String VERSION_PROPERTY_NAME = "version";
|
||||||
public static final String TITLE_PROPERTY_NAME = "title";
|
public static final String TITLE_PROPERTY_NAME = "title";
|
||||||
|
@ -176,6 +178,13 @@ public class SoftwareVersionConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConceptDOIURL() {
|
public String getConceptDOIURL() {
|
||||||
|
if(conceptDOIURL!=null && conceptDOIURL.compareTo(PREVIOUS_CONCEPT_DOI_VALUE)==0) {
|
||||||
|
if(previous!=null) {
|
||||||
|
conceptDOIURL = previous.getConceptDOIURL();
|
||||||
|
}else {
|
||||||
|
throw new RuntimeException(CONCEPT_DOI_URL_PROPERTY_NAME + " is indicates as " + PREVIOUS_CONCEPT_DOI_VALUE + " but " + getTitle() + " has no previous. Please check you config.");
|
||||||
|
}
|
||||||
|
}
|
||||||
return conceptDOIURL;
|
return conceptDOIURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue