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;
}
Aggregations