mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-09 06:14:45 +00:00
Add support for tracking source server of issue
This commit is contained in:
parent
d429f48760
commit
159e189520
@ -1736,7 +1736,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
||||
if (p.getName().equals("issues")) {
|
||||
OperationOutcome oo = (OperationOutcome) p.getResource();
|
||||
for (OperationOutcomeIssueComponent iss : oo.getIssue()) {
|
||||
iss.addExtension("http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-server", new UrlType(server));
|
||||
iss.addExtension(ToolingExtensions.EXT_ISSUE_SERVER, new UrlType(server));
|
||||
issues.add(iss);
|
||||
}
|
||||
} else {
|
||||
|
@ -40,6 +40,7 @@ import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity;
|
||||
import org.hl7.fhir.r5.model.OperationOutcome.IssueType;
|
||||
import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent;
|
||||
import org.hl7.fhir.r5.model.StringType;
|
||||
import org.hl7.fhir.r5.model.UrlType;
|
||||
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
|
||||
import org.hl7.fhir.utilities.validation.ValidationMessage;
|
||||
|
||||
@ -154,6 +155,9 @@ public class OperationOutcomeUtilities {
|
||||
if (message.sliceText != null) {
|
||||
issue.addExtension(ToolingExtensions.EXT_ISSUE_SLICE_INFO, new StringType(CommaSeparatedStringBuilder.join("; ", message.sliceText)));
|
||||
}
|
||||
if (message.getServer() != null) {
|
||||
issue.addExtension(ToolingExtensions.EXT_ISSUE_SERVER, new UrlType(message.getServer()));
|
||||
}
|
||||
return issue;
|
||||
}
|
||||
|
||||
|
@ -267,6 +267,7 @@ public class ToolingExtensions {
|
||||
public static final String EXT_ED_SUPPRESS = "http://hl7.org/fhir/StructureDefinition/elementdefinition-suppress";
|
||||
public static final String EXT_SEARCH_PARAMETER_BASE = "http://hl7.org/fhir/tools/StructureDefinition/searchparameter-base-type";
|
||||
public static final String EXT_ISSUE_SLICE_INFO = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-slicetext";
|
||||
public static final String EXT_ISSUE_SERVER = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-server";
|
||||
|
||||
// specific extension helpers
|
||||
|
||||
|
@ -505,6 +505,7 @@ public class ValidationMessage implements Comparator<ValidationMessage>, Compara
|
||||
|
||||
|
||||
private Source source;
|
||||
private String server;
|
||||
private int line;
|
||||
private int col;
|
||||
private String location; // fhirPath
|
||||
@ -929,7 +930,13 @@ public class ValidationMessage implements Comparator<ValidationMessage>, Compara
|
||||
public void setSliceInfo(List<ValidationMessage> sliceInfo) {
|
||||
this.sliceInfo = sliceInfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
public void setServer(String server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
}
|
@ -724,11 +724,8 @@ public class BaseValidator implements IValidationContextResourceLoader {
|
||||
IssueType code = IssueType.fromCode(issue.getCode().toCode());
|
||||
IssueSeverity severity = IssueSeverity.fromCode(issue.getSeverity().toCode());
|
||||
ValidationMessage vmsg = new ValidationMessage(Source.TerminologyEngine, code, line, col, path, issue.getDetails().getText(), severity).setTxLink(txLink);
|
||||
// if (checkMsgId(msg, vmsg)) {
|
||||
vmsg.setServer(issue.getExtensionString(ToolingExtensions.EXT_ISSUE_SERVER));
|
||||
errors.add(vmsg);
|
||||
// }
|
||||
// }
|
||||
// return thePass;
|
||||
return vmsg;
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,7 @@ import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.test.utils.TestingUtilities;
|
||||
import org.hl7.fhir.r5.utils.OperationOutcomeUtilities;
|
||||
import org.hl7.fhir.r5.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.r5.utils.validation.BundleValidationRule;
|
||||
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
||||
import org.hl7.fhir.r5.utils.validation.IValidationPolicyAdvisor;
|
||||
@ -450,7 +451,7 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
||||
}
|
||||
|
||||
private ValidationEngine buildVersionEngine(String ver, String txLog) throws Exception {
|
||||
String server = FhirSettings.getTxFhirLocal();
|
||||
String server = FhirSettings.getTxFhirDevelopment();
|
||||
switch (ver) {
|
||||
case "1.0": return TestUtilities.getValidationEngine("hl7.fhir.r2.core#1.0.2", server, txLog, FhirPublication.DSTU2, true, "1.0.2");
|
||||
case "1.4": return TestUtilities.getValidationEngine("hl7.fhir.r2b.core#1.4.0", server, txLog, FhirPublication.DSTU2016May, true, "1.4.0");
|
||||
@ -655,8 +656,11 @@ public class ValidationTests implements IEvaluationContext, IValidatorResourceFe
|
||||
|
||||
private OperationOutcomeIssueComponent findMatchingIssue(OperationOutcome oo, OperationOutcomeIssueComponent iss) {
|
||||
for (OperationOutcomeIssueComponent t : oo.getIssue()) {
|
||||
if (t.getExpression().get(0).getValue().equals(iss.getExpression().get(0).getValue()) && t.getCode() == iss.getCode() && t.getSeverity() == iss.getSeverity()
|
||||
&& (t.hasDiagnostics() ? t.getDiagnostics().equals(iss.getDiagnostics()) : !iss.hasDiagnostics()) && textMatches(t.getDetails().getText(), iss.getDetails().getText())) {
|
||||
if (t.getExpression().get(0).getValue().equals(iss.getExpression().get(0).getValue()) &&
|
||||
t.getCode() == iss.getCode() && t.getSeverity() == iss.getSeverity() &&
|
||||
(t.hasDiagnostics() ? t.getDiagnostics().equals(iss.getDiagnostics()) : !iss.hasDiagnostics()) &&
|
||||
(t.getExtensionString(ToolingExtensions.EXT_ISSUE_SERVER) != null ? t.getExtensionString(ToolingExtensions.EXT_ISSUE_SERVER).equals(iss.getExtensionString(ToolingExtensions.EXT_ISSUE_SERVER)) : iss.getExtensionString(ToolingExtensions.EXT_ISSUE_SERVER) == null) &&
|
||||
textMatches(t.getDetails().getText(), iss.getDetails().getText())) {
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user