Search in sources :

Example 46 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project org.hl7.fhir.core by hapifhir.

the class OperationOutcome method copy.

public OperationOutcome copy() {
    OperationOutcome dst = new OperationOutcome();
    copyValues(dst);
    if (issue != null) {
        dst.issue = new ArrayList<OperationOutcomeIssueComponent>();
        for (OperationOutcomeIssueComponent i : issue) dst.issue.add(i.copy());
    }
    ;
    return dst;
}
Also used : IBaseOperationOutcome(org.hl7.fhir.instance.model.api.IBaseOperationOutcome)

Example 47 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project org.hl7.fhir.core by hapifhir.

the class ToolingExtensions method readValidationMessage.

public static ValidationMessage readValidationMessage(OperationOutcomeIssueComponent issue, Source source) {
    ValidationMessage vm = new ValidationMessage();
    vm.setSource(source);
    vm.setLevel(mapSeverity(issue.getSeverity()));
    vm.setType(mapType(issue.getCode()));
    if (issue.hasExtension(ToolingExtensions.EXT_ISSUE_LINE))
        vm.setLine(ToolingExtensions.readIntegerExtension(issue, ToolingExtensions.EXT_ISSUE_LINE, 0));
    if (issue.hasExtension(ToolingExtensions.EXT_ISSUE_COL))
        vm.setCol(ToolingExtensions.readIntegerExtension(issue, ToolingExtensions.EXT_ISSUE_COL, 0));
    if (issue.hasExpression())
        vm.setLocation(issue.getExpression().get(0).asStringValue());
    vm.setMessage(issue.getDetails().getText());
    if (issue.hasExtension("http://hl7.org/fhir/StructureDefinition/rendering-xhtml"))
        vm.setHtml(ToolingExtensions.readStringExtension(issue, "http://hl7.org/fhir/StructureDefinition/rendering-xhtml"));
    return vm;
}
Also used : ValidationMessage(org.hl7.fhir.utilities.validation.ValidationMessage)

Example 48 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project org.hl7.fhir.core by hapifhir.

the class OperationOutcomeUtilities method convertToIssue.

public static OperationOutcomeIssueComponent convertToIssue(ValidationMessage message, OperationOutcome op) {
    OperationOutcomeIssueComponent issue = new OperationOutcome.OperationOutcomeIssueComponent();
    issue.setUserData("source.vm", message);
    issue.setCode(convert(message.getType()));
    if (message.getLocation() != null) {
        // message location has a fhirPath in it. We need to populate the expression
        issue.addExpression(message.getLocation());
    }
    // pass through line/col if they're present
    if (message.getLine() >= 0)
        issue.addExtension().setUrl(ToolingExtensions.EXT_ISSUE_LINE).setValue(new IntegerType(message.getLine()));
    if (message.getCol() >= 0)
        issue.addExtension().setUrl(ToolingExtensions.EXT_ISSUE_COL).setValue(new IntegerType(message.getCol()));
    issue.setSeverity(convert(message.getLevel()));
    CodeableConcept c = new CodeableConcept();
    c.setText(message.getMessage());
    issue.setDetails(c);
    if (message.getSource() != null) {
        issue.getExtension().add(ToolingExtensions.makeIssueSource(message.getSource()));
    }
    if (message.getMessageId() != null) {
        issue.getExtension().add(ToolingExtensions.makeIssueMessageId(message.getMessageId()));
    }
    issue.setUserData("source.msg", message);
    return issue;
}
Also used : IntegerType(org.hl7.fhir.r5.model.IntegerType) OperationOutcomeIssueComponent(org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent) CodeableConcept(org.hl7.fhir.r5.model.CodeableConcept)

Example 49 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project org.hl7.fhir.core by hapifhir.

the class OperationOutcomeUtilities method convertToIssue.

public static OperationOutcomeIssueComponent convertToIssue(ValidationMessage message, OperationOutcome op) {
    OperationOutcomeIssueComponent issue = new OperationOutcome.OperationOutcomeIssueComponent();
    issue.setCode(convert(message.getType()));
    if (message.getLocation() != null) {
        // message location has a fhirPath in it. We need to populate the expression
        issue.addExpression(message.getLocation());
        // also, populate the XPath variant
        StringType s = new StringType();
        s.setValue(Utilities.fhirPathToXPath(message.getLocation()) + (message.getLine() >= 0 && message.getCol() >= 0 ? " (line " + Integer.toString(message.getLine()) + ", col" + Integer.toString(message.getCol()) + ")" : ""));
        issue.getLocation().add(s);
    }
    issue.setSeverity(convert(message.getLevel()));
    CodeableConcept c = new CodeableConcept();
    c.setText(message.getMessage());
    issue.setDetails(c);
    if (message.getSource() != null) {
        issue.getExtension().add(ToolingExtensions.makeIssueSource(message.getSource()));
    }
    return issue;
}
Also used : OperationOutcomeIssueComponent(org.hl7.fhir.dstu3.model.OperationOutcome.OperationOutcomeIssueComponent) StringType(org.hl7.fhir.dstu3.model.StringType) CodeableConcept(org.hl7.fhir.dstu3.model.CodeableConcept)

Example 50 with OperationOutcomeIssueComponent

use of org.hl7.fhir.r4b.model.OperationOutcome.OperationOutcomeIssueComponent in project org.hl7.fhir.core by hapifhir.

the class OperationOutcomeUtilities method convertToIssue.

public static OperationOutcomeIssueComponent convertToIssue(ValidationMessage message, OperationOutcome op) {
    OperationOutcomeIssueComponent issue = new OperationOutcome.OperationOutcomeIssueComponent();
    issue.setCode(convert(message.getType()));
    if (message.getLocation() != null) {
        // message location has a fhirPath in it. We need to populate the expression
        issue.addExpression(message.getLocation());
    }
    // pass through line/col if they're present
    if (message.getLine() != 0)
        issue.addExtension().setUrl(ToolingExtensions.EXT_ISSUE_LINE).setValue(new IntegerType(message.getLine()));
    if (message.getCol() != 0)
        issue.addExtension().setUrl(ToolingExtensions.EXT_ISSUE_COL).setValue(new IntegerType(message.getCol()));
    issue.setSeverity(convert(message.getLevel()));
    CodeableConcept c = new CodeableConcept();
    c.setText(message.getMessage());
    issue.setDetails(c);
    if (message.getSource() != null) {
        issue.getExtension().add(ToolingExtensions.makeIssueSource(message.getSource()));
    }
    return issue;
}
Also used : IntegerType(org.hl7.fhir.r4.model.IntegerType) OperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

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