Search in sources :

Example 1 with DataSource

use of com.odysseusinc.arachne.portal.model.DataSource in project ArachneCentralAPI by OHDSI.

the class DataNodeController method convertCommonDataSourceDtoToDataSource.

@Override
protected DataSource convertCommonDataSourceDtoToDataSource(CommonDataSourceDTO commonDataSourceDTO) {
    DataSource ds = conversionService.convert(commonDataSourceDTO, DataSource.class);
    ds.setModelType(null);
    ds.setHealthStatus(CommonHealthStatus.GREEN);
    return ds;
}
Also used : DataSource(com.odysseusinc.arachne.portal.model.DataSource)

Example 2 with DataSource

use of com.odysseusinc.arachne.portal.model.DataSource in project ArachneCentralAPI by OHDSI.

the class ParticipantLinkToParticipantDTOConverter method convert.

@Override
public ParticipantDTO convert(ParticipantLink participantLink) {
    ParticipantDTO participantDTO = new ParticipantDTO();
    ParticipantRole role = participantLink.getRole();
    final IUser user = participantLink.getUser();
    participantDTO.setId(user.getUuid());
    participantDTO.setFullName(user.getFullName());
    participantDTO.setRole(new OptionDTO(role.name(), role.toString()));
    participantDTO.setStatus(participantLink.getStatus().toString());
    if (participantLink instanceof UserStudyExtended) {
        if (DECLINED == participantLink.getStatus() && !isEmpty(((UserStudyExtended) participantLink).getComment())) {
            participantDTO.setComment(((UserStudyExtended) participantLink).getComment());
        }
        if (role.equals(ParticipantRole.DATA_SET_OWNER)) {
            DataSource ownedDataSource = ((UserStudyExtended) participantLink).getDataSource();
            participantDTO = new DataOwnerParticipantDTO(participantDTO, ownedDataSource.getId());
        }
    }
    return participantDTO;
}
Also used : DataOwnerParticipantDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataOwnerParticipantDTO) IUser(com.odysseusinc.arachne.portal.model.IUser) ParticipantDTO(com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO) DataOwnerParticipantDTO(com.odysseusinc.arachne.portal.api.v1.dto.DataOwnerParticipantDTO) OptionDTO(com.odysseusinc.arachne.commons.api.v1.dto.OptionDTO) UserStudyExtended(com.odysseusinc.arachne.portal.model.UserStudyExtended) ParticipantRole(com.odysseusinc.arachne.portal.model.ParticipantRole) DataSource(com.odysseusinc.arachne.portal.model.DataSource)

Example 3 with DataSource

use of com.odysseusinc.arachne.portal.model.DataSource in project ArachneCentralAPI by OHDSI.

the class AnalysisHelperTest method prepareDataSource.

private DataSource prepareDataSource() {
    DataSource dataSource = new DataSource();
    dataSource.setId(1L);
    dataSource.setName("test");
    return dataSource;
}
Also used : DataSource(com.odysseusinc.arachne.portal.model.DataSource)

Example 4 with DataSource

use of com.odysseusinc.arachne.portal.model.DataSource in project ArachneCentralAPI by OHDSI.

the class AnalysisHelperTest method createSubmission.

@Test
@WithUserDetails("admin@odysseusinc.com")
public void createSubmission() throws Exception {
    DataSource dataSource = prepareDataSource();
    when(dataSourceService.getByIdUnsecured(1L)).thenReturn(dataSource);
    IUser user = prepareUser();
    Study study = prepareStudy(user);
    Analysis analysis = prepareAnalysis(user, study);
    List<Submission> submissions = AnalysisHelper.createSubmission(submissionService, Collections.<Long>singletonList(1L), user, analysis);
    try {
        assertThat(submissions, is(not(empty())));
        assertThat(submissions, contains(hasProperty("status", notNullValue())));
        assertThat(submissions, contains(hasProperty("submissionGroup", notNullValue())));
    } finally {
        cleanup(submissions, analysis, study);
    }
}
Also used : Study(com.odysseusinc.arachne.portal.model.Study) Submission(com.odysseusinc.arachne.portal.model.Submission) Analysis(com.odysseusinc.arachne.portal.model.Analysis) IUser(com.odysseusinc.arachne.portal.model.IUser) DataSource(com.odysseusinc.arachne.portal.model.DataSource) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test) WithUserDetails(org.springframework.security.test.context.support.WithUserDetails)

Aggregations

DataSource (com.odysseusinc.arachne.portal.model.DataSource)4 IUser (com.odysseusinc.arachne.portal.model.IUser)2 OptionDTO (com.odysseusinc.arachne.commons.api.v1.dto.OptionDTO)1 DataOwnerParticipantDTO (com.odysseusinc.arachne.portal.api.v1.dto.DataOwnerParticipantDTO)1 ParticipantDTO (com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO)1 Analysis (com.odysseusinc.arachne.portal.model.Analysis)1 ParticipantRole (com.odysseusinc.arachne.portal.model.ParticipantRole)1 Study (com.odysseusinc.arachne.portal.model.Study)1 Submission (com.odysseusinc.arachne.portal.model.Submission)1 UserStudyExtended (com.odysseusinc.arachne.portal.model.UserStudyExtended)1 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 WithUserDetails (org.springframework.security.test.context.support.WithUserDetails)1