Skip to content

Commit

Permalink
Fixed formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Camelia-Orcid committed Jun 3, 2024
1 parent ef2ee59 commit 1f3dd41
Showing 1 changed file with 20 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private boolean loadData() {
}
}
}
namesJson = namesNode.toString();
namesJson = namesNode.toString();
}

StringJoiner sj = new StringJoiner(",");
Expand All @@ -196,11 +196,11 @@ private boolean loadData() {
((ArrayNode) institute.get("types")).forEach(x -> sj.add(x.textValue()));
orgType = sj.toString();
}

//location node

ArrayNode locationsNode = institute.get("locations").isNull() ? null : (ArrayNode) institute.get("locations");

// location node

ArrayNode locationsNode = institute.get("locations").isNull() ? null
: (ArrayNode) institute.get("locations");
Iso3166Country country = null;
String region = null;
String city = null;
Expand All @@ -210,24 +210,23 @@ private boolean loadData() {
for (JsonNode locationJson : locationsNode) {
JsonNode geoDetailsNode = locationJson.get("geonames_details").isNull() ? null
: (JsonNode) locationJson.get("geonames_details");
if(geoDetailsNode !=null) {

if (geoDetailsNode != null) {
String countryCode = geoDetailsNode.get("country_code").isNull() ? null
: geoDetailsNode.get("country_code").asText();
country = StringUtils.isBlank(countryCode) ? null : Iso3166Country.fromValue(countryCode);
//for now storing just the first location
city = geoDetailsNode.get("name").isNull() ? null
: geoDetailsNode.get("name").asText();
if(country != null) {
country = StringUtils.isBlank(countryCode) ? null
: Iso3166Country.fromValue(countryCode);
// for now storing just the first location
city = geoDetailsNode.get("name").isNull() ? null : geoDetailsNode.get("name").asText();
if (country != null) {
break;
}
}

}
locationsJson = locationsNode.toString();
locationsJson = locationsNode.toString();
}



ArrayNode urls = institute.get("links").isNull() ? null : (ArrayNode) institute.get("links");
// Use the first URL
String url = (urls != null && urls.size() > 0) ? urls.get(0).asText() : null;
Expand Down Expand Up @@ -304,12 +303,11 @@ private OrgDisambiguatedEntity processInstitute(String sourceId, String name, Is
}

private void processExternalIdentifiers(OrgDisambiguatedEntity org, JsonNode institute) {
ArrayNode nodes = institute.get("external_ids") == null ? null : (ArrayNode) institute.get("external_ids");
if (nodes!= null) {
for(JsonNode entry:nodes){
ArrayNode nodes = institute.get("external_ids") == null ? null : (ArrayNode) institute.get("external_ids");
if (nodes != null) {
for (JsonNode entry : nodes) {
String identifierTypeName = entry.get("type").asText().toUpperCase();
String preferredId = entry.get("preferred").isNull() ? null
: entry.get("preferred").asText();
String preferredId = entry.get("preferred").isNull() ? null : entry.get("preferred").asText();
if (StringUtils.equalsIgnoreCase(OrgDisambiguatedSourceType.GRID.name(), identifierTypeName)) {
JsonNode extId = (JsonNode) entry.get("all");
setExternalId(org, identifierTypeName, preferredId, extId);
Expand Down

0 comments on commit 1f3dd41

Please sign in to comment.