use of org.hl7.fhir.r4.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;
}
use of org.hl7.fhir.r4.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;
}
use of org.hl7.fhir.r4.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;
}
use of org.hl7.fhir.r4.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;
}
use of org.hl7.fhir.r4.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;
}
Aggregations