Search in sources :

Example 21 with ParameterInfo

use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.

the class AllTypeDialog method buildParameterFromCollection.

private void buildParameterFromCollection(XmlSchemaObjectCollection xmlSchemaObjectCollection, ParameterInfo parameter) {
    // XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) xmlSchemaParticle;
    // XmlSchemaObjectCollection xmlSchemaObjectCollection = xmlSchemaSequence.getItems();
    int count = xmlSchemaObjectCollection.getCount();
    for (int j = 0; j < count; j++) {
        XmlSchemaObject xmlSchemaObject = xmlSchemaObjectCollection.getItem(j);
        if (xmlSchemaObject instanceof XmlSchemaGroupBase) {
            XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaObject;
            XmlSchemaObjectCollection items = xmlSchemaGroupBase.getItems();
            if (items != null) {
                buildParameterFromCollection(items, parameter);
            }
        } else if (xmlSchemaObject instanceof XmlSchemaAny) {
            ParameterInfo parameterSon = new ParameterInfo();
            parameterSon.setName("_content_");
            parameterSon.setParent(parameter);
            parameter.getParameterInfos().add(parameterSon);
        } else if (xmlSchemaObject instanceof XmlSchemaElement) {
            XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) xmlSchemaObject;
            String elementName = xmlSchemaElement.getName();
            ParameterInfo parameterSon = new ParameterInfo();
            parameterSon.setName(elementName);
            parameterSon.setParent(parameter);
            Long min = xmlSchemaElement.getMinOccurs();
            Long max = xmlSchemaElement.getMaxOccurs();
            if (max - min > 1) {
                parameterSon.setArraySize(-1);
                parameterSon.setIndex("*");
            }
            parameter.getParameterInfos().add(parameterSon);
            if (xmlSchemaElement.getSchemaTypeName() != null) {
                String elementTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
                if (elementTypeName != null && elementTypeName.equals("anyType")) {
                    parameterSon.setName(xmlSchemaElement.getName() + ":anyType");
                }
                parameterSon.setType(elementTypeName);
                if (!WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
                    buileParameterFromTypes(elementTypeName, parameterSon);
                }
            } else if (xmlSchemaElement.getSchemaType() != null) {
                if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaComplexType) {
                    XmlSchemaComplexType xmlElementComplexType = (XmlSchemaComplexType) xmlSchemaElement.getSchemaType();
                    XmlSchemaParticle xmlSchemaParticle = xmlElementComplexType.getParticle();
                    if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
                        XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
                        XmlSchemaObjectCollection childCollection = xmlSchemaGroupBase.getItems();
                        if (childCollection != null) {
                            buildParameterFromCollection(childCollection, parameterSon);
                        }
                    } else if (xmlSchemaElement.getSchemaTypeName() != null) {
                        String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
                        if (paraTypeName != null) {
                            parameter.setType(paraTypeName);
                            buileParameterFromTypes(paraTypeName, parameterSon);
                        }
                    }
                } else if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaSimpleType) {
                    XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) xmlSchemaElement.getSchemaType();
                    String typeName = xmlSchemaSimpleType.getName();
                    if (typeName != null && typeName.equals("anyType")) {
                        ParameterInfo pSon = new ParameterInfo();
                        pSon.setName(xmlSchemaElement.getName() + "(anyType)");
                        pSon.setParent(parameter);
                        parameter.getParameterInfos().add(pSon);
                    }
                    parameter.setType(typeName);
                }
            } else if (xmlSchemaElement.getRefName() != null) {
                String elementTypeName = xmlSchemaElement.getRefName().getLocalPart();
                if (!WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
                    buildParameterFromElements(elementTypeName, parameterSon);
                }
            }
        } else if (xmlSchemaObject instanceof XmlSchemaAttribute) {
            XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute) xmlSchemaObject;
            String elementName = xmlSchemaAttribute.getName();
            ParameterInfo parameterSon = new ParameterInfo();
            parameterSon.setName(elementName);
            parameterSon.setParent(parameter);
            parameter.getParameterInfos().add(parameterSon);
            if (xmlSchemaAttribute.getSchemaTypeName() != null) {
                String elementTypeName = xmlSchemaAttribute.getSchemaTypeName().getLocalPart();
                parameterSon.setType(elementTypeName);
                if (!WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
                    buileParameterFromTypes(elementTypeName, parameterSon);
                }
            } else if (xmlSchemaAttribute.getRefName() != null) {
                String refName = xmlSchemaAttribute.getRefName().getLocalPart();
                parameterSon.setType(refName);
            }
        }
    }
}
Also used : XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) XmlSchemaAny(org.apache.ws.commons.schema.XmlSchemaAny) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo) XmlSchemaGroupBase(org.apache.ws.commons.schema.XmlSchemaGroupBase) XmlSchemaAttribute(org.apache.ws.commons.schema.XmlSchemaAttribute) XmlSchemaObject(org.apache.ws.commons.schema.XmlSchemaObject) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection)

