use of com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateContributorRoleToContributor.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-with-2-leaders-before-updating.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-with-contributor-and-leader.xml", assertionMode = NON_STRICT) })
public void testUpdateContributorRoleToContributor() throws Exception {
UpdateParticipantDTO participantDTO = new UpdateParticipantDTO();
participantDTO.setRole(CONTRIBUTOR.name());
mvc.perform(put("/api/v1/study-management/studies/" + STUDY_ID + "/participants/" + UserIdUtils.idToUuid(ADMIN_ID)).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(participantDTO))).andExpect(NO_ERROR_CODE).andReturn();
}
use of com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO in project ArachneCentralAPI by OHDSI.
the class ParticipantLinkToParticipantExtendedDTOConverter method convert.
@Override
public ParticipantExtendedDTO convert(ParticipantLink participantLink) {
final ParticipantExtendedDTO participantDTO = new ParticipantExtendedDTO();
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());
participantDTO.setAffilation(user.getAffiliation());
participantDTO.setProfessionalType(user.getProfessionalType());
return participantDTO;
}
use of com.odysseusinc.arachne.portal.api.v1.dto.ParticipantDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testUpdateContributorRoleForLastLeadInvestigator.
@Test
@WithUserDetails(value = ADMIN_EMAIL)
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-before-changing-role.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-before-changing-role.xml", assertionMode = NON_STRICT) })
public void testUpdateContributorRoleForLastLeadInvestigator() throws Exception {
UpdateParticipantDTO participantDTO = new UpdateParticipantDTO();
participantDTO.setRole(CONTRIBUTOR.name());
mvc.perform(put("/api/v1/study-management/studies/" + STUDY_ID + "/participants/" + UserIdUtils.idToUuid(ADMIN_ID)).contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(participantDTO))).andExpect(jsonPath("$.errorCode").value(VALIDATION_ERROR.getCode()));
}
Aggregations