preserve message id in operation outcome

This commit is contained in:
Grahame Grieve 2022-03-15 06:44:10 +11:00
parent 084da8b576
commit e8e6337b7c
2 changed files with 14 additions and 0 deletions

View File

@ -65,6 +65,9 @@ public class OperationOutcomeUtilities {
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;
}

View File

@ -119,6 +119,7 @@ public class ToolingExtensions {
private static final String EXT_IDENTIFIER = "http://hl7.org/fhir/StructureDefinition/identifier";
public static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation";
public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source";
public static final String EXT_ISSUE_MSG_ID = "http://hl7.org/fhir/StructureDefinition/operationoutcome-message-id";
public static final String EXT_ISSUE_LINE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line";
public static final String EXT_ISSUE_COL = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-col";
public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint";
@ -214,6 +215,16 @@ public class ToolingExtensions {
return ex;
}
public static Extension makeIssueMessageId(String msgId) {
Extension ex = new Extension();
// todo: write this up and get it published with the pack (and handle the redirect?)
ex.setUrl(ToolingExtensions.EXT_ISSUE_MSG_ID);
CodeType c = new CodeType();
c.setValue(msgId);
ex.setValue(c);
return ex;
}
public static boolean hasExtension(DomainResource de, String url) {
return getExtension(de, url) != null;
}