use of org.apache.ws.commons.schema.XmlSchemaLengthFacet in project cxf by apache.
the class WSDLToCorbaHelper method processSimpleRestrictionType.
private CorbaType processSimpleRestrictionType(XmlSchemaSimpleType stype, QName name, QName schematypeName, boolean anonymous) throws Exception {
CorbaType corbaTypeImpl = null;
// checks if enumeration
XmlSchemaSimpleTypeRestriction restrictionType = (XmlSchemaSimpleTypeRestriction) stype.getContent();
QName baseName = checkPrefix(restrictionType.getBaseTypeName());
String maxLength = null;
String length = null;
for (XmlSchemaFacet val : restrictionType.getFacets()) {
if (val instanceof XmlSchemaMaxLengthFacet) {
maxLength = val.getValue().toString();
}
if (val instanceof XmlSchemaLengthFacet) {
length = val.getValue().toString();
}
}
if (isEnumeration(restrictionType)) {
corbaTypeImpl = createCorbaEnum(restrictionType, name, schematypeName);
} else {
if (restrictionType.getBaseType() != null) {
corbaTypeImpl = convertSchemaToCorbaType(restrictionType.getBaseType(), schematypeName, stype, null, false);
} else {
corbaTypeImpl = processPrimitiveType(baseName);
if (corbaTypeImpl == null) {
XmlSchemaType schematype = findSchemaType(baseName);
corbaTypeImpl = convertSchemaToCorbaType(schematype, schematypeName, schematype, null, false);
}
}
if (corbaTypeImpl != null) {
if (corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_STRING) || (baseName.equals(W3CConstants.NT_SCHEMA_STRING))) {
corbaTypeImpl = WSDLTypes.processStringType(corbaTypeImpl, name, maxLength, length);
} else if (corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_DECIMAL) || (baseName.equals(W3CConstants.NT_SCHEMA_DECIMAL))) {
corbaTypeImpl = WSDLTypes.processDecimalType(restrictionType, name, corbaTypeImpl, anonymous);
} else if ((corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_BASE64)) || (baseName.equals(W3CConstants.NT_SCHEMA_BASE64)) || (corbaTypeImpl.getType().equals(W3CConstants.NT_SCHEMA_HBIN))) {
corbaTypeImpl = WSDLTypes.processBase64Type(corbaTypeImpl, name, maxLength, length);
}
}
}
return corbaTypeImpl;
}
Aggregations