@Test void testCreateFileNotPermitted() { HttpServletRequest httpServletRequest = mock(HttpServletRequest.class); assertThrows( EntityTypePermissionDeniedException.class, () -> filesApiController.createFile(httpServletRequest)); }
@ApiOperation("Upload file (see documentation)") @PostMapping @ResponseStatus(CREATED) public CompletableFuture<ResponseEntity<FileResponse>> createFile( HttpServletRequest httpServletRequest) { validateCreatePermission(); return filesService .upload(httpServletRequest) .thenApply(fileMeta -> this.toFileResponseEntity(fileMeta, httpServletRequest)); }
FilesController extends ApiController { @ApiOperation("Upload file (see documentation)") @PostMapping @ResponseStatus(CREATED) public CompletableFuture<ResponseEntity<FileResponse>> createFile( HttpServletRequest httpServletRequest) { validateCreatePermission(); return filesService .upload(httpServletRequest) .thenApply(fileMeta -> this.toFileResponseEntity(fileMeta, httpServletRequest)); } }
FilesController extends ApiController { @ApiOperation("Upload file (see documentation)") @PostMapping @ResponseStatus(CREATED) public CompletableFuture<ResponseEntity<FileResponse>> createFile( HttpServletRequest httpServletRequest) { validateCreatePermission(); return filesService .upload(httpServletRequest) .thenApply(fileMeta -> this.toFileResponseEntity(fileMeta, httpServletRequest)); } FilesController(FilesService filesService, UserPermissionEvaluator userPermissionEvaluator); }
FilesController extends ApiController { @ApiOperation("Upload file (see documentation)") @PostMapping @ResponseStatus(CREATED) public CompletableFuture<ResponseEntity<FileResponse>> createFile( HttpServletRequest httpServletRequest) { validateCreatePermission(); return filesService .upload(httpServletRequest) .thenApply(fileMeta -> this.toFileResponseEntity(fileMeta, httpServletRequest)); } FilesController(FilesService filesService, UserPermissionEvaluator userPermissionEvaluator); @ApiOperation("Upload file (see documentation)") @PostMapping @ResponseStatus(CREATED) CompletableFuture<ResponseEntity<FileResponse>> createFile(
      HttpServletRequest httpServletRequest); @PostMapping(consumes = {"application/x-www-form-urlencoded", "multipart/form-data"}) @ResponseStatus(BAD_REQUEST) CompletableFuture<ResponseEntity<FileResponse>> createFileFromForm(
      HttpServletRequest httpServletRequest); @ApiOperation("Retrieve file metadata (see documentation)") @GetMapping(value = "/{fileId}") FileResponse readFile(@PathVariable("fileId") String fileId); @ApiOperation("Download file (see documentation)") @GetMapping(value = "/{fileId}", params = "alt=media") ResponseEntity<StreamingResponseBody> downloadFile(@PathVariable("fileId") String fileId); @ApiOperation("Delete file (see documentation)") @DeleteMapping(value = "/{fileId}") @ResponseStatus(NO_CONTENT) void deleteFile(@PathVariable("fileId") String fileId); }
FilesController extends ApiController { @ApiOperation("Upload file (see documentation)") @PostMapping @ResponseStatus(CREATED) public CompletableFuture<ResponseEntity<FileResponse>> createFile( HttpServletRequest httpServletRequest) { validateCreatePermission(); return filesService .upload(httpServletRequest) .thenApply(fileMeta -> this.toFileResponseEntity(fileMeta, httpServletRequest)); } FilesController(FilesService filesService, UserPermissionEvaluator userPermissionEvaluator); @ApiOperation("Upload file (see documentation)") @PostMapping @ResponseStatus(CREATED) CompletableFuture<ResponseEntity<FileResponse>> createFile(
      HttpServletRequest httpServletRequest); @PostMapping(consumes = {"application/x-www-form-urlencoded", "multipart/form-data"}) @ResponseStatus(BAD_REQUEST) CompletableFuture<ResponseEntity<FileResponse>> createFileFromForm(
      HttpServletRequest httpServletRequest); @ApiOperation("Retrieve file metadata (see documentation)") @GetMapping(value = "/{fileId}") FileResponse readFile(@PathVariable("fileId") String fileId); @ApiOperation("Download file (see documentation)") @GetMapping(value = "/{fileId}", params = "alt=media") ResponseEntity<StreamingResponseBody> downloadFile(@PathVariable("fileId") String fileId); @ApiOperation("Delete file (see documentation)") @DeleteMapping(value = "/{fileId}") @ResponseStatus(NO_CONTENT) void deleteFile(@PathVariable("fileId") String fileId);  }