Adjust validation for changes to validation behaviour
This commit is contained in:
parent
cf28e3b440
commit
683408c3c5
|
@ -36,7 +36,9 @@ public class ValidationResult {
|
|||
|
||||
public ValidationResult(IssueSeverity severity, String message, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.messages.add(message);
|
||||
if (message != null) {
|
||||
this.messages.add(message);
|
||||
}
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
}
|
||||
|
@ -51,7 +53,20 @@ public class ValidationResult {
|
|||
|
||||
public ValidationResult(IssueSeverity severity, String message, String system, String version, ConceptDefinitionComponent definition, String preferredDisplay, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.messages.add(message);
|
||||
if (message != null) {
|
||||
this.messages.add(message);
|
||||
}
|
||||
this.system = system;
|
||||
this.version = version;
|
||||
this.definition = definition;
|
||||
this.preferredDisplay = preferredDisplay;
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
}
|
||||
}
|
||||
public ValidationResult(IssueSeverity severity, List<String> messages, String system, String version, ConceptDefinitionComponent definition, String preferredDisplay, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.messages.addAll(messages);
|
||||
this.system = system;
|
||||
this.version = version;
|
||||
this.definition = definition;
|
||||
|
@ -63,7 +78,9 @@ public class ValidationResult {
|
|||
|
||||
public ValidationResult(IssueSeverity severity, String message, TerminologyServiceErrorClass errorClass, List<OperationOutcomeIssueComponent> issues) {
|
||||
this.severity = severity;
|
||||
this.messages.add(message);
|
||||
if (message != null) {
|
||||
this.messages.add(message);
|
||||
}
|
||||
this.errorClass = errorClass;
|
||||
if (issues != null) {
|
||||
this.issues.addAll(issues);
|
||||
|
@ -145,12 +162,16 @@ public class ValidationResult {
|
|||
|
||||
public ValidationResult setMessage(String message) {
|
||||
this.messages.clear();
|
||||
this.messages.add(message);
|
||||
if (message != null) {
|
||||
this.messages.add(message);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public ValidationResult addMessage(String message) {
|
||||
this.messages.add(message);
|
||||
if (message != null) {
|
||||
this.messages.add(message);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -263,4 +284,22 @@ public class ValidationResult {
|
|||
return this;
|
||||
}
|
||||
|
||||
public boolean messageIsInIssues() {
|
||||
// the message is sometimes a summary of the issues that are already tracked.
|
||||
// this returns true in that case, so that duplication of messages is suppressed
|
||||
|
||||
for (String s : messages) {
|
||||
boolean found = false;
|
||||
for (OperationOutcomeIssueComponent iss : issues) {
|
||||
if (iss.getSeverity().ordinal() <= getSeverity().ordinal() && s.equals(iss.getDetails().getText())) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
|
@ -49,4 +49,12 @@ public class ValidationProcessInfo {
|
|||
Collections.sort(msgs);
|
||||
return CommaSeparatedStringBuilder.join("; ", msgs);
|
||||
}
|
||||
public List<String> summaryList() {
|
||||
List<String> msgs = new ArrayList<>();
|
||||
for (OperationOutcomeIssueComponent issue : issues) {
|
||||
msgs.add(issue.getDetails().getText());
|
||||
}
|
||||
Collections.sort(msgs);
|
||||
return msgs;
|
||||
}
|
||||
}
|
|
@ -301,7 +301,7 @@ public class ValueSetValidator extends ValueSetProcessBase {
|
|||
String disp = lookupDisplay(foundCoding);
|
||||
ConceptDefinitionComponent cd = new ConceptDefinitionComponent(foundCoding.getCode());
|
||||
cd.setDisplay(disp);
|
||||
return new ValidationResult(IssueSeverity.WARNING, info.summary(), foundCoding.getSystem(), getVersion(foundCoding), cd, disp, info.getIssues()).addCodeableConcept(vcc);
|
||||
return new ValidationResult(IssueSeverity.WARNING, info.summaryList(), foundCoding.getSystem(), getVersion(foundCoding), cd, disp, info.getIssues()).addCodeableConcept(vcc);
|
||||
} else {
|
||||
ConceptDefinitionComponent cd = new ConceptDefinitionComponent(foundCoding.getCode());
|
||||
cd.setDisplay(lookupDisplay(foundCoding));
|
||||
|
|
|
@ -1442,7 +1442,9 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
txHint(errors, "2023-07-03", vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, vr.getMessage());
|
||||
} else {
|
||||
checkDisp = false;
|
||||
txWarning(errors, NO_RULE_DATE, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, vr.getMessage());
|
||||
if (!vr.messageIsInIssues()) {
|
||||
txWarning(errors, NO_RULE_DATE, vr.getTxLink(), IssueType.CODEINVALID, element.line(), element.col(), path, false, vr.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (binding.getStrength() == BindingStrength.EXTENSIBLE) {
|
||||
|
|
Loading…
Reference in New Issue