|
|
|
@ -197,7 +197,7 @@ public class RemoteFetcher {
|
|
|
|
|
ifFunderQueryExist(urlConfiguration, externalUrlCriteria);
|
|
|
|
|
if (urlConfiguration.getType() == null || urlConfiguration.getType().equals("External")) {
|
|
|
|
|
try {
|
|
|
|
|
results.addAll(getAllResultsFromUrl(urlConfiguration.getUrl(), fetchStrategy, urlConfiguration.getData(), urlConfiguration.getPaginationPath(), externalUrlCriteria, urlConfiguration.getLabel(), urlConfiguration.getKey(), urlConfiguration.getContentType(), urlConfiguration.getFirstpage(), urlConfiguration.getRequestBody(), urlConfiguration.getRequestType()));
|
|
|
|
|
results.addAll(getAllResultsFromUrl(urlConfiguration.getUrl(), fetchStrategy, urlConfiguration.getData(), urlConfiguration.getPaginationPath(), externalUrlCriteria, urlConfiguration.getLabel(), urlConfiguration.getKey(), urlConfiguration.getContentType(), urlConfiguration.getFirstpage(), urlConfiguration.getRequestBody(), urlConfiguration.getRequestType(), urlConfiguration.getFilterType()));
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error(e.getLocalizedMessage(), e);
|
|
|
|
|
}
|
|
|
|
@ -277,13 +277,18 @@ public class RemoteFetcher {
|
|
|
|
|
return completedPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<Map<String, String>> getAllResultsFromUrl(String path, FetchStrategy fetchStrategy, final DataUrlConfiguration jsonDataPath, final String jsonPaginationPath, ExternalUrlCriteria externalUrlCriteria, String tag, String key, String contentType, String firstPage, String requestBody, String requestType) throws Exception {
|
|
|
|
|
private List<Map<String, String>> getAllResultsFromUrl(String path, FetchStrategy fetchStrategy, final DataUrlConfiguration jsonDataPath, final String jsonPaginationPath, ExternalUrlCriteria externalUrlCriteria, String tag, String key, String contentType, String firstPage, String requestBody, String requestType, String filterType) throws Exception {
|
|
|
|
|
Set<Integer> pages = new HashSet<>();
|
|
|
|
|
|
|
|
|
|
String replacedPath = replaceCriteriaOnUrl(path, externalUrlCriteria, firstPage);
|
|
|
|
|
String replacedBody = replaceCriteriaOnUrl(requestBody, externalUrlCriteria, firstPage);
|
|
|
|
|
|
|
|
|
|
Results results = getResultsFromUrl(replacedPath, jsonDataPath, jsonPaginationPath, contentType, replacedBody, requestType);
|
|
|
|
|
if(filterType != null && filterType.equals("local") && (externalUrlCriteria.getLike() != null && !externalUrlCriteria.getLike().isEmpty())){
|
|
|
|
|
results.setResults(results.getResults().stream()
|
|
|
|
|
.filter(r -> r.get("name").toLowerCase().contains(externalUrlCriteria.getLike().toLowerCase()))
|
|
|
|
|
.collect(Collectors.toList()));
|
|
|
|
|
}
|
|
|
|
|
if (fetchStrategy == FetchStrategy.FIRST)
|
|
|
|
|
return results == null ? new LinkedList<>() : results.getResults().stream().peek(x -> x.put("tag", tag)).peek(x -> x.put("key", key)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|