use of com.odysseusinc.arachne.portal.model.ParticipantStatus in project ArachneCentralAPI by OHDSI.
the class PaperSpecification method getUserStudyLinkSubquery.
protected Subquery<UserStudyExtended> getUserStudyLinkSubquery(CriteriaQuery<?> query, CriteriaBuilder cb, Path<Long> studyId) {
final Subquery<UserStudyExtended> userStudyExtendedLinkSubquery = query.subquery(UserStudyExtended.class);
final Root<UserStudyExtended> userStudyLinkRoot = userStudyExtendedLinkSubquery.from(UserStudyExtended.class);
userStudyExtendedLinkSubquery.select(userStudyLinkRoot);
final Path<RawUser> linkUser = userStudyLinkRoot.get(UserStudyExtended_.user);
final Path<Study> linkStudy = userStudyLinkRoot.get(UserStudyExtended_.study);
final Path<Long> linkStudyId = linkStudy.get(Study_.id);
final Path<ParticipantStatus> linkStatus = userStudyLinkRoot.get(UserStudyExtended_.status);
Predicate userStudyPredicate = cb.and(cb.equal(linkUser, user), cb.equal(linkStudyId, studyId));
userStudyPredicate = cb.and(userStudyPredicate, cb.notEqual(linkStatus, ParticipantStatus.DELETED));
userStudyExtendedLinkSubquery.where(userStudyPredicate);
return userStudyExtendedLinkSubquery;
}
use of com.odysseusinc.arachne.portal.model.ParticipantStatus 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.findByIdAndUserId(id, user.getId());
if (userStudy != null) {
ParticipantStatus status = TRUE.equals(accepted) ? APPROVED : DECLINED;
userStudy.setStatus(status);
userStudy.setComment(DECLINED == status ? comment : null);
userStudyRepository.save(userStudy);
}
return userStudy;
}
Aggregations