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 47110fb0e..0ebd415e0 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,20 @@ public class RemoteFetcher { if (responseCode == HttpURLConnection.HTTP_OK) { // success //do here all the parsing DocumentContext jsonContext = JsonPath.parse(con.getInputStream()); - Results results = new Results(jsonContext.read(jsonDataPath.getPath() - + "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription() - + "," + jsonDataPath.getFieldsUrlConfiguration().getUri() + "," + jsonDataPath.getFieldsUrlConfiguration().getId() - + "," + jsonDataPath.getFieldsUrlConfiguration().getSource() + "]"), - jsonContext.read(jsonPaginationPath)); + Results results; + if (jsonDataPath.getFieldsUrlConfiguration().getSource() != null) { + results = new Results(jsonContext.read(jsonDataPath.getPath() + + "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription() + + "," + jsonDataPath.getFieldsUrlConfiguration().getUri() + "," + jsonDataPath.getFieldsUrlConfiguration().getId() + + "," + jsonDataPath.getFieldsUrlConfiguration().getSource() + "]"), + jsonContext.read(jsonPaginationPath)); + } + else { + results = new Results(jsonContext.read(jsonDataPath.getPath() + + "[" + jsonDataPath.getFieldsUrlConfiguration().getName() + "," + jsonDataPath.getFieldsUrlConfiguration().getDescription() + + "," + jsonDataPath.getFieldsUrlConfiguration().getUri() + "," + jsonDataPath.getFieldsUrlConfiguration().getId() + "]"), + jsonContext.read(jsonPaginationPath)); + } results.results = results.results.stream().map(e -> e.entrySet().stream().collect(Collectors.toMap(x -> this.transformKey(jsonDataPath,x.getKey()), Map.Entry::getValue))) .collect(Collectors.toList()); return results;