Search in sources :

Example 6 with UserStudy

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

the class BaseUserServiceImpl method processInvitation.

@Override
public UserStudy processInvitation(U user, Long id, Boolean accepted, String comment) {
    UserStudy userStudy = userStudyRepository.findByIdAndUser(id, user);
    if (userStudy != null) {
        ParticipantStatus status = TRUE.equals(accepted) ? APPROVED : DECLINED;
        userStudy.setStatus(status);
        userStudy.setComment(DECLINED == status ? comment : null);
        userStudyRepository.save(userStudy);
    }
    return userStudy;
}
Also used : ParticipantStatus(com.odysseusinc.arachne.portal.model.ParticipantStatus) UserStudy(com.odysseusinc.arachne.portal.model.UserStudy)

Aggregations

UserStudy (com.odysseusinc.arachne.portal.model.UserStudy)6 NotExistException (com.odysseusinc.arachne.portal.exception.NotExistException)4 IUser (com.odysseusinc.arachne.portal.model.IUser)4 FavouriteStudy (com.odysseusinc.arachne.portal.model.FavouriteStudy)3 Study (com.odysseusinc.arachne.portal.model.Study)3 User (com.odysseusinc.arachne.portal.model.User)3 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)3 DataNodeUser (com.odysseusinc.arachne.portal.model.DataNodeUser)2 Date (java.util.Date)2 JsonResult (com.odysseusinc.arachne.commons.api.v1.dto.util.JsonResult)1 UpdateNotificationDTO (com.odysseusinc.arachne.portal.api.v1.dto.UpdateNotificationDTO)1 AlreadyExistException (com.odysseusinc.arachne.portal.exception.AlreadyExistException)1 ParticipantStatus (com.odysseusinc.arachne.portal.model.ParticipantStatus)1 InvitationCollaboratorMailSender (com.odysseusinc.arachne.portal.service.mail.InvitationCollaboratorMailSender)1 ApiOperation (io.swagger.annotations.ApiOperation)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1