Search in sources :

Example 1 with CommonAnalysisDTO

use of com.odysseusinc.arachne.commons.api.v1.dto.CommonAnalysisDTO 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)

Aggregations

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 Analysis (com.odysseusinc.arachne.portal.model.Analysis)1 IUser (com.odysseusinc.arachne.portal.model.IUser)1 Study (com.odysseusinc.arachne.portal.model.Study)1 SubmissionFile (com.odysseusinc.arachne.portal.model.SubmissionFile)1