Search in sources :

Example 1 with AnalysisDTO

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

the class SubmissionInsightToSubmissionInsightDTOConverter method convert.

@Override
public SubmissionInsightDTO convert(SubmissionInsight source) {
    final Submission submission = source.getSubmission();
    final SubmissionInsightDTO dto = new SubmissionInsightDTO();
    SubmissionDTO shortSubmissionDTO = new SubmissionDTO();
    shortSubmissionDTO.setId(submission.getId());
    shortSubmissionDTO.setCreatedAt(submission.getCreated());
    shortSubmissionDTO.setStatus(conversionService.convert(submission.getStatus(), SubmissionStatusDTO.class));
    shortSubmissionDTO.setAuthor(conversionService.convert(submission.getAuthor(), ShortUserDTO.class));
    dto.setCreated(source.getCreated());
    dto.setName(source.getName());
    dto.setDescription(source.getDescription());
    dto.setSubmission(shortSubmissionDTO);
    final List<Commentable> submissionFileDTOS = source.getSubmissionInsightSubmissionFiles().stream().map(submissionFile -> conversionService.convert(submissionFile, CommentableSubmissionFileDTO.class)).collect(Collectors.toList());
    dto.setCodeFiles(submissionFileDTOS);
    final List<Commentable> resultFileDTOS = submission.getResultFiles().stream().map(resultFile -> conversionService.convert(resultFile, CommentableResultFileDTO.class)).collect(Collectors.toList());
    dto.setResultFiles(resultFileDTOS);
    dto.setDataSource(conversionService.convert(submission.getDataSource(), DataSourceDTO.class));
    final AnalysisDTO analysisDTO = analysisConverter(source.getSubmission().getAnalysis());
    dto.setAnalysis(analysisDTO);
    dto.setCommentsCount(source.getCommentsCount());
    dto.setPermissions(conversionService.convert(source, PermissionsDTO.class));
    return dto;
}
Also used : SubmissionInsightDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionInsightDTO) AnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO) Autowired(org.springframework.beans.factory.annotation.Autowired) GenericConversionService(org.springframework.core.convert.support.GenericConversionService) CommentableSubmissionFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentableSubmissionFileDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) Submission(com.odysseusinc.arachne.portal.model.Submission) Collectors(java.util.stream.Collectors) SubmissionStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO) StudyShortDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO) List(java.util.List) Component(org.springframework.stereotype.Component) ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO) SubmissionInsightDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionInsightDTO) Analysis(com.odysseusinc.arachne.portal.model.Analysis) BaseConversionServiceAwareConverter(com.odysseusinc.arachne.portal.api.v1.dto.converters.BaseConversionServiceAwareConverter) Commentable(com.odysseusinc.arachne.portal.api.v1.dto.Commentable) CommentableResultFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.CommentableResultFileDTO) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO) SubmissionInsight(com.odysseusinc.arachne.portal.model.SubmissionInsight) Study(com.odysseusinc.arachne.portal.model.Study) DataSourceDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO) Submission(com.odysseusinc.arachne.portal.model.Submission) ShortUserDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) Commentable(com.odysseusinc.arachne.portal.api.v1.dto.Commentable) AnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO) SubmissionStatusDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionStatusDTO) SubmissionDTO(com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)

Example 2 with AnalysisDTO

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

the class AnalysisToShortBaseAnalysisDTOConverter method convert.

@Override
public ShortBaseAnalysisDTO convert(Analysis source) {
    ShortBaseAnalysisDTO analysisDTO = new ShortBaseAnalysisDTO();
    analysisDTO.setId(source.getId());
    analysisDTO.setCreated(source.getCreated());
    analysisDTO.setType(new OptionDTO(source.getType().name(), source.getType().getTitle()));
    return analysisDTO;
}
Also used : ShortBaseAnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortBaseAnalysisDTO) OptionDTO(com.odysseusinc.arachne.commons.api.v1.dto.OptionDTO)

