Skip to content

Commit

Permalink
Added the @JsonIgnoreProperties(ignoreUnknown = true) for all the zen…
Browse files Browse the repository at this point in the history
…odo json and updated the ROR url as the original one has a 301
  • Loading branch information
Camelia-Orcid committed Oct 27, 2023
1 parent 33928a0 commit ec68220
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ public class OrgDataClient {
public <T> T get(String url, String userAgent, Class<T> type) {
JerseyClientResponse<T, String> response = jerseyClientHelperForOrgLoaders.executeGetRequest(url, null, null, false, Map.of(), Map.of("User-Agent", userAgent), type, String.class);
int status = response.getStatus();
LOGGER.error("!!!!!!!!!!!!!!!!!!!! download file URL: " + url );

if (status != 200) {
LOGGER.warn("Unable to fetch file {}: {}", new Object[] { url, status });
LOGGER.error("Unable to fetch file {}: {}", new Object[] { url, status });
return null;
}
return response.getEntity();
Expand All @@ -47,8 +49,13 @@ public <T> T get(String url, String userAgent, Class<T> type) {
* @return boolean indicator of success
*/
public boolean downloadFile(String url, String userAgent, String localFilePath) {
LOGGER.error("!!!!!!!!!!!!!!!!!!!! download file URL: " + url + " localFile path " + localFilePath);
JerseyClientResponse<InputStream, String> response = jerseyClientHelperForOrgLoaders.executeGetRequest(url, null, null, false, Map.of(), Map.of("User-Agent", userAgent), InputStream.class, String.class);
System.out.println("!!!!! Inside download file");
int status = response.getStatus();
String statusStrs = response.toString();
System.out.println("!!!!! download file: " + statusStrs);
LOGGER.error("!!!!!!!!!!!!!!!!!!!! download file: " + statusStrs);
if (status != 200) {
LOGGER.warn("Unable to fetch file {}: {}", new Object[] { url, status });
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class RorOrgLoadSource implements OrgLoadSource {
@Resource
private OrgDisambiguatedExternalIdentifierDao orgDisambiguatedExternalIdentifierDao;

@Value("${org.orcid.core.orgs.ror.zenodoRecordsUrl:https://zenodo.org/api/records/?communities=ror-data}")
@Value("${org.orcid.core.orgs.ror.zenodoRecordsUrl:https://zenodo.org/api/records?communities=ror-data}")
private String rorZenodoRecordsUrl;

@Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(value = { "aggregations", "links" })
@JsonIgnoreProperties(ignoreUnknown = true)
public class ZenodoRecords {

@JsonProperty("hits")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.orcid.scheduler.loader.source.zenodo.api;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class ZenodoRecordsFile {

@JsonProperty("bucket")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.orcid.scheduler.loader.source.zenodo.api;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class ZenodoRecordsFileLinks {

@JsonProperty("self")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(value = { "metadata", "owners", "stats", "revision" })
@JsonIgnoreProperties(ignoreUnknown = true)
public class ZenodoRecordsHit {

@JsonProperty("conceptdoi")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package org.orcid.scheduler.loader.source.zenodo.api;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

@JsonIgnoreProperties(ignoreUnknown = true)
public class ZenodoRecordsHitLinks {

@JsonProperty("badge")
Expand Down
8 changes: 4 additions & 4 deletions properties/development.properties
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ org.orcid.core.orgs.fundref.latestReleaseUrl=https://some/path
org.orcid.core.orgs.fundref.localFilePath=/tmp/some/path

# ROR org imports
org.orcid.core.orgs.ror.enabled=false
org.orcid.core.orgs.ror.zenodoRecordsUrl=https://zenodo.org/api/records/?communities=ror-data
org.orcid.core.orgs.ror.localDataPath=/tmp/ror/ror.json
org.orcid.core.orgs.ror.localZipPath=/tmp/ror/ror.zip
org.orcid.core.orgs.ror.enabled=true
org.orcid.core.orgs.ror.zenodoRecordsUrl=https://zenodo.org/api/records?communities=ror-data
org.orcid.core.orgs.ror.localDataPath=/Users/camelia/Desktop/tmp/ror.json
org.orcid.core.orgs.ror.localZipPath=/Users/camelia/Desktop/tmp/ror.zip

################
# UI #
Expand Down

0 comments on commit ec68220

Please sign in to comment.