use of com.odysseusinc.arachne.portal.api.v1.dto.InvitationActionDTO in project ArachneCentralAPI by OHDSI.
the class BaseUserController method invitationAccept.
private JsonResult<UserProfileDTO> invitationAccept(InvitationActionDTO invitationActionDTO, U user) throws NotExistException, AlreadyExistException, IOException {
checkIfUserExists(user);
final Boolean invitationAccepted = invitationActionDTO.getAccepted();
final Long invitationId = invitationActionDTO.getId();
switch(invitationActionDTO.getType()) {
case InvitationType.COLLABORATOR:
{
userService.processInvitation(user, invitationId, invitationAccepted, invitationActionDTO.getComment());
break;
}
case InvitationType.DATA_OWNER:
{
studyService.processDataSourceInvitation(user, invitationId, invitationAccepted, invitationActionDTO.getComment());
break;
}
case InvitationType.UNLOCK_ANALYSIS:
{
analysisService.processAnalysisUnlockRequest(user, invitationId, invitationAccepted);
break;
}
case InvitationType.APPROVE_EXECUTE_SUBMISSION:
submissionService.approveSubmission(invitationId, invitationAccepted, invitationActionDTO.getComment(), user);
break;
case InvitationType.APPROVE_PUBLISH_SUBMISSION:
ApproveDTO dto = new ApproveDTO(invitationId, invitationAccepted, Boolean.TRUE, invitationActionDTO.getComment());
submissionService.approveSubmissionResult(invitationId, dto, user);
break;
default:
{
throw new IllegalArgumentException();
}
}
return new JsonResult<>(NO_ERROR, conversionService.convert(userService.getByIdInAnyTenantAndInitializeCollections(user.getId()), UserProfileDTO.class));
}
use of com.odysseusinc.arachne.portal.api.v1.dto.InvitationActionDTO in project ArachneCentralAPI by OHDSI.
the class AnalysisLockingControllerTests method testProcessUnlockRequest.
@Test
@WithUserDetails(value = "user@mail.com")
@DatabaseSetups({ @DatabaseSetup("/data/study/study-participant-with-contributor-and-leader-before.xml"), @DatabaseSetup("/data/analysis/analysis-after-locking.xml"), @DatabaseSetup("/data/analysis/analysis-unlock-requests-before-processing.xml") })
@ExpectedDatabases({ @ExpectedDatabase(value = "/data/study/study-participant-with-contributor-and-leader-before.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-list.xml", assertionMode = NON_STRICT), @ExpectedDatabase(value = "/data/analysis/analysis-unlock-requests-after-processing.xml", assertionMode = NON_STRICT) })
public void testProcessUnlockRequest() throws Exception {
InvitationActionDTO actionDTO = new InvitationActionDTO();
actionDTO.setAccepted(true);
actionDTO.setId(30L);
actionDTO.setType(InvitationType.UNLOCK_ANALYSIS);
mvc.perform(post("/api/v1/user-management/users/invitations").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(actionDTO))).andExpect(NO_ERROR_CODE);
}
use of com.odysseusinc.arachne.portal.api.v1.dto.InvitationActionDTO in project ArachneCentralAPI by OHDSI.
the class StudyControllerTests method testInvitation.
public void testInvitation(Boolean accepted) throws Exception {
InvitationActionDTO invitationActionDTO = new InvitationActionDTO();
invitationActionDTO.setType(COLLABORATOR);
invitationActionDTO.setAccepted(accepted);
invitationActionDTO.setId(2L);
mvc.perform(post("/api/v1/user-management/users/invitations/").contentType(APPLICATION_JSON).content(objectMapper.writeValueAsBytes(invitationActionDTO))).andExpect(NO_ERROR_CODE).andExpect(jsonPath("$.result").isNotEmpty());
}
Aggregations