From 2a2d9575e5bb4b0caee951405b5fd769fee95d07 Mon Sep 17 00:00:00 2001 From: patrick-werner Date: Tue, 25 Feb 2020 19:00:52 +0100 Subject: [PATCH] added messageArgument aware method --- .../java/org/hl7/fhir/validation/BaseValidator.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java index 6327a9e4f..68eb86af0 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/BaseValidator.java @@ -149,7 +149,7 @@ public class BaseValidator { } return thePass; } - + /** * Test a rule and add a {@link IssueSeverity#INFORMATION} validation message if the validation fails. And mark it as a slicing hint for later recovery if appropriate * @@ -279,6 +279,8 @@ public class BaseValidator { * Set this parameter to false if the validation does not pass * @return Returns thePass (in other words, returns true if the rule did not fail validation) */ + + //todo: delete this when finished i18n protected boolean rule(List errors, IssueType type, String path, boolean thePass, String msg) { if (!thePass) { addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.ERROR); @@ -286,6 +288,14 @@ public class BaseValidator { return thePass; } + protected boolean rule(List errors, IssueType type, String path, boolean thePass, String theMessage, Object... theMessageArguments) { + if (!thePass) { + String message = formatMessage(theMessage, theMessageArguments); + addValidationMessage(errors, type, -1, -1, path, message, IssueSeverity.ERROR); + } + return thePass; + } + public boolean rule(List errors, Source source, IssueType type, String path, boolean thePass, String msg) { if (!thePass) { addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.ERROR, source);