From cf88f5019e19dd39d040a879cbedff3d36d0ca21 Mon Sep 17 00:00:00 2001 From: dtziotzios Date: Mon, 4 Feb 2019 17:20:23 +0200 Subject: [PATCH] Rollback fix on this file. --- .../eudat/controllers/ExternalDatasets.java | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/ExternalDatasets.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/ExternalDatasets.java index 0f13b0f10..6ece472df 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/ExternalDatasets.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/ExternalDatasets.java @@ -25,7 +25,7 @@ import java.util.UUID; @RestController @CrossOrigin -@RequestMapping(value = {"/api/externaldatasets/"}) +@RequestMapping(value = {"/api"}) public class ExternalDatasets extends BaseController { private ExternalDatasetManager externalDatasetManager; @@ -36,8 +36,31 @@ public class ExternalDatasets extends BaseController { this.externalDatasetManager = externalDatasetManager; } + @RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getPaged"}, consumes = "application/json", produces = "application/json") + public @ResponseBody + ResponseEntity>> getPaged(@RequestBody ExternalDatasetTableRequest datasetTableRequest, Principal principal) throws Exception { + DataTableData dataTable = new ExternalDatasetManager().getPaged(this.getApiContext(), datasetTableRequest); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().status(ApiMessageCode.NO_MESSAGE).payload(dataTable)); + } + + @RequestMapping(method = RequestMethod.GET, value = {"/external/datasets"}, produces = "application/json") + public @ResponseBody + ResponseEntity>> getWithExternal( + @RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type, Principal principal + ) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException { + List dataTable = new ExternalDatasetManager().getWithExternal(this.getApiContext(), query, this.getApiContext().getOperationsContext().getRemoteFetcher()); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); + } + + @RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets/getSingle/{id}"}, consumes = "application/json", produces = "application/json") + public @ResponseBody + ResponseItem getWithExternal(@PathVariable UUID id, Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException { + ExternalDatasetListingModel externalDatasetModel = new ExternalDatasetManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getExternalDatasetDao(), id); + return new ResponseItem().payload(externalDatasetModel).status(ApiMessageCode.NO_MESSAGE); + } + @Transactional - @RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json") + @RequestMapping(method = RequestMethod.POST, value = {"/externaldatasets"}, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity> create(@RequestBody eu.eudat.models.data.externaldataset.ExternalDatasetModel externalDatasetModel, Principal principal) throws Exception { ExternalDataset externalDataset = this.externalDatasetManager.create(this.getApiContext(), externalDatasetModel);