class DocumentsController {

    @PreAuthorize("hasPermission(#projectId, 'org.innovateuk.ifs.project.resource.ProjectCompositeId', 'EDIT_DOCUMENTS_SECTION')")
    @PostMapping(value = "/config/{documentConfigId}", params = "submitDocument")
    public String submitDocument(@PathVariable("projectId") long projectId,
                                 @PathVariable("documentConfigId") long documentConfigId,
                                 @ModelAttribute(FORM_ATTR) DocumentForm form,
                                 @SuppressWarnings("unused") BindingResult bindingResult,
                                 ValidationHandler validationHandler,
                                 Model model,
                                 UserResource loggedInUser) {

        Supplier<String> successView = () -> redirectToViewDocumentPage(projectId, documentConfigId);
        Supplier<String> failureView = () -> doViewDocument(projectId, documentConfigId, model, loggedInUser, form);

        RestResult<Void> result = documentsRestService.submitDocument(projectId, documentConfigId);

        return validationHandler.addAnyErrors(result, asGlobalErrors()).
                failNowOrSucceedWith(failureView, successView);
    }

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

}