use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project tomee by apache.
the class ServiceUtils method getSchemaValidationTypeFromModel.
private static SchemaValidationType getSchemaValidationTypeFromModel(Message message) {
Exchange exchange = message.getExchange();
SchemaValidationType validationType = null;
if (exchange != null) {
BindingOperationInfo boi = exchange.getBindingOperationInfo();
if (boi != null) {
OperationInfo opInfo = boi.getOperationInfo();
if (opInfo != null) {
validationType = getSchemaValidationTypeFromModel(opInfo);
}
}
if (validationType == null) {
Endpoint endpoint = exchange.getEndpoint();
if (endpoint != null) {
EndpointInfo ep = endpoint.getEndpointInfo();
if (ep != null) {
validationType = getSchemaValidationTypeFromModel(ep);
}
}
}
}
return validationType;
}
use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project cxf by apache.
the class ServiceUtils method isSchemaValidationEnabled.
/**
* A short cut method to be able to test for if Schema Validation should be enabled
* for IN or OUT without having to check BOTH and IN or OUT.
*
* @param message
* @param type
*/
public static boolean isSchemaValidationEnabled(SchemaValidationType type, Message message) {
SchemaValidationType validationType = getSchemaValidationType(message);
boolean isRequestor = MessageUtils.isRequestor(message);
if (SchemaValidationType.REQUEST.equals(validationType)) {
if (isRequestor) {
validationType = SchemaValidationType.OUT;
} else {
validationType = SchemaValidationType.IN;
}
} else if (SchemaValidationType.RESPONSE.equals(validationType)) {
if (isRequestor) {
validationType = SchemaValidationType.IN;
} else {
validationType = SchemaValidationType.OUT;
}
}
return validationType.equals(type) || ((SchemaValidationType.IN.equals(type) || SchemaValidationType.OUT.equals(type)) && SchemaValidationType.BOTH.equals(validationType));
}
use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project cxf by apache.
the class ServiceUtils method getSchemaValidationTypeFromModel.
private static SchemaValidationType getSchemaValidationTypeFromModel(Message message) {
Exchange exchange = message.getExchange();
SchemaValidationType validationType = null;
if (exchange != null) {
BindingOperationInfo boi = exchange.getBindingOperationInfo();
if (boi != null) {
OperationInfo opInfo = boi.getOperationInfo();
if (opInfo != null) {
validationType = getSchemaValidationTypeFromModel(opInfo);
}
}
if (validationType == null) {
Endpoint endpoint = exchange.getEndpoint();
if (endpoint != null) {
EndpointInfo ep = endpoint.getEndpointInfo();
if (ep != null) {
validationType = getSchemaValidationTypeFromModel(ep);
}
}
}
}
return validationType;
}
use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project cxf by apache.
the class AbstractOutDatabindingInterceptor method setOperationSchemaValidation.
protected void setOperationSchemaValidation(Message message) {
SchemaValidationType validationType = ServiceUtils.getSchemaValidationType(message);
message.put(Message.SCHEMA_VALIDATION_ENABLED, validationType);
}
use of org.apache.cxf.annotations.SchemaValidation.SchemaValidationType in project cxf by apache.
the class AbstractInDatabindingInterceptor method setOperationSchemaValidation.
protected void setOperationSchemaValidation(Message message) {
SchemaValidationType validationType = ServiceUtils.getSchemaValidationType(message);
message.put(Message.SCHEMA_VALIDATION_ENABLED, validationType);
}
Aggregations