Example 3 with AnalysisDTO

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

the class AnalysisToBaseAnalysisDTOConverter method convert.

@Override
public BaseAnalysisDTO convert(Analysis source) {
    ShortBaseAnalysisDTO baseDTO = conversionService.convert(source, ShortBaseAnalysisDTO.class);
    BaseAnalysisDTO analysisDTO = new BaseAnalysisDTO(baseDTO);
    analysisDTO.setAuthor(conversionService.convert(source.getAuthor(), UserInfoDTO.class));
    analysisDTO.setTitle(source.getTitle());
    analysisDTO.setDescription(source.getDescription());
    analysisDTO.setUpdated(source.getUpdated());
    analysisDTO.setStudy(conversionService.convert(source.getStudy(), StudyShortDTO.class));
    analysisDTO.setPermissions(conversionService.convert(source, PermissionsDTO.class));
    return analysisDTO;
}
Also used : ShortBaseAnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortBaseAnalysisDTO) BaseAnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseAnalysisDTO) ShortBaseAnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.ShortBaseAnalysisDTO) StudyShortDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) UserInfoDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserInfoDTO)

Example 4 with AnalysisDTO

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

the class AnalysisControllerTests method testUpdateAnalysisType.

@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study-with-contributor.xml"), @DatabaseSetup("/data/analysis/analysis-before-updating.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study-with-contributor.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-after-type-updating.xml", assertionMode = NON_STRICT) })
public void testUpdateAnalysisType() throws Exception {
    AnalysisUpdateDTO analysisDTO = new AnalysisUpdateDTO();
    analysisDTO.setTypeId(CommonAnalysisType.COHORT_CHARACTERIZATION.name());
    testUpdate(analysisDTO, UPDATED_ANALYSIS_TYPE_JSON_OBJECT, "Cohort Characterization");
}
Also used : AnalysisUpdateDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisUpdateDTO) DatabaseSetups(com.github.springtestdbunit.annotation.DatabaseSetups) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails) ExpectedDatabases(com.github.springtestdbunit.annotation.ExpectedDatabases)

Example 5 with AnalysisDTO

use of com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO 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());
    studyDTO.setKind(study.getKind());
    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)

Aggregations

DatabaseSetups (com.github.springtestdbunit.annotation.DatabaseSetups)4 ExpectedDatabases (com.github.springtestdbunit.annotation.ExpectedDatabases)4 StudyShortDTO (com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO)4 Test (org.junit.Test)4 WithUserDetails (org.springframework.security.test.context.support.WithUserDetails)4 AnalysisUpdateDTO (com.odysseusinc.arachne.portal.api.v1.dto.AnalysisUpdateDTO)3 PermissionsDTO (com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO)3 AnalysisDTO (com.odysseusinc.arachne.portal.api.v1.dto.AnalysisDTO)2 BaseAnalysisDTO (com.odysseusinc.arachne.portal.api.v1.dto.BaseAnalysisDTO)2 ShortBaseAnalysisDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortBaseAnalysisDTO)2 Study (com.odysseusinc.arachne.portal.model.Study)2 OptionDTO (com.odysseusinc.arachne.commons.api.v1.dto.OptionDTO)1 AnalysisCreateDTO (com.odysseusinc.arachne.portal.api.v1.dto.AnalysisCreateDTO)1 AnalysisFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.AnalysisFileDTO)1 Commentable (com.odysseusinc.arachne.portal.api.v1.dto.Commentable)1 CommentableResultFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.CommentableResultFileDTO)1 CommentableSubmissionFileDTO (com.odysseusinc.arachne.portal.api.v1.dto.CommentableSubmissionFileDTO)1 DataSourceDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataSourceDTO)1 ShortUserDTO (com.odysseusinc.arachne.portal.api.v1.dto.ShortUserDTO)1 SubmissionDTO (com.odysseusinc.arachne.portal.api.v1.dto.SubmissionDTO)1