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 cac38fb49..cc8576f70 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 @@ -146,7 +146,7 @@ public class BaseValidator { } - private String formatMessage(String theMessage, Object... theMessageArguments) { + protected String formatMessage(String theMessage, Object... theMessageArguments) { String message; if (theMessageArguments != null && theMessageArguments.length > 0) { message = MessageFormat.format(messages.getString(theMessage), theMessageArguments); diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java index 05290ed97..76cb6f88e 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/instance/InstanceValidator.java @@ -5224,12 +5224,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat private void validateObservation(List errors, Element element, NodeStack stack) { // all observations should have a subject, a performer, and a time - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("subject") != null, "All observations should have a subject"); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("subject") != null, I18nConstants.ALL_OBSERVATIONS_SHOULD_HAVE_A_SUBJECT); List performers = new ArrayList<>(); element.getNamedChildren("performer", performers); - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), performers.size() > 0, "All observations should have a performer"); - bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null, - "All observations should have an effectiveDateTime or an effectivePeriod"); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), performers.size() > 0, I18nConstants.ALL_OBSERVATIONS_SHOULD_HAVE_A_PERFORMER); + bpCheck(errors, IssueType.INVALID, element.line(), element.col(), stack.getLiteralPath(), element.getNamedChild("effectiveDateTime") != null || element.getNamedChild("effectivePeriod") != null, I18nConstants.ALL_OBSERVATIONS_SHOULD_HAVE_AN_EFFECTIVEDATETIME_OR_AN_EFFECTIVEPERIOD); } /* diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/utils/I18nConstants.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/utils/I18nConstants.java index 0cbc9ded6..add24e6e8 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/utils/I18nConstants.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/utils/I18nConstants.java @@ -226,4 +226,8 @@ public class I18nConstants { public final static String TERMINOLOGY_PASSTHROUGH_TX_MESSAGE = "Terminology_PassThrough_TX_Message"; public final static String FIXED_TYPE_CHECKS_DT_ADDRESS_LINE = "Fixed_Type_Checks_DT_Address_Line"; public final static String MUSTSUPPORT_VAL_MUSTSUPPORT = "MustSupport_VAL_MustSupport"; + public final static String ALL_OBSERVATIONS_SHOULD_HAVE_AN_EFFECTIVEDATETIME_OR_AN_EFFECTIVEPERIOD = "All_observations_should_have_an_effectiveDateTime_or_an_effectivePeriod"; + public final static String ALL_OBSERVATIONS_SHOULD_HAVE_A_PERFORMER = "All_observations_should_have_a_performer"; + public final static String ALL_OBSERVATIONS_SHOULD_HAVE_A_SUBJECT = "All_observations_should_have_a_subject"; + } diff --git a/org.hl7.fhir.validation/src/main/resources/Messages.properties b/org.hl7.fhir.validation/src/main/resources/Messages.properties index a8999d262..a5f5f2e3d 100644 --- a/org.hl7.fhir.validation/src/main/resources/Messages.properties +++ b/org.hl7.fhir.validation/src/main/resources/Messages.properties @@ -224,3 +224,6 @@ Terminology_TX_System_Unknown = Unknown Code System '{0}' Terminology_PassThrough_TX_Message = {0} for '{1}#{2}' Fixed_Type_Checks_DT_Address_Line = Expected {0} but found {1} line elements MustSupport_VAL_MustSupport = The element {0} is not marked as 'mustSupport' in the profile {1}. Consider not using the element, or marking the element as must-Support in the profile +All_observations_should_have_an_effectiveDateTime_or_an_effectivePeriod = All observations should have an effectiveDateTime or an effectivePeriod +All_observations_should_have_a_performer = All observations should have a performer +All_observations_should_have_a_subject = All observations should have a subject diff --git a/org.hl7.fhir.validation/src/main/resources/Messages_de_DE.properties b/org.hl7.fhir.validation/src/main/resources/Messages_de_DE.properties index a8999d262..a5f5f2e3d 100644 --- a/org.hl7.fhir.validation/src/main/resources/Messages_de_DE.properties +++ b/org.hl7.fhir.validation/src/main/resources/Messages_de_DE.properties @@ -224,3 +224,6 @@ Terminology_TX_System_Unknown = Unknown Code System '{0}' Terminology_PassThrough_TX_Message = {0} for '{1}#{2}' Fixed_Type_Checks_DT_Address_Line = Expected {0} but found {1} line elements MustSupport_VAL_MustSupport = The element {0} is not marked as 'mustSupport' in the profile {1}. Consider not using the element, or marking the element as must-Support in the profile +All_observations_should_have_an_effectiveDateTime_or_an_effectivePeriod = All observations should have an effectiveDateTime or an effectivePeriod +All_observations_should_have_a_performer = All observations should have a performer +All_observations_should_have_a_subject = All observations should have a subject