Search in sources :

Example 1 with XmlSchemaComplexContentRestriction

use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project tdi-studio-se by Talend.

the class ComponentBuilder method buileParameterFromTypes2.

private void buileParameterFromTypes2(String paraType, ParameterInfo parameter, int ioOrRecursion) {
    if (ioOrRecursion < 3) {
        parametersName.clear();
        parametersName.add(parameter.getName());
    } else if (ioOrRecursion == 3) {
        parametersName.add(parameter.getName());
    }
    for (int i = 0; i < allXmlSchemaType.size(); i++) {
        XmlSchemaType type = allXmlSchemaType.get(i);
        String typeName = type.getName();
        if (paraType.equals(typeName)) {
            if (type instanceof XmlSchemaComplexType) {
                XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
                XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
                XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
                if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
                    Object obj = xmlSchemaComplexType.getContentModel().getContent();
                    if (obj instanceof XmlSchemaComplexContentExtension) {
                        XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
                        if (xscce != null) {
                            xmlSchemaParticle = xscce.getParticle();
                        }
                        if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                            XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                            xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                        }
                    } else if (obj instanceof XmlSchemaComplexContentRestriction) {
                        XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
                        xmlSchemaObjectCollection = xsccr.getAttributes();
                    }
                } else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                    XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                    xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                }
                if (xmlSchemaObjectCollection != null) {
                    buildParameterFromCollection2(xmlSchemaObjectCollection, parameter, 3);
                }
            } else if (type instanceof XmlSchemaSimpleType) {
            // Will TO DO if need.
            // System.out.println("XmlSchemaSimpleType");
            }
            break;
        }
    }
}
Also used : XmlSchemaComplexContentExtension(org.apache.ws.commons.schema.XmlSchemaComplexContentExtension) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaComplexContentRestriction(org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaGroupBase(org.apache.ws.commons.schema.XmlSchemaGroupBase) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection)

Example 2 with XmlSchemaComplexContentRestriction

use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project tdi-studio-se by Talend.

the class ComponentBuilder method buileParameterFromTypes.

/**
     * DOC gcui Comment method "buileParameterFromTypes".
     * 
     * @param paraType
     * @param parameter
     * @param operationInfo
     * @param i
     */
private void buileParameterFromTypes(String paraNamespace, String paraType, ParameterInfo parameter, int ioOrRecursion) {
    if (ioOrRecursion < 3) {
        parametersName.clear();
        parametersName.add(parameter.getName());
    } else if (ioOrRecursion == 3) {
        parametersName.add(parameter.getName());
    }
    for (int i = 0; i < allXmlSchemaType.size(); i++) {
        XmlSchemaType type = allXmlSchemaType.get(i);
        String typeName = type.getName();
        if (paraType.equals(typeName) && paraNamespace.equals(type.getQName().getNamespaceURI())) {
            if (type instanceof XmlSchemaComplexType) {
                XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
                XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
                XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
                if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
                    Object obj = xmlSchemaComplexType.getContentModel().getContent();
                    if (obj instanceof XmlSchemaComplexContentExtension) {
                        XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
                        if (xscce.getBaseTypeName() != null) {
                            buileParameterFromTypes(xscce.getBaseTypeName().getNamespaceURI(), xscce.getBaseTypeName().getLocalPart(), parameter, ioOrRecursion);
                        }
                        if (xscce != null) {
                            xmlSchemaParticle = xscce.getParticle();
                        }
                        if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                            XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                            xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                        }
                    } else if (obj instanceof XmlSchemaComplexContentRestriction) {
                        XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
                        xmlSchemaObjectCollection = xsccr.getAttributes();
                    }
                } else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                    XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                    xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                }
                if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() > 0) {
                    buildParameterFromCollection(xmlSchemaObjectCollection, parameter, 3);
                } else if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() == 0 && xmlSchemaComplexType.isAbstract()) {
                    findExtendtion(xmlSchemaComplexType, parameter, 3);
                }
            } else if (type instanceof XmlSchemaSimpleType) {
            // Will TO DO if need.
            // System.out.println("XmlSchemaSimpleType");
            }
            break;
        }
    }
}
Also used : XmlSchemaComplexContentExtension(org.apache.ws.commons.schema.XmlSchemaComplexContentExtension) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaComplexContentRestriction(org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaGroupBase(org.apache.ws.commons.schema.XmlSchemaGroupBase) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection)

