class DocumentsController {

    @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'ACCESS_DOCUMENTS_SECTION')")
    @GetMapping("/config/{documentConfigId}/download")
    @ResponseBody
    public ResponseEntity<ByteArrayResource> downloadDocument(@PathVariable("projectId") long projectId,
                                                              @PathVariable("documentConfigId") long documentConfigId) {

        final Optional<ByteArrayResource> fileContents = documentsRestService.getFileContents(projectId, documentConfigId).getSuccess();
        final Optional<FileEntryResource> fileEntryDetails = documentsRestService.getFileEntryDetails(projectId, documentConfigId).getSuccess();
        return returnFileIfFoundOrThrowNotFoundException(projectId, documentConfigId, fileContents, fileEntryDetails);
    }

    public  DocumentsController();
    @Autowired public  DocumentsController(DocumentsPopulator populator, DocumentsRestService documentsRestService);

}