Search in sources :

Example 6 with XmlSchemaComplexType

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

the class AllTypeDialog method createDialogArea.

@Override
protected Control createDialogArea(Composite parent) {
    Composite createDialogArea = (Composite) super.createDialogArea(parent);
    createDialogArea.setLayout(new FillLayout());
    SashForm baseCom = new SashForm(createDialogArea, SWT.VERTICAL | SWT.BORDER);
    baseCom.setLayout(new GridLayout(1, true));
    Group group1 = new Group(baseCom, SWT.None);
    group1.setText(Messages.getString("AllTypeDialog.Group1Text"));
    group1.setLayoutData(new GridData(GridData.FILL_BOTH));
    group1.setLayout(new FillLayout());
    Font font = new Font(Display.getCurrent(), "Arial", 43, 3);
    group1.setFont(font);
    font.dispose();
    Group group2 = new Group(baseCom, SWT.None);
    group2.setText(Messages.getString("AllTypeDialog.Group2Text"));
    group2.setLayoutData(new GridData(GridData.FILL_BOTH));
    font = new Font(Display.getCurrent(), "Arial", 43, 3);
    group2.setFont(font);
    group2.setLayout(new FillLayout());
    font.dispose();
    list = new List(group1, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
    list.setItems(allXMLSchemaTypeName);
    treeViewer = new TreeViewer(group2, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
    tree = treeViewer.getTree();
    tree.setHeaderVisible(false);
    tree.setLinesVisible(true);
    treeViewer.setContentProvider(new WebServiceTreeContentProvider());
    treeViewer.setLabelProvider(new AllTypeLabelProvider());
    treeViewer.setInput(null);
    treeViewer.refresh();
    list.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            String selection = list.getSelection()[0];
            if (selection.contains(COMPLEXTYPE)) {
                String[] split = selection.split(":");
                String complexTypeName = split[1];
                for (XmlSchemaType xmlSchemaType : allXmlSchemaType) {
                    if (xmlSchemaType.getName().equals(complexTypeName)) {
                        ParameterInfo parameterRoot = new ParameterInfo();
                        parameterRoot.setName("parameters");
                        ParameterInfo parameterSon = new ParameterInfo();
                        parameterSon.setName(complexTypeName);
                        parameterSon.setParent(parameterRoot);
                        parameterRoot.getParameterInfos().add(parameterSon);
                        XmlSchemaComplexType xmlElementComplexType = (XmlSchemaComplexType) xmlSchemaType;
                        XmlSchemaParticle xmlSchemaParticle = xmlElementComplexType.getParticle();
                        if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                            XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                            XmlSchemaObjectCollection childCollection = xmlSchemaGroupBase.getItems();
                            if (childCollection != null) {
                                buildParameterFromCollection(childCollection, parameterSon);
                            }
                        }
                        treeViewer.setInput(parameterRoot);
                        treeViewer.refresh();
                        selectedParaInfo = parameterSon;
                    }
                }
            } else {
                treeViewer.setInput(null);
                treeViewer.refresh();
                selectedParaInfo = null;
            }
        }
    });
    return baseCom;
}
Also used : Group(org.eclipse.swt.widgets.Group) Composite(org.eclipse.swt.widgets.Composite) TreeViewer(org.eclipse.jface.viewers.TreeViewer) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) FillLayout(org.eclipse.swt.layout.FillLayout) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaGroupBase(org.apache.ws.commons.schema.XmlSchemaGroupBase) Font(org.eclipse.swt.graphics.Font) SashForm(org.eclipse.swt.custom.SashForm) GridLayout(org.eclipse.swt.layout.GridLayout) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) List(org.eclipse.swt.widgets.List) ArrayList(java.util.ArrayList) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) WebServiceTreeContentProvider(org.talend.designer.webservice.ui.tree.WebServiceTreeContentProvider) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection)

Example 7 with XmlSchemaComplexType

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

the class UnionVisitor method visitDeclaredUnion.

