Search in sources :

Example 36 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project cqf-ruler by DBCG.

the class CodeSystemProviderIT method testCodeSystemUpdateValueSetIdNull.

@Test
@Order(2)
public void testCodeSystemUpdateValueSetIdNull() {
    OperationOutcome outcome = codeSystemUpdateProvider.updateCodeSystems(new ValueSet().getIdElement());
    assertEquals(1, outcome.getIssue().size());
    OperationOutcomeIssueComponent issue = outcome.getIssue().get(0);
    assertEquals(OperationOutcome.IssueSeverity.ERROR, issue.getSeverity());
    assertTrue(issue.getDetails().getText().startsWith("Unable to find Resource: null"));
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) ValueSet(org.hl7.fhir.r4.model.ValueSet) Order(org.junit.jupiter.api.Order) TestMethodOrder(org.junit.jupiter.api.TestMethodOrder) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 37 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project elexis-server by elexis.

the class ResourceProviderUtil method generateOperationOutcome.

private OperationOutcome generateOperationOutcome(IFhirTransformerException e) {
    OperationOutcome opOutcome = new OperationOutcome();
    OperationOutcomeIssueComponent ooc = new OperationOutcomeIssueComponent();
    OperationOutcome.IssueSeverity severity = OperationOutcome.IssueSeverity.valueOf(e.getSeverity().toUpperCase());
    ooc.setSeverity(severity);
    IssueType issueType = e.getCode() == 412 ? IssueType.PROCESSING : IssueType.BUSINESSRULE;
    ooc.setCode(issueType);
    ooc.setDiagnostics(e.getMessage());
    opOutcome.addIssue(ooc);
    return opOutcome;
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) IssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType)

Example 38 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project pathling by aehrc.

the class ErrorHandlingInterceptor method buildException.

@Nonnull
@SuppressWarnings("SameParameterValue")
private static BaseServerResponseException buildException(final int theStatusCode, @Nonnull final String message, @Nonnull final IssueType issueType) {
    final OperationOutcome opOutcome = new OperationOutcome();
    final OperationOutcomeIssueComponent issue = new OperationOutcomeIssueComponent();
    issue.setSeverity(IssueSeverity.ERROR);
    issue.setDiagnostics(message);
    issue.setCode(issueType);
    opOutcome.addIssue(issue);
    final BaseServerResponseException ex = BaseServerResponseException.newInstance(theStatusCode, message);
    ex.setOperationOutcome(opOutcome);
    return ex;
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) BaseServerResponseException(ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException) Nonnull(javax.annotation.Nonnull)

Example 39 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project pathling by aehrc.

the class AsyncAspect method buildOperationOutcome.

@Nonnull
private static OperationOutcome buildOperationOutcome() {
    final OperationOutcome opOutcome = new OperationOutcome();
    final OperationOutcomeIssueComponent issue = new OperationOutcomeIssueComponent();
    issue.setCode(IssueType.INFORMATIONAL);
    issue.setSeverity(IssueSeverity.INFORMATION);
    issue.setDiagnostics("Job accepted for processing, see the Content-Location header for the " + "URL at which status can be queried");
    opOutcome.addIssue(issue);
    return opOutcome;
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) Nonnull(javax.annotation.Nonnull)

Example 40 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project pathling by aehrc.

the class ErrorHandlingInterceptorTest method convertsAccessDeniedError.

@Test
void convertsAccessDeniedError() {
    final BaseServerResponseException actualException = callInterceptor(new AccessDeniedError("Access denied", "operation:import"));
    assertTrue(actualException instanceof ForbiddenOperationException);
    assertEquals(403, actualException.getStatusCode());
    assertEquals("Access denied", actualException.getMessage());
    final OperationOutcomeIssueComponent expectedIssue = new OperationOutcomeIssueComponent();
    expectedIssue.setSeverity(IssueSeverity.ERROR);
    expectedIssue.setCode(IssueType.FORBIDDEN);
    expectedIssue.setDiagnostics("Access denied");
    assertTrue(expectedIssue.equalsDeep(((OperationOutcome) actualException.getOperationOutcome()).getIssueFirstRep()));
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) OperationOutcome(org.hl7.fhir.r4.model.OperationOutcome) ForbiddenOperationException(ca.uhn.fhir.rest.server.exceptions.ForbiddenOperationException) BaseServerResponseException(ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException) AccessDeniedError(au.csiro.pathling.errors.AccessDeniedError) Test(org.junit.jupiter.api.Test)

Aggregations

OperationOutcomeIssueComponent (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent)23 OperationOutcome (org.hl7.fhir.r4.model.OperationOutcome)20 Test (org.junit.jupiter.api.Test)17 OperationOutcomeIssueComponent (org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent)10 Order (org.junit.jupiter.api.Order)10 TestMethodOrder (org.junit.jupiter.api.TestMethodOrder)10 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 OperationOutcomeIssueComponent (org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent)8 OperationOutcome (org.hl7.fhir.dstu3.model.OperationOutcome)7 OperationOutcome (org.hl7.fhir.r5.model.OperationOutcome)5 CacheVerificationLogger (org.hl7.fhir.utilities.tests.CacheVerificationLogger)5 XhtmlNode (org.hl7.fhir.utilities.xhtml.XhtmlNode)5 ValidationEngine (org.hl7.fhir.validation.ValidationEngine)5 BufferedReader (java.io.BufferedReader)4 InputStreamReader (java.io.InputStreamReader)4 Nonnull (javax.annotation.Nonnull)4 ValueSet (org.hl7.fhir.dstu3.model.ValueSet)4 IBaseOperationOutcome (org.hl7.fhir.instance.model.api.IBaseOperationOutcome)3 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)3