From b847389b96f153ce15c2fa5f3ecda3e1764af637 Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Fri, 11 Sep 2020 12:07:49 +0300 Subject: [PATCH 1/2] Add ORCID source to all the profiles and replace the content type from xml to json --- .../config/DataFieldsUrlConfiguration.java | 18 +++++++ .../logic/proxy/fetching/RemoteFetcher.java | 11 ++++ .../resources/externalUrls/ExternalUrls.xml | 54 +++---------------- .../externalUrls/ExternalUrlsProduction.xml | 19 +++++++ .../externalUrls/ExternalUrlsStaging.xml | 19 +++++++ 5 files changed, 75 insertions(+), 46 deletions(-) diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/DataFieldsUrlConfiguration.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/DataFieldsUrlConfiguration.java index 7c746fb85..e027714ed 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/DataFieldsUrlConfiguration.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/config/DataFieldsUrlConfiguration.java @@ -15,6 +15,8 @@ public class DataFieldsUrlConfiguration { private String path; private String host; private String types; + private String firstName; + private String lastName; public String getId() { return id; @@ -94,4 +96,20 @@ public class DataFieldsUrlConfiguration { public void setTypes(String types) { this.types = types; } + + @XmlElement(name = "firstName") + public String getFirstName() { + return firstName; + } + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + @XmlElement(name = "lastName") + public String getLastName() { + return lastName; + } + public void setLastName(String lastName) { + this.lastName = lastName; + } } diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java index 9428c8255..27ed3a22e 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/proxy/fetching/RemoteFetcher.java @@ -341,6 +341,17 @@ public class RemoteFetcher { results = new Results(finalRes, new HashMap<>(1, 1)); + } else if (jsonDataPath.getFieldsUrlConfiguration().getFirstName() != null) { + results = new Results(jsonContext.read(jsonDataPath.getPath() + + "[" + jsonDataPath.getFieldsUrlConfiguration().getId() + "," + jsonDataPath.getFieldsUrlConfiguration().getFirstName() + + "," + jsonDataPath.getFieldsUrlConfiguration().getLastName() + "]"), + new HashMap<>(1, 1)); + results.getResults().stream().forEach(entry -> { + String name = entry.get(jsonDataPath.getFieldsUrlConfiguration().getFirstName().replace("'", "")) + " " + entry.get(jsonDataPath.getFieldsUrlConfiguration().getLastName().replace("'", "")); + entry.put("name", name); + entry.remove(jsonDataPath.getFieldsUrlConfiguration().getFirstName().replace("'", "")); + entry.remove(jsonDataPath.getFieldsUrlConfiguration().getLastName().replace("'", "")); + }); } else { results = new Results(jsonContext.read(jsonDataPath.getPath() + "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription() diff --git a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml index b53a0384e..f923a737a 100644 --- a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml +++ b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml @@ -697,44 +697,6 @@ $['meta']['pagination']['page','pages','count'] - orcid @@ -742,15 +704,15 @@ External https://pub.sandbox.orcid.org/v3.0/expanded-search/?q={like}&start={page}&rows={pageSize} 0 - application/vnd.orcid+xml; qs=5;charset=UTF-8 + application/json; charset=UTF-8 - eu.eudat.models.data.external.orcid.ExpandedSearch - expandedResults - - givenNames - familyName - - name + $['expanded-result'][*] + + 'orcid-id' + 'given-names' + 'family-names' + 'name' + $['num-found'] diff --git a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsProduction.xml b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsProduction.xml index ecd11ddb9..3dbc98913 100644 --- a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsProduction.xml +++ b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsProduction.xml @@ -223,6 +223,25 @@ $['meta']['pagination']['page','pages','count'] + + orcid + + 2 + External + https://pub.orcid.org/v3.0/expanded-search/?q={like}&start={page}&rows={pageSize} + 0 + application/json; charset=UTF-8 + + $['expanded-result'][*] + + 'orcid-id' + 'given-names' + 'family-names' + 'name' + + + $['num-found'] + FIRST diff --git a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsStaging.xml b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsStaging.xml index 6f942f028..b5080c894 100644 --- a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsStaging.xml +++ b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsStaging.xml @@ -235,6 +235,25 @@ $['meta']['pagination']['page','pages','count'] + + orcid + + 2 + External + https://pub.orcid.org/v3.0/expanded-search/?q={like}&start={page}&rows={pageSize} + 0 + application/json; charset=UTF-8 + + $['expanded-result'][*] + + 'orcid-id' + 'given-names' + 'family-names' + 'name' + + + $['num-found'] + FIRST From e9db95af4a1f3a5fcb0855e49365192dcf2d477d Mon Sep 17 00:00:00 2001 From: George Kalampokis Date: Fri, 11 Sep 2020 12:10:11 +0300 Subject: [PATCH 2/2] Improve language Editor styling --- .../src/app/ui/language-editor/language-editor.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dmp-frontend/src/app/ui/language-editor/language-editor.component.html b/dmp-frontend/src/app/ui/language-editor/language-editor.component.html index 655293b39..69239e044 100644 --- a/dmp-frontend/src/app/ui/language-editor/language-editor.component.html +++ b/dmp-frontend/src/app/ui/language-editor/language-editor.component.html @@ -12,7 +12,7 @@
- + {{key}} :