Search in sources :

Example 1 with ParticipationStatus

use of org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus in project gpconnect-demonstrator by nhsconnect.

the class AppointmentValidation method validateParticipantStatus.

public void validateParticipantStatus(ParticipationStatus participationStatus, Enumeration<ParticipationStatus> enumeration, Enumeration<ParticipationStatus> enumeration2) {
    Boolean validStatus = false;
    String participantStatusErr = "is a requirement but is missing.";
    if (participationStatus != null) {
        participantStatusErr = String.format("%s is not a valid ParticipationStatus code", participationStatus);
        EnumSet<ParticipationStatus> statusList = EnumSet.allOf(ParticipationStatus.class);
        validStatus = statusList.contains(enumeration.getValue());
    }
    if (!validStatus) {
        throw OperationOutcomeFactory.buildOperationOutcomeException(new UnprocessableEntityException(String.format("Appointment Participant %s Status %s", enumeration2, participantStatusErr)), SystemCode.INVALID_RESOURCE, IssueType.INVALID);
    }
}
Also used : UnprocessableEntityException(ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException) ParticipationStatus(org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus)

Aggregations

UnprocessableEntityException (ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException)1 ParticipationStatus (org.hl7.fhir.dstu3.model.Appointment.ParticipationStatus)1