use of org.pmiops.workbench.exceptions.NotFoundException in project workbench by all-of-us.
the class CohortReviewServiceImpl method updateParticipantCohortAnnotation.
@Override
public ParticipantCohortAnnotation updateParticipantCohortAnnotation(Long annotationId, Long cohortReviewId, Long participantId, ModifyParticipantCohortAnnotationRequest modifyRequest) {
ParticipantCohortAnnotation participantCohortAnnotation = participantCohortAnnotationDao.findByAnnotationIdAndCohortReviewIdAndParticipantId(annotationId, cohortReviewId, participantId);
if (participantCohortAnnotation == null) {
throw new NotFoundException(String.format("Not Found: Participant Cohort Annotation does not exist for annotationId: %s, cohortReviewId: %s, participantId: %s", annotationId, cohortReviewId, participantId));
}
participantCohortAnnotation.annotationValueString(modifyRequest.getAnnotationValueString()).annotationValueEnum(modifyRequest.getAnnotationValueEnum()).annotationValueDateString(modifyRequest.getAnnotationValueDate()).annotationValueBoolean(modifyRequest.getAnnotationValueBoolean()).annotationValueInteger(modifyRequest.getAnnotationValueInteger());
CohortAnnotationDefinition cohortAnnotationDefinition = findCohortAnnotationDefinition(participantCohortAnnotation.getCohortAnnotationDefinitionId());
validateParticipantCohortAnnotation(participantCohortAnnotation, cohortAnnotationDefinition);
return participantCohortAnnotationDao.save(participantCohortAnnotation);
}
use of org.pmiops.workbench.exceptions.NotFoundException in project workbench by all-of-us.
the class CohortReviewServiceImpl method deleteParticipantCohortAnnotation.
@Override
public void deleteParticipantCohortAnnotation(Long annotationId, Long cohortReviewId, Long participantId) {
ParticipantCohortAnnotation participantCohortAnnotation = participantCohortAnnotationDao.findByAnnotationIdAndCohortReviewIdAndParticipantId(annotationId, cohortReviewId, participantId);
if (participantCohortAnnotation == null) {
throw new NotFoundException(String.format("Not Found: No participant cohort annotation found for annotationId: %s," + " cohortReviewId: %s, participantId: %s", annotationId, cohortReviewId, participantId));
}
participantCohortAnnotationDao.delete(participantCohortAnnotation);
}
Aggregations