Search in sources :

Example 11 with StudyDTO

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

Example 12 with StudyDTO

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;
}
Also used : List(java.util.List) Component(org.springframework.stereotype.Component) PaperDTO(com.odysseusinc.arachne.portal.api.v1.dto.PaperDTO) StudyMediumDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO) Autowired(org.springframework.beans.factory.annotation.Autowired) BaseConversionServiceAwareConverter(com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter) GenericConversionService(org.springframework.core.convert.support.GenericConversionService) PaperFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) Collectors(java.util.stream.Collectors) Paper(com.odysseusinc.arachne.portal.model.Paper) Study(com.odysseusinc.arachne.portal.model.Study) Study(com.odysseusinc.arachne.portal.model.Study) PaperFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.PaperFileDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) StudyMediumDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO)

Example 13 with StudyDTO

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

Example 14 with StudyDTO

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;
}
Also used : StudyFile(com.odysseusinc.arachne.portal.model.StudyFile) StudyDataSourceLink(com.odysseusinc.arachne.portal.model.StudyDataSourceLink) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) ParticipantDTO(com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO) StudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO) StudyFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyFileDTO) DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) BaseAnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseAnalysisDTO) StudyStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO) Analysis(com.odysseusinc.arachne.portal.model.Analysis) StudyStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO) BaseAnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseAnalysisDTO) ParticipantDTO(com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) StudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO) StudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO) StudyFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyFileDTO)

Example 15 with 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");
}
Also used : CreateStudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.CreateStudyDTO) StudyDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO) StudyStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO) StudyTypeDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases) DatabaseSetup(com.github.springtestdbunit.annotation.DatabaseSetup)

Aggregations

StudyStatusDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO)10 StudyDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO)9 CreateStudyDTO (com.odysseusinc.arachne.portal.api.v1.dto.CreateStudyDTO)8 Study (com.odysseusinc.arachne.portal.model.Study)8 DatabaseSetup (com.github.springtestdbunit.annotation.DatabaseSetup)7 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)7 Test (org.junit.Test)7 WithUserDetails (org.springframework.security.test.context.support.WithUserDetails)7 StudyTypeDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO)6 PermissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO)4 StudyMediumDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyMediumDTO)3 IUser (com.odysseusinc.arachne.portal.model.IUser)3 List (java.util.List)3 DataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO)2 ParticipantDTO (com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO)2 ShortUserDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)2 StudyListDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyListDTO)2 StudyShortDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO)2 BaseConversionServiceAwareConverter (com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter)2 StudyDataSourceLink (com.odysseusinc.arachne.portal.model.StudyDataSourceLink)2