use of com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO in project ArachneCentralAPI by OHDSI.
the class StudyToStudyMediumDTOConverter method convert.
@Override
public StudyMediumDTO convert(Study source) {
final StudyMediumDTO studyDTO = new StudyMediumDTO();
studyDTO.setId(source.getId());
studyDTO.setTitle(source.getTitle());
studyDTO.setDescription(source.getDescription());
studyDTO.setCreated(source.getCreated());
studyDTO.setStartDate(source.getStartDate());
studyDTO.setEndDate(source.getEndDate());
studyDTO.setStatus(conversionService.convert(source.getStatus(), StudyStatusDTO.class));
final Map<ParticipantRole, List<UserStudyExtended>> studyParticipants = source.getParticipants().stream().collect(Collectors.groupingBy(link -> link.getRole() == ParticipantRole.LEAD_INVESTIGATOR ? LEAD_INVESTIGATOR : CONTRIBUTOR));
final List<UserStudyExtended> studyLeads = studyParticipants.get(LEAD_INVESTIGATOR);
if (!CollectionUtils.isEmpty(studyLeads)) {
studyDTO.setStudyLeads(studyLeads.stream().filter(distinctByKey(p -> p.getUser().getId())).map(studyParticipant -> conversionService.convert(studyParticipant, ParticipantDTO.class)).collect(Collectors.toList()));
}
final List<UserStudyExtended> studyContributors = studyParticipants.get(CONTRIBUTOR);
if (!CollectionUtils.isEmpty(studyContributors)) {
studyDTO.setStudyParticipants(studyContributors.stream().filter(distinctByKey(p -> p.getUser().getId())).map(studyParticipant -> conversionService.convert(studyParticipant, ParticipantExtendedDTO.class)).collect(Collectors.toList()));
}
final List<StudyDataSourceLink> studyDataSources = source.getDataSources();
studyDTO.setStudyDataSources(studyDataSources.stream().map(studyDataSource -> conversionService.convert(studyDataSource.getDataSource(), DataSourceDTO.class)).collect(Collectors.toList()));
return studyDTO;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO in project ArachneCentralAPI by OHDSI.
the class BasePaperToPaperDTOConverter method convert.
@Override
public PD convert(P paper) {
final PD paperDTO = createResultObject();
paperDTO.setId(paper.getId());
final Study study = paper.getStudy();
final StudyMediumDTO studyDTO = conversionService.convert(study, StudyMediumDTO.class);
paperDTO.setStudy(studyDTO);
paperDTO.setPublishState(paper.getPublishState());
paperDTO.setPublishedDate(paper.getPublishedDate());
final List<PaperFileDTO> protocols = paper.getProtocols().stream().map(protocolFile -> conversionService.convert(protocolFile, PaperFileDTO.class)).collect(Collectors.toList());
paperDTO.setProtocols(protocols);
final List<PaperFileDTO> paperFileDTOs = paper.getPapers().stream().map(paperFile -> conversionService.convert(paperFile, PaperFileDTO.class)).collect(Collectors.toList());
paperDTO.setPapers(paperFileDTOs);
paperDTO.setPermissions(conversionService.convert(paper, PermissionsDTO.class));
proceedAdditionalFields(paperDTO, paper);
return paperDTO;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO in project ArachneCentralAPI by OHDSI.
the class BasePaperToShortPaperDTOConverter method convert.
@Override
public SPD convert(P paper) {
final SPD paperDTO = createResultObject();
paperDTO.setId(paper.getId());
paperDTO.setPublishState(paper.getPublishState());
paperDTO.setPublishedDate(paper.getPublishedDate());
final Study study = paper.getStudy();
final StudyMediumDTO studyDTO = conversionService.convert(study, StudyMediumDTO.class);
paperDTO.setStudy(studyDTO);
proceedAdditionalFields(paperDTO, paper);
return paperDTO;
}
Aggregations