From 0b985cdefe9022e83db64f7431bc64c6399d8bd6 Mon Sep 17 00:00:00 2001 From: Bogdan Kostov Date: Wed, 10 Jul 2024 11:19:12 +0200 Subject: [PATCH] [Fix partially kbss-cvut/record-manager-ui#36] Refactor handling of institution request parameter. - remove unnecessary annotations from method parameters --- .../cz/cvut/kbss/study/rest/PatientRecordController.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java b/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java index 03bae9c5..493c3f7a 100644 --- a/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java +++ b/src/main/java/cz/cvut/kbss/study/rest/PatientRecordController.java @@ -76,14 +76,13 @@ public ResponseEntity exportRecords( return switch (exportType.toString()){ case Constants.MEDIA_TYPE_EXCEL -> exportRecordsExcel(params, response); - case MediaType.APPLICATION_JSON_VALUE -> exportRecordsAsJson(institutionKey, params, uriBuilder, response); + case MediaType.APPLICATION_JSON_VALUE -> exportRecordsAsJson(params, uriBuilder, response); default -> throw new IllegalArgumentException("Unsupported export type: " + exportType); }; } protected ResponseEntity> exportRecordsAsJson( - @RequestParam(name = "institution", required = false) String institutionKey, - @RequestParam MultiValueMap params, + MultiValueMap params, UriComponentsBuilder uriBuilder, HttpServletResponse response){ final Page result = recordService.findAllFull(RecordFilterMapper.constructRecordFilter(params), RestUtils.resolvePaging(params)); @@ -93,7 +92,7 @@ protected ResponseEntity> exportRecordsAsJson( .body(result.getContent()); } - public ResponseEntity exportRecordsExcel(@RequestParam(required = false) MultiValueMap params, HttpServletResponse response){ + public ResponseEntity exportRecordsExcel(MultiValueMap params, HttpServletResponse response){ RecordFilterParams filterParams = new RecordFilterParams(); filterParams.setMinModifiedDate(null); filterParams.setMaxModifiedDate(null); @@ -105,7 +104,6 @@ public ResponseEntity exportRecordsExcel(@RequestParam(requ .contentType(MediaType.parseMediaType(Constants.MEDIA_TYPE_EXCEL)) .header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition.toString()) .body(new InputStreamResource(stream)); - } @PreAuthorize("hasRole('" + SecurityConstants.ROLE_ADMIN + "') or @securityUtils.isRecordInUsersInstitution(#key)")