extracted: bpCheck|warningOrError|suppressedwarning

This commit is contained in:
patrick-werner 2020-03-01 20:54:09 +01:00
parent 013dddf2b6
commit 02ff8c5ddf
5 changed files with 14 additions and 5 deletions

View File

@ -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);

View File

@ -5224,12 +5224,11 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
private void validateObservation(List<ValidationMessage> 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<Element> 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);
}
/*

View File

@ -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";
}

View File

@ -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

View File

@ -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