Example 3 with XmlSchemaComplexContentRestriction

use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project cxf by apache.

the class ImportRepairTest method createDerivedType2.

private void createDerivedType2(XmlSchema importingSchema) {
    XmlSchemaComplexContent complexContent;
    XmlSchemaComplexType derivedType2 = new XmlSchemaComplexType(importingSchema, true);
    derivedType2.setName("derivedRestriction");
    XmlSchemaComplexContentRestriction restriction = new XmlSchemaComplexContentRestriction();
    restriction.setBaseTypeName(new QName(BASE_TYPE_SCHEMA2, "baseType2"));
    complexContent = new XmlSchemaComplexContent();
    complexContent.setContent(restriction);
    derivedType2.setContentModel(complexContent);
}
Also used : QName(javax.xml.namespace.QName) XmlSchemaComplexContentRestriction(org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaComplexContent(org.apache.ws.commons.schema.XmlSchemaComplexContent)

Example 4 with XmlSchemaComplexContentRestriction

use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project tdi-studio-se by Talend.

the class AllTypeDialog method buileParameterFromTypes.

private void buileParameterFromTypes(String paraType, ParameterInfo parameter) {
    for (int i = 0; i < allXmlSchemaType.size(); i++) {
        XmlSchemaType type = allXmlSchemaType.get(i);
        String typeName = type.getName();
        if (paraType.equals(typeName)) {
            if (type instanceof XmlSchemaComplexType) {
                XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
                XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
                XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
                if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
                    Object obj = xmlSchemaComplexType.getContentModel().getContent();
                    if (obj instanceof XmlSchemaComplexContentExtension) {
                        XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
                        if (xscce.getBaseTypeName() != null) {
                            buileParameterFromTypes(xscce.getBaseTypeName().getLocalPart(), parameter);
                        }
                        if (xscce != null) {
                            xmlSchemaParticle = xscce.getParticle();
                        }
                        if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                            XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                            xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                        }
                    } else if (obj instanceof XmlSchemaComplexContentRestriction) {
                        XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
                        xmlSchemaObjectCollection = xsccr.getAttributes();
                    }
                } else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                    XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                    xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                }
                if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() > 0) {
                    buildParameterFromCollection(xmlSchemaObjectCollection, parameter);
                }
            } else if (type instanceof XmlSchemaSimpleType) {
            }
            break;
        }
    }
}
Also used : XmlSchemaComplexContentExtension(org.apache.ws.commons.schema.XmlSchemaComplexContentExtension) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaComplexContentRestriction(org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaGroupBase(org.apache.ws.commons.schema.XmlSchemaGroupBase) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection)

Example 5 with XmlSchemaComplexContentRestriction

use of org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction in project hale by halestudio.

the class XmlSchemaReader method createProperties.

/**
 * Create the properties for the given complex type
 *
 * @param typeDef the definition of the declaring type
 * @param item the complex type item
 * @param schemaLocation the schema location
 * @param schemaNamespace the scheme namspace
 */
private void createProperties(XmlTypeDefinition typeDef, XmlSchemaComplexType item, String schemaLocation, String schemaNamespace) {
    // item:
    // <complexType ...>
    XmlSchemaContentModel model = item.getContentModel();
    if (model != null) {
        XmlSchemaContent content = model.getContent();
        if (content instanceof XmlSchemaComplexContentExtension) {
            // <complexContent>
            // <extension base="...">
            XmlSchemaComplexContentExtension extension = (XmlSchemaComplexContentExtension) content;
            // particle (e.g. sequence)
            if (extension.getParticle() != null) {
                XmlSchemaParticle particle = extension.getParticle();
                createPropertiesFromParticle(typeDef, particle, schemaLocation, schemaNamespace, false);
            }
            // attributes
            XmlSchemaObjectCollection attributeCollection = extension.getAttributes();
            if (attributeCollection != null) {
                createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
            }
            // complex content may have a value in certain cases
            // (if it is mixed it definitely has, which will override this
            // setting)
            typeDef.setConstraintIfNotSet(new ComplexContentHasValue(typeDef));
        // </extension>
        // </complexContent>
        } else if (content instanceof XmlSchemaComplexContentRestriction) {
            // <complexContent>
            // <restriction base="...">
            XmlSchemaComplexContentRestriction restriction = (XmlSchemaComplexContentRestriction) content;
            // particle (e.g. sequence)
            if (restriction.getParticle() != null) {
                XmlSchemaParticle particle = restriction.getParticle();
                createPropertiesFromParticle(typeDef, particle, schemaLocation, schemaNamespace, false);
            }
            // attributes
            XmlSchemaObjectCollection attributeCollection = restriction.getAttributes();
            if (attributeCollection != null) {
                createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
            }
            // complex content does not have a value
            // (only if it is mixed, which can override this setting)
            typeDef.setConstraintIfNotSet(HasValueFlag.DISABLED);
        // </restriction>
        // </complexContent>
        } else if (content instanceof XmlSchemaSimpleContentExtension) {
            // <simpleContent>
            // <extension base="...">
            XmlSchemaSimpleContentExtension extension = (XmlSchemaSimpleContentExtension) content;
            // attributes
            XmlSchemaObjectCollection attributeCollection = extension.getAttributes();
            if (attributeCollection != null) {
                createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
            }
        // </extension>
        // </simpleContent>
        } else if (content instanceof XmlSchemaSimpleContentRestriction) {
            // <simpleContent>
            // <restriction base="...">
            XmlSchemaSimpleContentRestriction restriction = (XmlSchemaSimpleContentRestriction) content;
            // attributes
            XmlSchemaObjectCollection attributeCollection = restriction.getAttributes();
            if (attributeCollection != null) {
                createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
            }
        // </restriction>
        // </simpleContent>
        }
    } else {
        // no complex content (instead e.g. <sequence>)
        XmlSchemaComplexType complexType = item;
        // particle (e.g. sequence)
        if (item.getParticle() != null) {
            XmlSchemaParticle particle = complexType.getParticle();
            createPropertiesFromParticle(typeDef, particle, schemaLocation, schemaNamespace, false);
        }
        // attributes
        XmlSchemaObjectCollection attributeCollection = complexType.getAttributes();
        if (attributeCollection != null) {
            createAttributesFromCollection(attributeCollection, typeDef, null, schemaLocation, schemaNamespace);
        }
    }
// </complexType>
}
Also used : XmlSchemaComplexContentExtension(org.apache.ws.commons.schema.XmlSchemaComplexContentExtension) XmlSchemaSimpleContentExtension(org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension) XmlSchemaContent(org.apache.ws.commons.schema.XmlSchemaContent) XmlSchemaComplexContentRestriction(org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction) XmlSchemaContentModel(org.apache.ws.commons.schema.XmlSchemaContentModel) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) ComplexContentHasValue(eu.esdihumboldt.hale.io.xsd.model.ComplexContentHasValue) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection) XmlSchemaSimpleContentRestriction(org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction)

Aggregations

XmlSchemaComplexContentRestriction (org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction)12 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)9 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)7 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)6 XmlSchemaContent (org.apache.ws.commons.schema.XmlSchemaContent)6 QName (javax.xml.namespace.QName)5 XmlSchemaObjectCollection (org.apache.ws.commons.schema.XmlSchemaObjectCollection)5 XmlSchemaSimpleContentExtension (org.apache.ws.commons.schema.XmlSchemaSimpleContentExtension)5 XmlSchemaSimpleContentRestriction (org.apache.ws.commons.schema.XmlSchemaSimpleContentRestriction)5 XmlSchemaContentModel (org.apache.ws.commons.schema.XmlSchemaContentModel)4 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)4 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)4 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)3 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)3 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)3 XmlSchemaAll (org.apache.ws.commons.schema.XmlSchemaAll)2 XmlSchemaChoice (org.apache.ws.commons.schema.XmlSchemaChoice)2 IOMessageImpl (eu.esdihumboldt.hale.common.core.io.report.impl.IOMessageImpl)1 DefaultPropertyDefinition (eu.esdihumboldt.hale.common.schema.model.impl.DefaultPropertyDefinition)1 ComplexContentHasValue (eu.esdihumboldt.hale.io.xsd.model.ComplexContentHasValue)1