Search in sources :

Example 16 with ParticipantCohortAnnotation

use of org.pmiops.workbench.db.model.ParticipantCohortAnnotation 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);
}
Also used : NotFoundException(org.pmiops.workbench.exceptions.NotFoundException) ParticipantCohortAnnotation(org.pmiops.workbench.db.model.ParticipantCohortAnnotation)

Aggregations

ParticipantCohortAnnotation (org.pmiops.workbench.db.model.ParticipantCohortAnnotation)16 Test (org.junit.Test)12 CohortAnnotationDefinition (org.pmiops.workbench.db.model.CohortAnnotationDefinition)5 NotFoundException (org.pmiops.workbench.exceptions.NotFoundException)5 DataJpaTest (org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest)4 CohortAnnotationEnumValue (org.pmiops.workbench.db.model.CohortAnnotationEnumValue)3 ModifyParticipantCohortAnnotationRequest (org.pmiops.workbench.model.ModifyParticipantCohortAnnotationRequest)3 Date (java.sql.Date)2 SimpleDateFormat (java.text.SimpleDateFormat)2 BadRequestException (org.pmiops.workbench.exceptions.BadRequestException)2 ParseException (java.text.ParseException)1 List (java.util.List)1 Logger (java.util.logging.Logger)1 Collectors (java.util.stream.Collectors)1 Provider (javax.inject.Provider)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Before (org.junit.Before)1 GenderRaceEthnicityConcept (org.pmiops.workbench.cdr.cache.GenderRaceEthnicityConcept)1 PageRequest (org.pmiops.workbench.cohortreview.util.PageRequest)1 CohortAnnotationDefinitionDao (org.pmiops.workbench.db.dao.CohortAnnotationDefinitionDao)1