Search in sources :

Example 1 with XmlSchemaLengthFacet

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;
}
Also used : XmlSchemaFacet(org.apache.ws.commons.schema.XmlSchemaFacet) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) XmlSchemaSimpleTypeRestriction(org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction) XmlSchemaLengthFacet(org.apache.ws.commons.schema.XmlSchemaLengthFacet) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaMaxLengthFacet(org.apache.ws.commons.schema.XmlSchemaMaxLengthFacet)

Aggregations

QName (javax.xml.namespace.QName)1 CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)1 XmlSchemaFacet (org.apache.ws.commons.schema.XmlSchemaFacet)1 XmlSchemaLengthFacet (org.apache.ws.commons.schema.XmlSchemaLengthFacet)1 XmlSchemaMaxLengthFacet (org.apache.ws.commons.schema.XmlSchemaMaxLengthFacet)1 XmlSchemaSimpleTypeRestriction (org.apache.ws.commons.schema.XmlSchemaSimpleTypeRestriction)1 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)1