use of com.odysseusinc.arachne.portal.model.SubmissionFile in project ArachneCentralAPI by OHDSI.
the class SubmissionInsightSubmissionFileToCommentableSubmissionFileDTOConverter method convert.
@Override
public CommentableSubmissionFileDTO convert(SubmissionInsightSubmissionFile submissionInsightSubmissionFile) {
final CommentableSubmissionFileDTO dto = new CommentableSubmissionFileDTO();
final SubmissionFile submissionFile = submissionInsightSubmissionFile.getSubmissionFile();
dto.setLabel(submissionFile.getLabel());
dto.setUuid(submissionFile.getUuid());
dto.setName(submissionFile.getRealName());
dto.setCreated(submissionFile.getCreated());
dto.setCommentTopicId(submissionInsightSubmissionFile.getCommentTopic().getId());
dto.setCommentCount(submissionInsightSubmissionFile.getCommentTopic().getCount());
dto.setAuthor(conversionService.convert(submissionFile.getAuthor(), UserInfoDTO.class));
dto.setDocType(submissionInsightSubmissionFile.getSubmissionFile().getContentType());
dto.setFileId(submissionFile.getId());
return dto;
}
use of com.odysseusinc.arachne.portal.model.SubmissionFile in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionController method downloadSubmissionGroupFile.
@ApiOperation("Download query file of the submission group.")
@RequestMapping(value = "/api/v1/analysis-management/submission-groups/{submissionGroupId}/files/{fileId}/download", method = GET)
public void downloadSubmissionGroupFile(@PathVariable("submissionGroupId") Long submissionGroupId, @PathVariable("fileId") Long fileId, HttpServletResponse response) throws PermissionDeniedException, NotExistException, IOException {
SubmissionFile analysisFile = submissionService.getSubmissionFile(submissionGroupId, fileId);
HttpUtils.putFileContentToResponse(response, analysisFile.getContentType(), StringUtils.getFilename(analysisFile.getRealName()), analysisService.getSubmissionFile(analysisFile));
}
use of com.odysseusinc.arachne.portal.model.SubmissionFile in project ArachneCentralAPI by OHDSI.
the class ArachneFileToFileContentDTOConverter method convert.
@Override
public AnalysisFileDTO convert(ArachneFile source) {
AnalysisFileDTO fileContentDTO = new AnalysisFileDTO();
fileContentDTO.setUuid(source.getUuid());
fileContentDTO.setName(source.getRealName());
fileContentDTO.setCreated(source.getCreated());
fileContentDTO.setLabel(source.getLabel());
if (source instanceof AnalysisFile && ((AnalysisFile) source).getAnalysis() != null) {
fileContentDTO.setAnalysisId(((AnalysisFile) source).getAnalysis().getId());
}
if (source instanceof SubmissionFile) {
fileContentDTO.setDocType(source.getContentType());
}
return fileContentDTO;
}
use of com.odysseusinc.arachne.portal.model.SubmissionFile in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionToCommonAnalysisDTOConverter method convert.
@Override
public CommonAnalysisDTO convert(T source) {
final CommonAnalysisDTO dto = createResultObject();
dto.setId(source.getId());
final Analysis analysis = source.getSubmissionGroup().getAnalysis();
if (analysis != null) {
dto.setName(analysis.getTitle());
dto.setType(analysis.getType());
Study study = analysis.getStudy();
if (study != null && conversionService.canConvert(study.getClass(), CommonStudyDTO.class)) {
dto.setStudy(conversionService.convert(study, CommonStudyDTO.class));
}
}
IUser author = source.getSubmissionGroup().getAuthor();
if (author != null && conversionService.canConvert(author.getClass(), CommonArachneUserDTO.class)) {
CommonArachneUserDTO userDTO = conversionService.convert(author, CommonArachneUserDTO.class);
dto.setOwner(userDTO);
}
dto.setUpdateSubmissionStatusPassword(source.getUpdatePassword());
dto.setCentralDataSourceId(source.getDataSource().getId());
for (SubmissionFile submissionFile : source.getSubmissionGroup().getFiles()) {
if (submissionFile.getExecutable() && StringUtils.isEmpty(dto.getExecutableFileName())) {
dto.setExecutableFileName(submissionFile.getRealName());
dto.setInnerExecutableFilename(submissionFile.getEntryPoint());
}
}
dto.setAnalysisFiles(source.getSubmissionGroup().getFiles().stream().map(file -> conversionService.convert(file, CommonAnalysisFileDTO.class)).collect(Collectors.toList()));
proceedAdditionalFields(dto, source);
return dto;
}
use of com.odysseusinc.arachne.portal.model.SubmissionFile in project ArachneCentralAPI by OHDSI.
the class BaseSubmissionController method getSubmissionGroupFileInfo.
@ApiOperation("Get query file of the submission group.")
@RequestMapping(value = "/api/v1/analysis-management/submission-groups/{submissionGroupId}/files/{fileId}", method = GET)
public JsonResult<SubmissionFileDTO> getSubmissionGroupFileInfo(@PathVariable("submissionGroupId") Long submissionGroupId, @PathVariable("fileId") Long fileId, @RequestParam(defaultValue = "true") Boolean withContent) throws NotExistException, IOException {
final SubmissionFile submissionFile = submissionService.getSubmissionFile(submissionGroupId, fileId);
SubmissionFileDTO fileDto = conversionService.convert(submissionFile, SubmissionFileDTO.class);
if (withContent) {
fileDto = (SubmissionFileDTO) FileDtoContentHandler.getInstance(fileDto, analysisService.getPath(submissionFile).toFile()).withPdfConverter(toPdfConverter::convert).handle();
}
return new JsonResult<>(NO_ERROR, fileDto);
}
Aggregations