use of com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionController method getResultFileInfo.
@ApiOperation("Get result file of the submission.")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/results/{fileUuid}", method = GET)
public JsonResult<ResultFileDTO> getResultFileInfo(Principal principal, @PathVariable("submissionId") Long submissionId, @RequestParam(defaultValue = "true") Boolean withContent, @PathVariable("fileUuid") String fileUuid) throws PermissionDeniedException, NotExistException, IOException {
ArachneFileMeta file = getResultFile(principal, submissionId, fileUuid);
String resultFilesPath = contentStorageHelper.getResultFilesDir(Submission.class, submissionId, null);
ResultFileDTO resultFileDTO = new ResultFileDTO(conversionService.convert(file, FileDTO.class));
resultFileDTO.setRelativePath(contentStorageHelper.getRelativePath(resultFilesPath, resultFileDTO.getPath()));
if (withContent) {
byte[] content = IOUtils.toByteArray(contentStorageService.getContentByFilepath(file.getPath()));
resultFileDTO = (ResultFileDTO) FileDtoContentHandler.getInstance(resultFileDTO, content).withPdfConverter(toPdfConverter::convert).handle();
}
return new JsonResult<>(NO_ERROR, resultFileDTO);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionController method getResultFiles.
@ApiOperation("Get result files of the submission.")
@RequestMapping(value = "/api/v1/analysis-management/submissions/{submissionId}/results", method = GET)
public List<ResultFileDTO> getResultFiles(Principal principal, @PathVariable("submissionId") Long submissionId, @RequestParam(value = "path", required = false, defaultValue = "") String path, @RequestParam(value = "real-name", required = false) String realName) throws PermissionDeniedException, IOException {
IUser user = userService.getByEmail(principal.getName());
ResultFileSearch resultFileSearch = new ResultFileSearch();
resultFileSearch.setPath(path);
resultFileSearch.setRealName(realName);
List<? extends ArachneFileMeta> resultFileList = submissionService.getResultFiles(user, submissionId, resultFileSearch);
String resultFilesPath = contentStorageHelper.getResultFilesDir(Submission.class, submissionId, null);
return resultFileList.stream().map(rf -> {
ResultFileDTO rfDto = conversionService.convert(rf, ResultFileDTO.class);
rfDto.setSubmissionId(submissionId);
rfDto.setRelativePath(contentStorageHelper.getRelativePath(resultFilesPath, rfDto.getPath()));
return rfDto;
}).collect(Collectors.toList());
}
use of com.odysseusinc.arachne.portal.api.v1.dto.ResultFileDTO in project ArachneCentralAPI by OHDSI.
the class ArachneFileMetaToResultFileDTOConverter method convert.
@Override
public ResultFileDTO convert(ArachneFileMeta source) {
FileDTO fileDTO = conversionService.convert(source, FileDTO.class);
ResultFileDTO resultFileDTO = new ResultFileDTO(fileDTO);
resultFileDTO.setManuallyUploaded(source.getCreatedBy() != null);
return resultFileDTO;
}
Aggregations