Search in sources :

Example 6 with AnalysisDTO

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

the class AnalysisControllerTests method testUpdateAnalysisTitle.

@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-title-updating.xml", assertionMode = NON_STRICT) })
public void testUpdateAnalysisTitle() throws Exception {
    AnalysisUpdateDTO analysisDTO = new AnalysisUpdateDTO();
    analysisDTO.setTitle(UPDATED_ANALYSIS_TITLE);
    analysisDTO.setTypeId(ANALYSIS_TYPE_ID);
    testUpdate(analysisDTO, UPDATED_ANALYSIS_JSON_OBJECT, UPDATED_ANALYSIS_TITLE);
}
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 7 with AnalysisDTO

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

the class AnalysisControllerTests method testCreateAnalysis.

@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study-with-contributor.xml"), @DatabaseSetup("/data/analysis/empty-analysis.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study-with-contributor.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis.xml", assertionMode = NON_STRICT) })
public void testCreateAnalysis() throws Exception {
    AnalysisCreateDTO analysisDTO = new AnalysisCreateDTO();
    analysisDTO.setTitle(ANALYSIS_TITLE);
    analysisDTO.setTypeId(ANALYSIS_TYPE_ID);
    analysisDTO.setStudyId(STUDY_ID);
    MvcResult mvcResult = mvc.perform(post("/api/v1/analysis-management/analyses").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(analysisDTO))).andExpect(OK_STATUS).andExpect(NO_ERROR_CODE).andExpect(jsonPath("$.result.id").isNotEmpty()).andReturn();
    JSONObject result = getResultJSONObject(mvcResult);
    JSONAssert.assertEquals(ANALYSIS_JSON_OBJECT, result, false);
}
Also used : AnalysisCreateDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisCreateDTO) JSONObject(org.json.JSONObject) MvcResult(org.springframework.test.web.servlet.MvcResult) 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 8 with AnalysisDTO

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

the class BaseAnalysisToAnalysisDTOConverter method convert.

@Override
public AD convert(A source) {
    BaseAnalysisDTO baseAnalysisDTO = conversionService.convert(source, BaseAnalysisDTO.class);
    AD analysisDTO = createResultObject();
    converterUtils.shallowCopy(analysisDTO, baseAnalysisDTO);
    analysisDTO.setStudy(conversionService.convert(source.getStudy(), StudyShortDTO.class));
    if (source.getFiles() != null) {
        for (AnalysisFile analysisFile : source.getFiles()) {
            analysisDTO.getFiles().add(conversionService.convert(analysisFile, AnalysisFileDTO.class));
        }
    }
    analysisDTO.setPermissions(conversionService.convert(source, PermissionsDTO.class));
    analysisDTO.setLocked(source.getLocked());
    return analysisDTO;
}
Also used : BaseAnalysisDTO(com.odysseusinc.arachne.portal.api.v1.dto.BaseAnalysisDTO) StudyShortDTO(com.odysseusinc.arachne.portal.api.v1.dto.StudyShortDTO) PermissionsDTO(com.odysseusinc.arachne.portal.api.v1.dto.PermissionsDTO) AnalysisFile(com.odysseusinc.arachne.portal.model.AnalysisFile) AnalysisFileDTO(com.odysseusinc.arachne.portal.api.v1.dto.AnalysisFileDTO)

Example 9 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());
    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