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"})
public class TagController extends BaseController {
private Repository<Dataset, TagCriteria> datasetRepository;
// private Repository<Dataset, TagCriteria> datasetRepository;
private Environment environment;
@Autowired
public TagController(ApiContext apiContext, Repository tagRepository, Environment environment) {
public TagController(ApiContext apiContext, /*Repository tagRepository, */Environment environment) {
super(apiContext);
this.datasetRepository = tagRepository;
// this.datasetRepository = tagRepository;
this.environment = environment;
}
@ -48,7 +48,7 @@ public class TagController extends BaseController {
//ExternalUrlCriteria externalUrlCriteria = new ExternalUrlCriteria(query);
/*List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(externalUrlCriteria, type);
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));
}

View File

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

View File

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

View File

@ -108,14 +108,14 @@ public class RemoteFetcher {
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
}
@Cacheable("tags")
/*@Cacheable("tags")
public List<Map<String, String>> getTags(ExternalUrlCriteria externalUrlCriteria, String key) throws NoURLFound, HugeResultSet {
List<UrlConfiguration> urlConfigs =
key != null && !key.isEmpty() ? configLoader.getExternalUrls().getTags().getUrls().stream().filter(item -> item.getKey().equals(key)).collect(Collectors.toList())
: configLoader.getExternalUrls().getTags().getUrls();
FetchStrategy fetchStrategy = configLoader.getExternalUrls().getTags().getFetchMode();
return getAll(urlConfigs, fetchStrategy, externalUrlCriteria);
}
}*/
@Cacheable("externalDatasets")
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> services;
private List<ExternalSourcesUrlModel> externalDatasets;
private List<ExternalSourcesUrlModel> tags;
/* private List<ExternalSourcesUrlModel> tags;
public List<ExternalSourcesUrlModel> getTags() {
return tags;
@ -45,7 +45,7 @@ public class ExternalSourcesConfiguration {
public void setTags(List<ExternalSourcesUrlModel> tags) {
this.tags = tags;
}
}*/
public List<ExternalSourcesUrlModel> getRegistries() {
return registries;

View File

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