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 f795ea10d..2b0b6c2c1 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 @@ -190,11 +190,10 @@ public class RemoteFetcher { if (funderId.toCharArray()[0] == ':') { funderId = externalUrlCriteria.getFunderId(); } - try { - funderId = URLEncoder.encode(funderId, "UTF-8"); - } catch (UnsupportedEncodingException e) { - logger.error(e.getMessage(), e); - } + /* + try { funderId = URLEncoder.encode(funderId, "UTF-8"); } catch + (UnsupportedEncodingException e) { logger.error(e.getMessage(), e); } + */ completedPath = completedPath.replace("{funderId}", funderId); } if (externalUrlCriteria.getPage() != null) { @@ -260,12 +259,12 @@ public class RemoteFetcher { RestTemplate restTemplate = new RestTemplate(); HttpHeaders headers = new HttpHeaders(); HttpEntity entity; - ResponseEntity response; + ResponseEntity response; /* - URL url = new URL(urlString.replaceAll(" ", "%20")); - - HttpURLConnection con = (HttpURLConnection) url.openConnection(); - con.setRequestMethod("GET"); + * URL url = new URL(urlString.replaceAll(" ", "%20")); + * + * HttpURLConnection con = (HttpURLConnection) url.openConnection(); + * con.setRequestMethod("GET"); */ if (contentType != null && !contentType.isEmpty()) { headers.setAccept(Collections.singletonList(MediaType.valueOf(contentType))); @@ -273,11 +272,7 @@ public class RemoteFetcher { entity = new HttpEntity<>("parameters", headers); - if (contentType.contains("json")) { - response = restTemplate.exchange(urlString, HttpMethod.GET, entity, Object.class); - } else { - response = restTemplate.exchange(urlString, HttpMethod.GET, entity, String.class); - } + response = restTemplate.exchange(urlString, HttpMethod.GET, entity, String.class); if (response.getStatusCode() == HttpStatus.OK) { // success //do here all the parsing Results results = new Results(); @@ -387,7 +382,7 @@ public class RemoteFetcher { Class aClass = Class.forName(jsonDataPath.getParseClass()); JAXBContext jaxbContext = JAXBContext.newInstance(aClass); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - StringReader stringReader = new StringReader(response.getBody().toString()); + StringReader stringReader = new StringReader(response.getBody()); Object data = unmarshaller.unmarshal(stringReader); Method reader = null; if (jsonDataPath.getParseField() != null && !jsonDataPath.getParseField().isEmpty()) { diff --git a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml index f923a737a..5c128c86d 100644 --- a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml +++ b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrls.xml @@ -149,8 +149,8 @@ openaire 1 - https://services.openaire.eu/search/v2/api/resources?query=((oaftype%20exact%20project)%20and%20((projectcode_nt%20exact%20%22{like}%22)or({like}))){funderQuery}&page={page}&size={pageSize}&format=json - &fq=(funder%20exact%20%22{funderId}%22) + https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "{like}")or({like}))){funderQuery}&page={page}&size={pageSize}&format=json + &fq=(funder exact "{funderId}") 0 application/json; charset=utf-8 @@ -228,7 +228,7 @@ 1 External - https://services.openaire.eu/search/v2/api/resources?query=((oaftype%20exact%20project)%20and%20((projectcode_nt%20exact%20%22*%22)or(*)))&fq=(funder%20exact%20{funderId})&page={page}&size={pageSize}&format=json + https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "*")or(*)))&fq=(funder exact {funderId})&page={page}&size={pageSize}&format=json 0 application/json; charset=utf-8 @@ -501,7 +501,7 @@ 1 External - https://services.openaire.eu/search/v2/api/datasources?q={like}&fq=datasourcetypeuiname%20exact%20%22Data%20Repository%22&page={page}&size={pageSize}&format=json + https://services.openaire.eu/search/v2/api/datasources?q={like}&fq=datasourcetypeuiname exact "Data Repository"&page={page}&size={pageSize}&format=json 0 application/json;charset=UTF-8 @@ -519,7 +519,7 @@ 1 External - https://services.openaire.eu/search/v2/api/resources?query=oaftype%20exact%20datasource%20and%20{like}&page={page}&size={pageSize}&format=json + https://services.openaire.eu/search/v2/api/resources?query=oaftype exact datasource and {like}&page={page}&size={pageSize}&format=json 0 application/json;charset=UTF-8 diff --git a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsProduction.xml b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsProduction.xml index 3dbc98913..268efc5bd 100644 --- a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsProduction.xml +++ b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsProduction.xml @@ -58,8 +58,8 @@ openAIRE 1 - https://services.openaire.eu/search/v2/api/resources?query=((oaftype%20exact%20project)%20and%20((projectcode_nt%20exact%20%22{like}%22)or({like}))){funderQuery}&page={page}&size={pageSize}&format=json - &fq=(funder%20exact%20%22{funderId}%22) + https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "{like}")or({like}))){funderQuery}&page={page}&size={pageSize}&format=json + &fq=(funder exact "{funderId}") 0 application/json; charset=utf-8 diff --git a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsStaging.xml b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsStaging.xml index b5080c894..d0a7ff92e 100644 --- a/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsStaging.xml +++ b/dmp-backend/web/src/main/resources/externalUrls/ExternalUrlsStaging.xml @@ -61,8 +61,8 @@ openAIRE 1 - https://services.openaire.eu/search/v2/api/resources?query=((oaftype%20exact%20project)%20and%20((projectcode_nt%20exact%20%22{like}%22)or({like}))){funderQuery}&page={page}&size={pageSize}&format=json - &fq=(funder%20exact%20%22{funderId}%22) + https://services.openaire.eu/search/v2/api/resources?query=((oaftype exact project) and ((projectcode_nt exact "{like}")or({like}))){funderQuery}&page={page}&size={pageSize}&format=json + &fq=(funder exact "{funderId}") 0 application/json; charset=utf-8