Fixes bug on fetching Dataset Description Tags.
This commit is contained in:
parent
46e62b01df
commit
44edc298d8
|
@ -12,6 +12,7 @@ import eu.eudat.models.data.external.TagExternalSourcesModel;
|
||||||
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
import eu.eudat.models.data.helpers.responses.ResponseItem;
|
||||||
import eu.eudat.types.ApiMessageCode;
|
import eu.eudat.types.ApiMessageCode;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.env.Environment;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
@ -33,11 +34,13 @@ import java.util.Map;
|
||||||
public class TagController extends BaseController {
|
public class TagController extends BaseController {
|
||||||
|
|
||||||
private Repository<Dataset, TagCriteria> datasetRepository;
|
private Repository<Dataset, TagCriteria> datasetRepository;
|
||||||
|
private Environment environment;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public TagController(ApiContext apiContext, Repository tagRepository) {
|
public TagController(ApiContext apiContext, Repository tagRepository, Environment environment) {
|
||||||
super(apiContext);
|
super(apiContext);
|
||||||
this.datasetRepository = tagRepository;
|
this.datasetRepository = tagRepository;
|
||||||
|
this.environment = environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.GET, value = {"/external/tags"}, produces = "application/json")
|
@RequestMapping(method = RequestMethod.GET, value = {"/external/tags"}, produces = "application/json")
|
||||||
|
@ -47,9 +50,8 @@ public class TagController extends BaseController {
|
||||||
/* List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(query, type);
|
/* List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(query, type);
|
||||||
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);*/
|
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);*/
|
||||||
|
|
||||||
String path = "C:\\Users\\gkolokythas\\Documents\\openDmp\\dmp-backend\\web\\src\\main\\resources\\mockupTags.json";
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
List<Map<String, String>> data = mapper.readValue(new File(path), new TypeReference<List<Map<String, String>>>(){});
|
List<Map<String, String>> data = mapper.readValue(new File(this.environment.getProperty("dataset.tags.mock")), new TypeReference<List<Map<String, String>>>(){});
|
||||||
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(data);
|
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(data);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<TagExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<TagExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
|
||||||
|
|
|
@ -21,6 +21,9 @@ configuration.dynamicProjectUrl=/tmp/ProjectConfiguration.xml
|
||||||
configuration.dynamicFunderUrl=/tmp/FunderConfiguration.xml
|
configuration.dynamicFunderUrl=/tmp/FunderConfiguration.xml
|
||||||
configuration.h2020template=C:\\Users\\gkolokythas\\Documents\\openDmp\\dmp-backend\\web\\src\\main\\resources\\documents\\h2020.docx
|
configuration.h2020template=C:\\Users\\gkolokythas\\Documents\\openDmp\\dmp-backend\\web\\src\\main\\resources\\documents\\h2020.docx
|
||||||
|
|
||||||
|
####################MOCK FILES CONFIGURATIONS##########
|
||||||
|
dataset.tags.mock=/tmp/mockupTags.json
|
||||||
|
|
||||||
#############TWITTER LOGIN CONFIGURATIONS#########
|
#############TWITTER LOGIN CONFIGURATIONS#########
|
||||||
twitter.login.redirect_uri=http://127.0.0.1:4200/login/twitter
|
twitter.login.redirect_uri=http://127.0.0.1:4200/login/twitter
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue