use of ca.uhn.hl7v2.validation.MessageValidator in project camel by apache.
the class ValidationContextPredicate method matches.
@Override
public boolean matches(Exchange exchange) {
try {
Message message = exchange.getIn().getBody(Message.class);
ValidationContext context = validatorExpression != null ? validatorExpression.evaluate(exchange, ValidationContext.class) : dynamicValidationContext(message, exchange.getIn().getHeader(HL7Constants.HL7_CONTEXT, HapiContext.class));
MessageValidator validator = new MessageValidator(context, false);
return validator.validate(message);
} catch (HL7Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
Aggregations