Search in sources :

Example 1 with SubmissionFile

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;
}
Also used : UserInfoDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO) CommentableSubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentableSubmissionFileDTO) SubmissionInsightSubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionInsightSubmissionFile) SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile)

Example 2 with SubmissionFile

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));
}
Also used : SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with SubmissionFile

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;
}
Also used : AnalysisFile(com.odysseusinc.arachne.portal.model.AnalysisFile) AnalysisFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisFileDTO) SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile)

Example 4 with SubmissionFile

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;
}
Also used : CommonAnalysisFileDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisFileDTO) Study(com.odysseusinc.arachne.portal.model.Study) CommonStudyDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonStudyDTO) CommonAnalysisDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisDTO) Analysis(com.odysseusinc.arachne.portal.model.Analysis) CommonArachneUserDTO(com.odysseusinc.arachne.commons.api.v1.dto.CommonArachneUserDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile)

Example 5 with SubmissionFile

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);
}
Also used : SubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO) JsonResult(com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult) SubmissionFile(com.odysseusinc.arachne.portal.model.SubmissionFile) ApiOperation(io.swagger.annotations.ApiOperation) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

SubmissionFile (com.odysseusinc.arachne.portal.model.SubmissionFile)7 AnalysisFile (com.odysseusinc.arachne.portal.model.AnalysisFile)2 SubmissionGroup (com.odysseusinc.arachne.portal.model.SubmissionGroup)2 ApiOperation (io.swagger.annotations.ApiOperation)2 Path (java.nio.file.Path)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 CommonAnalysisDTO (com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisDTO)1 CommonAnalysisFileDTO (com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisFileDTO)1 CommonArachneUserDTO (com.odysseusinc.arachne.commons.api.v1.dto.CommonArachneUserDTO)1 CommonStudyDTO (com.odysseusinc.arachne.commons.api.v1.dto.CommonStudyDTO)1 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 AnalysisFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.AnalysisFileDTO)1 CommentableSubmissionFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.CommentableSubmissionFileDTO)1 SubmissionFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionFileDTO)1 UserInfoDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO)1 Analysis (com.odysseusinc.arachne.portal.model.Analysis)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 Study (com.odysseusinc.arachne.portal.model.Study)1 SubmissionInsightSubmissionFile (com.odysseusinc.arachne.portal.model.SubmissionInsightSubmissionFile)1 InputStream (java.io.InputStream)1