Search in sources :

Example 6 with DataSourceDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO 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 7 with DataSourceDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO in project ArachneCentralAPI by OHDSI.

the class StudyDataSourceLinkToDataSourceDTOConverter method convert.

@Override
public DataSourceDTO convert(final StudyDataSourceLink studyDataSourceLink) {
    final DataSourceDTO dataSourceDTO = conversionService.convert(studyDataSourceLink.getDataSource(), DataSourceDTO.class);
    dataSourceDTO.setStatus(studyDataSourceLink.getStatus().toString());
    return dataSourceDTO;
}
Also used : DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO)

Aggregations

DataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO)6 CreateVirtualDataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.CreateVirtualDataSourceDTO)4 ApiOperation (io.swagger.annotations.ApiOperation)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 IUser (com.odysseusinc.arachne.portal.model.IUser)3 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)2 PermissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO)2 IDataSource (com.odysseusinc.arachne.portal.model.IDataSource)2 StudyDataSourceLink (com.odysseusinc.arachne.portal.model.StudyDataSourceLink)2 CommonHealthStatus (com.odysseusinc.arachne.commons.api.v1.dto.CommonHealthStatus)1 BaseAnalysisDTO (com.odysseusinc.arachne.portal.api.v1.dto.BaseAnalysisDTO)1 DataNodeDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataNodeDTO)1 ParticipantDTO (com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO)1 ShortUserDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)1 StudyDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyDTO)1 StudyFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyFileDTO)1 StudyStatusDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyStatusDTO)1 StudyTypeDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.StudyTypeDTO)1 Analysis (com.odysseusinc.arachne.portal.model.Analysis)1 StudyFile (com.odysseusinc.arachne.portal.model.StudyFile)1