Removed external Tags

This commit is contained in:
George Kalampokis 2020-04-01 18:17:17 +03:00
parent dcede0b1eb
commit 88e34e1ec1
6 changed files with 18 additions and 18 deletions

View File

@ -31,13 +31,13 @@ import java.util.stream.Collectors;
@RequestMapping(value = {"/api"}) @RequestMapping(value = {"/api"})
public class TagController extends BaseController { public class TagController extends BaseController {
private Repository<Dataset, TagCriteria> datasetRepository; // private Repository<Dataset, TagCriteria> datasetRepository;
private Environment environment; private Environment environment;
@Autowired @Autowired
public TagController(ApiContext apiContext, Repository tagRepository, Environment environment) { public TagController(ApiContext apiContext, /*Repository tagRepository, */Environment environment) {
super(apiContext); super(apiContext);
this.datasetRepository = tagRepository; // this.datasetRepository = tagRepository;
this.environment = environment; this.environment = environment;
} }
@ -48,7 +48,7 @@ public class TagController extends BaseController {
//ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query); //ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query);
/*List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(externalUrlCriteria, type); /*List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(externalUrlCriteria, type);
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);*/ TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);*/
List<Tag> tags = this.getApiContext().getOperationsContext().getDatasetRepository().query(new DatasetCriteria()).stream().map(Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList()); List<Tag> tags = this.getApiContext().getOperationsContext().getElasticRepository().getDatasetRepository().query(new DatasetCriteria()).stream().map(Dataset::getTags).flatMap(Collection::stream).filter(StreamDistinctBy.distinctByKey(Tag::getId)).collect(Collectors.toList());
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Tag>>().payload(tags).status(ApiMessageCode.NO_MESSAGE)); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<Tag>>().payload(tags).status(ApiMessageCode.NO_MESSAGE));
} }

View File

@ -20,8 +20,8 @@ public class CommonsManager {
.map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList())); .map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList()));
externalSourcesConfiguration.setServices(configLoader.getExternalUrls().getServices().getUrls().stream() externalSourcesConfiguration.setServices(configLoader.getExternalUrls().getServices().getUrls().stream()
.map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList())); .map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList()));
externalSourcesConfiguration.setTags(configLoader.getExternalUrls().getTags().getUrls().stream() /*externalSourcesConfiguration.setTags(configLoader.getExternalUrls().getTags().getUrls().stream()
.map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList())); .map(item-> new ExternalSourcesConfiguration.ExternalSourcesUrlModel(item.getKey(),item.getLabel())).collect(Collectors.toList()));*/
return externalSourcesConfiguration; return externalSourcesConfiguration;
} }
} }

View File

@ -22,7 +22,7 @@ public class ExternalUrls implements Serializable {
ResearcherUrls researchers; ResearcherUrls researchers;
OrganisationUrls organisations; OrganisationUrls organisations;
DatasetUrls datasets; DatasetUrls datasets;
TagUrls tags; /*TagUrls tags;*/
FunderUrls funders; FunderUrls funders;
@ -66,14 +66,14 @@ public class ExternalUrls implements Serializable {
} }
public TagUrls getTags() { /*public TagUrls getTags() {
return tags; return tags;
} }
@XmlElement(name = "tags") @XmlElement(name = "tags")
public void setTags(TagUrls tags) { public void setTags(TagUrls tags) {
this.tags = tags; this.tags = tags;
} }*/
public OrganisationUrls getOrganisations() { public OrganisationUrls getOrganisations() {

View File

@ -108,14 +108,14 @@ public class RemoteFetcher {
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria); return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
} }
@Cacheable("tags") /*@Cacheable("tags")
public List<Map<String, String>> getTags(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { public List<Map<String, String>> getTags(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
List<UrlConfiguration> urlConfigs = List<UrlConfiguration> urlConfigs =
key != null && !key.isEmpty() ? configLoader.getExternalUrls().getTags().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList()) key != null && !key.isEmpty() ? configLoader.getExternalUrls().getTags().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getTags().getUrls(); : configLoader.getExternalUrls().getTags().getUrls();
FetchStrategy fetchStrategy = configLoader.getExternalUrls().getTags().getFetchMode(); FetchStrategy fetchStrategy = configLoader.getExternalUrls().getTags().getFetchMode();
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria); return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
} }*/
@Cacheable("externalDatasets") @Cacheable("externalDatasets")
public List<Map<String, String>> getDatasets(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet { public List<Map<String, String>> getDatasets(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {

View File

@ -37,7 +37,7 @@ public class ExternalSourcesConfiguration {
private List<ExternalSourcesUrlModel> dataRepositories; private List<ExternalSourcesUrlModel> dataRepositories;
private List<ExternalSourcesUrlModel> services; private List<ExternalSourcesUrlModel> services;
private List<ExternalSourcesUrlModel> externalDatasets; private List<ExternalSourcesUrlModel> externalDatasets;
private List<ExternalSourcesUrlModel> tags; /* private List<ExternalSourcesUrlModel> tags;
public List<ExternalSourcesUrlModel> getTags() { public List<ExternalSourcesUrlModel> getTags() {
return tags; return tags;
@ -45,7 +45,7 @@ public class ExternalSourcesConfiguration {
public void setTags(List<ExternalSourcesUrlModel> tags) { public void setTags(List<ExternalSourcesUrlModel> tags) {
this.tags = tags; this.tags = tags;
} }*/
public List<ExternalSourcesUrlModel> getRegistries() { public List<ExternalSourcesUrlModel> getRegistries() {
return registries; return registries;

View File

@ -65,7 +65,7 @@
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' --> <fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' -->
</registries> </registries>
<tags> <!--<tags>
<urls> <urls>
<urlConfig> <urlConfig>
<key>cristin</key> <key>cristin</key>
@ -86,7 +86,7 @@
</data> </data>
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath> <paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
</urlConfig> </urlConfig>
<!-- <urlConfig> &lt;!&ndash; <urlConfig>
<key>openAire</key> <key>openAire</key>
<label>OpenAIRE</label> <label>OpenAIRE</label>
<ordinal>1</ordinal> <ordinal>1</ordinal>
@ -120,10 +120,10 @@
</fields> </fields>
</data> </data>
<paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath> <paginationpath>$['meta']['pagination']['page','pages','count']</paginationpath>
</urlConfig>--> </urlConfig>&ndash;&gt;
</urls> </urls>
<fetchMode>FIRST</fetchMode> <!-- EITHER 'FIRST' OR 'ALL' --> <fetchMode>FIRST</fetchMode> &lt;!&ndash; EITHER 'FIRST' OR 'ALL' &ndash;&gt;
</tags> </tags>-->
<grants> <grants>
<urls> <urls>