From 8740892c1403d3d2e6065efcd71853c831edc02c Mon Sep 17 00:00:00 2001
From: Moritz Staudinger <moritz.staudinger@tuwien.ac.at>
Date: Thu, 3 Mar 2022 04:11:49 +0100
Subject: [PATCH] Removed limitation that the statement needed to have tables
 set - removed save method, integrated it into execute

Former-commit-id: 7c45cb169904163d673dfe9d1d3f6be054589056
---
 .../at/tuwien/endpoint/QueryEndpoint.java     | 25 -------------------
 1 file changed, 25 deletions(-)

diff --git a/fda-query-service/rest-service/src/main/java/at/tuwien/endpoint/QueryEndpoint.java b/fda-query-service/rest-service/src/main/java/at/tuwien/endpoint/QueryEndpoint.java
index c26201c7f7..0a321c3106 100644
--- a/fda-query-service/rest-service/src/main/java/at/tuwien/endpoint/QueryEndpoint.java
+++ b/fda-query-service/rest-service/src/main/java/at/tuwien/endpoint/QueryEndpoint.java
@@ -39,7 +39,6 @@ public class QueryEndpoint {
         this.storeService = storeService;
     }
 
-    @Deprecated
     @PutMapping
     @Transactional
     @PreAuthorize("hasRole('ROLE_RESEARCHER')")
@@ -61,36 +60,12 @@ public class QueryEndpoint {
             log.error("Query is empty");
             throw new QueryMalformedException("Invalid query");
         }
-        if (data.getTables().size() == 0) {
-            log.error("Table list is empty");
-            throw new QueryMalformedException("Invalid table");
-        }
         log.debug("Data for execution: {}", data);
         final QueryResultDto result = queryService.execute(id, databaseId, data, page, size);
         return ResponseEntity.status(HttpStatus.ACCEPTED)
                 .body(result);
     }
 
-    @PostMapping
-    @Transactional
-    @PreAuthorize("hasRole('ROLE_RESEARCHER')")
-    @ApiOperation(value = "saves a query without execution")
-    @ApiResponses(value = {
-            @ApiResponse(code = 200, message = "Executed the query, Saved it and return the results"),
-            @ApiResponse(code = 404, message = "The database does not exist."),
-            @ApiResponse(code = 405, message = "The container is not running."),
-            @ApiResponse(code = 409, message = "The container image is not supported."),})
-    public ResponseEntity<QueryDto> save(@NotNull @PathVariable("id") Long id,
-                                         @NotNull @PathVariable("databaseId") Long databaseId,
-                                         @Valid @RequestBody SaveStatementDto data)
-            throws DatabaseNotFoundException, ImageNotSupportedException, QueryStoreException,
-            ContainerNotFoundException {
-        final Query query = storeService.insert(id, databaseId, null, data);
-        final QueryDto queryDto = queryMapper.queryToQueryDto(query);
-        return ResponseEntity.status(HttpStatus.ACCEPTED)
-                .body(queryDto);
-    }
-
     @PutMapping("/{queryId}")
     @Transactional
     @PreAuthorize("hasRole('ROLE_RESEARCHER')")
-- 
GitLab