public void visitDeclaredUnion(AST identifierNode) {
    Scope unionScope = new Scope(getScope(), identifierNode);
    AST discriminatorNode = identifierNode.getNextSibling();
    AST caseNode = discriminatorNode.getNextSibling();
    // xmlschema:union
    XmlSchemaComplexType unionSchemaComplexType = new XmlSchemaComplexType(schema, true);
    unionSchemaComplexType.setName(mapper.mapToQName(unionScope));
    // REVISIT
    // TEMPORARILY
    // using TypesVisitor to visit <const_type>
    // it should be visited by a SwitchTypeSpecVisitor
    TypesVisitor visitor = new TypesVisitor(getScope(), definition, schema, wsdlVisitor, null);
    visitor.visit(discriminatorNode);
    CorbaType ctype = visitor.getCorbaType();
    Scope fullyQualifiedName = visitor.getFullyQualifiedName();
    XmlSchemaChoice choice = new XmlSchemaChoice();
    choice.setMinOccurs(1);
    choice.setMaxOccurs(1);
    unionSchemaComplexType.setParticle(choice);
    // corba:union
    Union corbaUnion = new Union();
    corbaUnion.setQName(new QName(typeMap.getTargetNamespace(), unionScope.toString()));
    corbaUnion.setRepositoryID(unionScope.toIDLRepositoryID());
    corbaUnion.setType(unionSchemaComplexType.getQName());
    if (ctype != null) {
        corbaUnion.setDiscriminator(ctype.getQName());
    } else {
        // Discriminator type is forward declared.
        UnionDeferredAction unionDiscriminatorAction = new UnionDeferredAction(corbaUnion);
        wsdlVisitor.getDeferredActions().add(fullyQualifiedName, unionDiscriminatorAction);
    }
    boolean recursiveAdd = addRecursiveScopedName(identifierNode);
    processCaseNodes(caseNode, unionScope, choice, corbaUnion);
    if (recursiveAdd) {
        removeRecursiveScopedName(identifierNode);
    }
    // add corbaType
    typeMap.getStructOrExceptionOrUnion().add(corbaUnion);
    // REVISIT: are these assignments needed?
    setSchemaType(unionSchemaComplexType);
    setCorbaType(corbaUnion);
    // Need to check if the union was forward declared
    processForwardUnionActions(unionScope);
    // Once we've finished declaring the union, we should make sure it has been removed from
    // the list of scopedNames so that we indicate that is no longer simply forward declared.
    scopedNames.remove(unionScope);
}
Also used : AST(antlr.collections.AST) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) QName(javax.xml.namespace.QName) XmlSchemaChoice(org.apache.ws.commons.schema.XmlSchemaChoice) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) Union(org.apache.cxf.binding.corba.wsdl.Union)

Example 8 with XmlSchemaComplexType

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

the class WSDLParameter method processWrappedOutputParams.

private void processWrappedOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs, List<ParamType> outputs) throws Exception {
    Output output = operation.getOutput();
    if (output != null) {
        Message msg = output.getMessage();
        Part part = (Part) msg.getOrderedParts(null).iterator().next();
        XmlSchemaComplexType schemaType = null;
        XmlSchemaElement el = getElement(part, xmlSchemaList);
        if (el == null) {
            return;
        }
        if (el.getSchemaType() != null) {
            schemaType = (XmlSchemaComplexType) el.getSchemaType();
        }
        XmlSchemaSequence seq = (XmlSchemaSequence) schemaType.getParticle();
        if (seq != null) {
            for (XmlSchemaSequenceMember seqMember : seq.getItems()) {
                if (seqMember instanceof XmlSchemaElement) {
                    el = (XmlSchemaElement) seqMember;
                    processWrappedOutputParam(wsdlToCorbaBinding, el, inputs, outputs);
                }
            }
        }
    }
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) Message(javax.wsdl.Message) Part(javax.wsdl.Part) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Output(javax.wsdl.Output) XmlSchemaSequenceMember(org.apache.ws.commons.schema.XmlSchemaSequenceMember) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Example 9 with XmlSchemaComplexType

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

the class DeclaratorVisitor method duplicateXmlSchemaComplexType.

private XmlSchemaComplexType duplicateXmlSchemaComplexType(Scope newScope) {
    XmlSchemaComplexType oldSchemaType = (XmlSchemaComplexType) getSchemaType();
    XmlSchemaComplexType newSchemaType = new XmlSchemaComplexType(schema, true);
    newSchemaType.setName(newScope.toString());
    newSchemaType.setParticle(oldSchemaType.getParticle());
    return newSchemaType;
}
Also used : XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Example 10 with XmlSchemaComplexType

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

the class SequenceVisitor method generateSchemaType.

private XmlSchemaType generateSchemaType(XmlSchemaType stype, Scope scopedName, long bound, Scope fullyQualifiedName) {
    XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
    ct.setName(mapper.mapToQName(scopedName));
    XmlSchemaSequence sequence = new XmlSchemaSequence();
    XmlSchemaElement el = new XmlSchemaElement(schema, false);
    el.setName(ELEMENT_NAME);
    el.setMinOccurs(0);
    if (bound != -1) {
        el.setMaxOccurs(bound);
    } else {
        el.setMaxOccurs(Long.MAX_VALUE);
    }
    if (stype != null) {
        el.setSchemaTypeName(stype.getQName());
        if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
            el.setNillable(true);
        }
    } else {
        SequenceDeferredAction elementAction = new SequenceDeferredAction(el);
        wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction);
    }
    sequence.getItems().add(el);
    ct.setParticle(sequence);
    return ct;
}
Also used : XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType)

Aggregations

XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)88 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)60 QName (javax.xml.namespace.QName)45 XmlSchemaSequence (org.apache.ws.commons.schema.XmlSchemaSequence)38 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)25 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)25 XmlSchema (org.apache.ws.commons.schema.XmlSchema)24 Test (org.junit.Test)18 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)13 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)12 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)12 XmlSchemaObjectCollection (org.apache.ws.commons.schema.XmlSchemaObjectCollection)11 XmlSchemaSequenceMember (org.apache.ws.commons.schema.XmlSchemaSequenceMember)11 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)10 FeatureMetacardType (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureMetacardType)8 ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)8 ArrayList (java.util.ArrayList)7 AbstractAegisTest (org.apache.cxf.aegis.AbstractAegisTest)7 XmlSchemaAttribute (org.apache.ws.commons.schema.XmlSchemaAttribute)7 XmlSchemaComplexContentRestriction (org.apache.ws.commons.schema.XmlSchemaComplexContentRestriction)6