use of org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity in project org.hl7.fhir.core by hapifhir.
the class ParserBase method logError.
// FIXME: i18n should be done here
public void logError(int line, int col, String path, IssueType type, String message, IssueSeverity level) throws FHIRFormatError {
if (errors != null) {
if (policy == ValidationPolicy.EVERYTHING) {
ValidationMessage msg = new ValidationMessage(Source.InstanceValidator, type, line, col, path, message, level);
errors.add(msg);
} else if (level == IssueSeverity.FATAL || (level == IssueSeverity.ERROR && policy == ValidationPolicy.QUICK))
throw new FHIRFormatError(message + String.format(" at line %d col %d", line, col));
}
}
use of org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity in project org.hl7.fhir.core by hapifhir.
the class BaseValidator method warningOrError.
protected boolean warningOrError(boolean isError, List<ValidationMessage> errors, IssueType type, int line, int col, String path, boolean thePass, String msg, Object... theMessageArguments) {
if (!thePass) {
String nmsg = context.formatMessage(msg, theMessageArguments);
IssueSeverity lvl = isError ? IssueSeverity.ERROR : IssueSeverity.WARNING;
if (doingLevel(lvl)) {
addValidationMessage(errors, type, line, col, path, nmsg, lvl, msg);
}
}
return thePass;
}
use of org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity in project org.hl7.fhir.core by hapifhir.
the class BaseValidator method warning.
/**
* Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
*
* @param thePass
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
protected boolean warning(List<ValidationMessage> errors, IssueType type, int line, int col, String path, boolean thePass, String msg, Object... theMessageArguments) {
if (!thePass && doingWarnings()) {
String nmsg = context.formatMessage(msg, theMessageArguments);
IssueSeverity severity = IssueSeverity.WARNING;
addValidationMessage(errors, type, line, col, path, nmsg, severity, msg);
}
return thePass;
}
use of org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity in project org.hl7.fhir.core by hapifhir.
the class BaseValidator method warningOrHint.
/**
* Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
*
* @param thePass
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
protected boolean warningOrHint(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, boolean warning, String msg, Object... theMessageArguments) {
if (!thePass) {
String message = context.formatMessage(msg, theMessageArguments);
IssueSeverity lvl = warning ? IssueSeverity.WARNING : IssueSeverity.INFORMATION;
if (doingLevel(lvl)) {
addValidationMessage(errors, type, -1, -1, path, message, lvl, null);
}
}
return thePass;
}
use of org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity in project org.hl7.fhir.core by hapifhir.
the class BaseValidator method suppressedwarning.
/**
* Test a rule and add a {@link IssueSeverity#WARNING} validation message if the validation fails
*
* @param thePass
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
protected boolean suppressedwarning(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, String msg, String html) {
if (!thePass && doingWarnings()) {
IssueSeverity severity = IssueSeverity.INFORMATION;
addValidationMessage(errors, type, path, msg, html, severity, null);
}
return thePass;
}
Aggregations