use of org.talend.esb.policy.schemavalidate.SchemaValidationPolicy.MessageType in project tesb-rt-se by Talend.
the class SchemaValidationPolicyAbstractInterceptor method handleMessageWithoutAssertionInfo.
protected void handleMessageWithoutAssertionInfo(Message message) throws Fault {
ValidationType vldType = policy.getValidationType();
AppliesToType appliesToType = policy.getApplyToType();
MessageType msgType = policy.getMessageType();
String customSchemaPath = policy.getCustomSchemaPath();
if (shouldSchemaValidate(message, msgType, appliesToType)) {
if (vldType == ValidationType.CustomSchema) {
// load custom schema from external source
try {
loadCustomSchema(message, customSchemaPath, this.getClass());
} catch (IOException ex) {
throw new RuntimeException("Can not load custom schema", ex);
}
}
// do schema validation by setting value to
// "schema-validation-enabled" property
validateBySettingProperty(message);
}
}
use of org.talend.esb.policy.schemavalidate.SchemaValidationPolicy.MessageType in project tesb-rt-se by Talend.
the class SchemaValidationPolicyAbstractInterceptor method handleMessageWithAssertionInfo.
protected void handleMessageWithAssertionInfo(Message message) throws Fault {
AssertionInfoMap aim = message.get(AssertionInfoMap.class);
if (null == aim) {
return;
}
Collection<AssertionInfo> ais = aim.get(SchemaValidationPolicyBuilder.SCHEMA_VALIDATION);
if (null == ais) {
return;
}
for (AssertionInfo ai : ais) {
if (ai.getAssertion() instanceof SchemaValidationPolicy) {
SchemaValidationPolicy vPolicy = (SchemaValidationPolicy) ai.getAssertion();
ValidationType vldType = vPolicy.getValidationType();
AppliesToType appliesToType = vPolicy.getApplyToType();
MessageType msgType = vPolicy.getMessageType();
String customSchemaPath = vPolicy.getCustomSchemaPath();
if (vldType != ValidationType.WSDLSchema) {
ai.setAsserted(true);
}
if (shouldSchemaValidate(message, msgType, appliesToType)) {
if (vldType == ValidationType.CustomSchema) {
// load custom schema from external source
try {
loadCustomSchema(message, customSchemaPath, this.getClass());
} catch (IOException ex) {
throw new RuntimeException("Can not load custom schema", ex);
}
}
// do schema validation by setting value to
// "schema-validation-enabled" property
validateBySettingProperty(message);
}
ai.setAsserted(true);
}
ai.setAsserted(true);
}
}
Aggregations