Example 22 with ParameterInfo

use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.

the class ParameterInfoUtil method getAllChildren.

public List<ParameterInfo> getAllChildren(ParameterInfo para) {
    List<ParameterInfo> list = new ArrayList<ParameterInfo>();
    List<ParameterInfo> childList = para.getParameterInfos();
    list.addAll(childList);
    for (ParameterInfo paraC : childList) {
        if (paraC.getParameterInfos().size() > 0) {
            list.addAll(getAllChildren(paraC));
        }
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)

Example 23 with ParameterInfo

use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.

the class ParameterInfoUtil method getParentName.

public String getParentName(ParameterInfo para, int multi) {
    List<ParameterInfo> paraList = getAllParameterInfo(para);
    StringBuffer buffer = new StringBuffer();
    for (int i = paraList.size() - 1; i >= 0; i--) {
        ParameterInfo parentPara = paraList.get(i);
        if (parentPara == null) {
            continue;
        }
        buffer.append(parentPara.getName());
        for (int m = 0; m < currenIndexList.size(); m++) {
            if (currenIndexList.get(m).getParameterName().equals(parentPara.getName())) {
                buffer.append("[" + currenIndexList.get(m).getIndexNum() + "]");
            }
        }
        if (i != 0) {
            buffer.append(".");
        }
    }
    return buffer.toString();
}
Also used : ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)

Example 24 with ParameterInfo

use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.

the class ParameterInfoUtil method getAllChildren.

public static List<ParameterInfo> getAllChildren(ParameterInfo para, String arrayFullName) {
    List<ParameterInfo> list = new ArrayList<ParameterInfo>();
    List<ParameterInfo> childList = para.getParameterInfos();
    for (ParameterInfo paraC : childList) {
        if (arrayFullName != null) {
            arrayFullName = arrayFullName + "." + paraC.getName() + paraC.getIndex() == null ? "" : ("[" + paraC.getIndex() + "]");
        }
    }
    list.addAll(childList);
    for (ParameterInfo paraC : childList) {
        if (paraC.getParameterInfos().size() > 0) {
            list.addAll(getAllChildren(paraC, arrayFullName));
        }
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)

Example 25 with ParameterInfo

use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.

the class ParameterInfoUtil method getAllParameterInfo.

public List<ParameterInfo> getAllParameterInfo(ParameterInfo para) {
    ParameterInfo parentPara = para.getParent();
    List<ParameterInfo> list = new ArrayList<ParameterInfo>();
    if (parentPara != null) {
        list.add(para);
        List<ParameterInfo> pali = getAllParameterInfo(parentPara);
        list.addAll(pali);
    } else {
        list.add(para);
    }
    return list;
}
Also used : ArrayList(java.util.ArrayList) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)

Aggregations

ParameterInfo (org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo)26 ArrayList (java.util.ArrayList)12 List (java.util.List)8 XmlSchemaComplexType (org.apache.ws.commons.schema.XmlSchemaComplexType)8 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)6 XmlSchemaGroupBase (org.apache.ws.commons.schema.XmlSchemaGroupBase)6 XmlSchemaObjectCollection (org.apache.ws.commons.schema.XmlSchemaObjectCollection)6 XmlSchemaParticle (org.apache.ws.commons.schema.XmlSchemaParticle)6 XmlSchemaSimpleType (org.apache.ws.commons.schema.XmlSchemaSimpleType)6 Iterator (java.util.Iterator)5 XmlSchemaObject (org.apache.ws.commons.schema.XmlSchemaObject)4 XmlSchemaAny (org.apache.ws.commons.schema.XmlSchemaAny)3 XmlSchemaAttribute (org.apache.ws.commons.schema.XmlSchemaAttribute)3 XmlSchemaType (org.apache.ws.commons.schema.XmlSchemaType)3 ParameterInfoUtil (org.talend.designer.webservice.ui.ParameterInfoUtil)3 XmlSchemaComplexContentExtension (org.apache.ws.commons.schema.XmlSchemaComplexContentExtension)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TreeViewer (org.eclipse.jface.viewers.TreeViewer)2 SashForm (org.eclipse.swt.custom.SashForm)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2