fix remote fetcher

This commit is contained in:
amentis 2023-10-18 13:53:52 +03:00
parent b2119abc08
commit 5203ec4b72
1 changed files with 0 additions and 50 deletions

View File

@ -50,56 +50,6 @@ public class RemoteFetcher {
).clientConnector(new ReactorClientHttpConnector(HttpClient.create().followRedirect(true))).build(); ).clientConnector(new ReactorClientHttpConnector(HttpClient.create().followRedirect(true))).build();
} }
//@Cacheable(value = "tempexternalType", keyGenerator = "externalUrlsKeyGenerator")
public List<Map<String, String>> get(String externalType, ExternalUrlCriteria externalUrlCriteria, String key) throws eu.eudat.proxy.config.exceptions.NoURLFound, eu.eudat.proxy.config.exceptions.HugeResultSet {
List<UrlConfiguration> urlConfigs = null;
FetchStrategy fetchStrategy = null;
switch (externalType){
case "taxonomies":
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getTaxonomies().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getTaxonomies().getUrls();
fetchStrategy = configLoader.getExternalUrls().getTaxonomies().getFetchMode();
break;
case "licenses":
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getLicenses().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getLicenses().getUrls();
fetchStrategy = configLoader.getExternalUrls().getLicenses().getFetchMode();
break;
case "publications":
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getPublications().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getPublications().getUrls();
fetchStrategy = configLoader.getExternalUrls().getPublications().getFetchMode();
break;
case "journals":
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getJournals().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getJournals().getUrls();
fetchStrategy = configLoader.getExternalUrls().getJournals().getFetchMode();
break;
case "pubRepositories":
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getPubRepositories().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getPubRepositories().getUrls();
fetchStrategy = configLoader.getExternalUrls().getPubRepositories().getFetchMode();
break;
case "dataRepositories":
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getRepositories().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getRepositories().getUrls();
fetchStrategy = configLoader.getExternalUrls().getRepositories().getFetchMode();
break;
case "registries":
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getRegistries().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getRegistries().getUrls();
fetchStrategy = configLoader.getExternalUrls().getRegistries().getFetchMode();
break;
case "services":
urlConfigs = key != null && !key.isEmpty() ? configLoader.getExternalUrls().getServices().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getServices().getUrls();
fetchStrategy = configLoader.getExternalUrls().getServices().getFetchMode();
break;
}
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
}
@Cacheable(value = "repositories", keyGenerator = "externalUrlsKeyGenerator") @Cacheable(value = "repositories", keyGenerator = "externalUrlsKeyGenerator")
public List<Map<String, String>> getRepositories(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { public List<Map<String, String>> getRepositories(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
List<UrlConfiguration> urlConfigs = List<UrlConfiguration> urlConfigs =