Add new researchers external Source from ORCID

This commit is contained in:
George Kalampokis 2020-02-10 18:27:38 +02:00
parent 2116838c45
commit 5f0bd15d7c
4 changed files with 113 additions and 2 deletions

View File

@ -159,10 +159,11 @@ public class RemoteFetcher {
private String replaceCriteriaOnUrl(String path, ExternalUrlCriteria externalUrlCriteria, String firstPage) {
String completedPath = path;
if (externalUrlCriteria.getLike() != null) {
if (path.contains("openaire") && externalUrlCriteria.getLike().equals(""))
if ((path.contains("openaire") || path.contains("orcid")) && externalUrlCriteria.getLike().equals("")) {
completedPath = completedPath.replaceAll("\\{like}", "*");
else
} else {
completedPath = completedPath.replaceAll("\\{like}", externalUrlCriteria.getLike());
}
} else {
completedPath = completedPath.replace("{like}", "");
}
@ -186,6 +187,8 @@ public class RemoteFetcher {
}
if (externalUrlCriteria.getPageSize() != null) {
completedPath = completedPath.replace("{pageSize}", externalUrlCriteria.getPageSize());
} else if (path.contains("orcid")) {
completedPath = completedPath.replace("{pageSize}", "10");
} else {
completedPath = completedPath.replace("{pageSize}", "60");
}

View File

@ -0,0 +1,26 @@
package eu.eudat.models.data.external.orcid;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Arrays;
@XmlRootElement(name = "personal-details", namespace = "http://www.orcid.org/ns/personal-details")
public class PersonalDetails {
private PersonalName name;
public PersonalDetails(PersonalName name) {
this.name = name;
}
public PersonalDetails() {
}
@XmlElement(name="name", namespace = "http://www.orcid.org/ns/personal-details")
public PersonalName getName() {
return name;
}
public void setName(PersonalName name) {
this.name = name;
}
}

View File

@ -0,0 +1,44 @@
package eu.eudat.models.data.external.orcid;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name="name", namespace = "http://www.orcid.org/ns/personal-details")
public class PersonalName {
private String id;
private String givenNames;
private String familyName;
public PersonalName(String givenNames, String familyName) {
this.givenNames = givenNames;
this.familyName = familyName;
}
public PersonalName() {
}
@XmlAttribute(name = "path")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@XmlElement(name = "given-names", namespace = "http://www.orcid.org/ns/personal-details")
public String getGivenNames() {
return givenNames;
}
public void setGivenNames(String givenNames) {
this.givenNames = givenNames;
}
@XmlElement(name = "family-name", namespace = "http://www.orcid.org/ns/personal-details")
public String getFamilyName() {
return familyName;
}
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
}

View File

@ -642,6 +642,44 @@
</data>
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
</urlConfig>
<urlConfig>
<key>orcid</key>
<label>ORCID</label>
<ordinal>2</ordinal>
<type>External</type>
<url>https://pub.sandbox.orcid.org/v3.0/search/?q={like}&amp;start={page}&amp;rows={pageSize}</url>
<firstPage>1</firstPage>
<contenttype>application/json; charset=utf-8</contenttype>
<data>
<path>$['result'][*]['orcid-identifier']</path>
<fields>
<id>'id'</id>
<name>'name'</name>
<uri>'uri'</uri>
<path>'path'</path>
<host>'host'</host>
</fields>
<urlConfig>
<key>orcid</key>
<label>ORCID</label>
<ordinal>3</ordinal>
<type>External</type>
<url>https://pub.{host}/v3.0/{path}/personal-details</url>
<firstPage>1</firstPage>
<data>
<parse-class>eu.eudat.models.data.external.orcid.PersonalDetails</parse-class>
<parse-field>name</parse-field>
<merge-fields>
<field>givenNames</field>
<field>familyName</field>
</merge-fields>
<merge-field-name>name</merge-field-name>
</data>
<paginationpath>$['num-found']</paginationpath>
</urlConfig>
</data>
<paginationpath>$['num-found']</paginationpath>
</urlConfig>
<!-- <urlConfig>
<key>openAire</key>
<label>OpenAIRE</label>