use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO in project ArachneCentralAPI by OHDSI.
the class SubmissionInsightToSubmissionInsightDTOConverter method analysisConverter.
private AnalysisDTO analysisConverter(final Analysis analysis) {
final AnalysisDTO analysisDTO = new AnalysisDTO();
analysisDTO.setId(analysis.getId());
analysisDTO.setTitle(analysis.getTitle());
final StudyShortDTO studyDTO = new StudyShortDTO();
final Study study = analysis.getStudy();
studyDTO.setId(study.getId());
studyDTO.setTitle(study.getTitle());
analysisDTO.setStudy(studyDTO);
return analysisDTO;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO 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.StudyDTO 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;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO in project ArachneCentralAPI by OHDSI.
the class BaseStudyToStudyDTOConverter method convert.
@Override
public DTO convert(final S source) {
final DTO studyDTO = createResultObject();
studyDTO.setStatus(conversionService.convert(source.getStatus(), StudyStatusDTO.class));
studyDTO.setTitle(source.getTitle());
studyDTO.setType(conversionService.convert(source.getType(), StudyTypeDTO.class));
studyDTO.setEndDate(source.getEndDate());
studyDTO.setStartDate(source.getStartDate());
studyDTO.setDescription(source.getDescription());
if (!CollectionUtils.isEmpty(source.getParticipants())) {
studyDTO.setParticipants(source.getParticipants().stream().map(link -> conversionService.convert(link, ParticipantDTO.class)).collect(Collectors.toList()));
}
final List<StudyDataSourceLink> foundLinks = studyService.getLinksByStudyId(source.getId(), EntityUtils.fromAttributePaths("dataSource.dataNode.dataNodeUsers.user"));
for (final StudyDataSourceLink studyDataSourceLink : foundLinks) {
final DataSourceDTO dataSourceDTO = conversionService.convert(studyDataSourceLink, DataSourceDTO.class);
studyDTO.getDataSources().add(dataSourceDTO);
}
List<Analysis> analyses = getAnalyses(source);
for (final Analysis analysis : analyses) {
studyDTO.getAnalyses().add(conversionService.convert(analysis, BaseAnalysisDTO.class));
}
List<StudyFile> files = studyService.getFilesByStudyId(source.getId(), EntityUtils.fromAttributePaths("author"));
for (final StudyFile studyFile : files) {
studyDTO.getFiles().add(conversionService.convert(studyFile, StudyFileDTO.class));
}
studyDTO.setCreated(source.getCreated());
studyDTO.setUpdated(source.getUpdated());
studyDTO.setId(source.getId());
studyDTO.setPermissions(conversionService.convert(source, PermissionsDTO.class));
studyDTO.setPaperId(source.getPaper() == null ? null : source.getPaper().getId());
studyDTO.setPrivacy(source.getPrivacy());
proceedAdditionalFields(studyDTO, source);
return studyDTO;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateStudyType.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetup("/data/study/study-before-updating.xml")
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-after-updating-type.xml", assertionMode = NON_STRICT_UNORDERED) })
public void testUpdateStudyType() throws Exception {
StudyDTO updatedStudyDTO = new StudyDTO();
updatedStudyDTO.setId(STUDY_ID);
updatedStudyDTO.setDescription("description");
StudyTypeDTO type = new StudyTypeDTO(1L);
type.setName("type1");
updatedStudyDTO.setType(type);
StudyStatusDTO status = new StudyStatusDTO(STUDY_STATUS_ID, "Initiate");
updatedStudyDTO.setStatus(status);
testUpdate(updatedStudyDTO, UPDATED_STUDY_TYPE_JSON_OBJECT, "type1");
}
Aggregations