Search in sources :

Example 11 with ParameterInfo

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

the class WSDLDiscoveryHelper method getFunctionsAvailable.

/**
     * DOC gcui Comment method "getFunctionsAvailable".
     * 
     * @param wsdlURI
     * @return
     */
public List<Function> getFunctionsAvailable(String wsdlURI, ServiceHelperConfiguration config) {
    functionsAvailable = new ArrayList();
    wsdlURI = TalendTextUtils.removeQuotes(wsdlURI);
    try {
        ComponentBuilder builder = new ComponentBuilder();
        ServiceInfo serviceInfo = new ServiceInfo();
        serviceInfo.setWsdlUri(wsdlURI);
        serviceInfo.setAuthConfig(config);
        serviceInfo = builder.buildserviceinformation(serviceInfo);
        if (serviceInfo != null) {
            Iterator iter = serviceInfo.getOperations();
            while (iter.hasNext()) {
                OperationInfo oper = (OperationInfo) iter.next();
                // operationName
                Function f = new Function(oper.getTargetMethodName());
                String operationName = oper.getTargetMethodName() + "(";
                if (serviceInfo.getServerName() != null) {
                    f.setServerName(serviceInfo.getServerName());
                }
                if (serviceInfo.getServerNameSpace() != null) {
                    f.setServerNameSpace(serviceInfo.getServerNameSpace());
                }
                if (serviceInfo.getPortNames() != null) {
                    f.setPortNames(serviceInfo.getPortNames());
                }
                if (oper.getSoapActionURI() != null) {
                    f.setSoapAction(oper.getSoapActionURI());
                }
                if (oper.getNamespaceURI() != null) {
                    f.setNameSpaceURI(oper.getNamespaceURI());
                }
                if (oper.getEncodingStyle() != null) {
                    f.setEncodingStyle(oper.getEncodingStyle());
                }
                if (oper.getTargetURL() != null) {
                    f.setAddressLocation(oper.getTargetURL());
                }
                List inps = oper.getInparameters();
                List outps = oper.getOutparameters();
                // input parameters
                inputParameters = new ArrayList();
                if (inps.size() == 0) {
                    inputParameters.add(new ParameterInfo());
                    operationName = operationName + "):";
                } else if (inps.size() > 0 && inps != null) {
                    for (Iterator iterator1 = inps.iterator(); iterator1.hasNext(); ) {
                        ParameterInfo element = (ParameterInfo) iterator1.next();
                        getParaFullName(element);
                        // ParameterInfo p = new ParameterInfo();
                        // p.setType(element.getKind());
                        inputParameters.add(element);
                        if (element.getType() != null) {
                            operationName = operationName + element.getType() + ",";
                        } else if (element.getType() == null && element.getName() != null) {
                            operationName = operationName + element.getName() + ",";
                        } else if (element.getType() == null) {
                            operationName = operationName + "noType" + ",";
                        }
                        if (element.getType() == null && (element.getParameterInfos() == null || element.getParameterInfos().isEmpty()) && inps.size() == 1) {
                            element.setName(element.getName());
                        }
                    }
                    int operationNamelen = operationName.length();
                    operationName = operationName.substring(0, operationNamelen - 1) + "):";
                    f.setInputParameters(inputParameters);
                }
                // output parameters
                outputParameters = new ArrayList();
                if (outps.size() == 0) {
                    outputParameters.add(new ParameterInfo());
                } else {
                    for (Iterator iterator2 = outps.iterator(); iterator2.hasNext(); ) {
                        ParameterInfo element = (ParameterInfo) iterator2.next();
                        getParaFullName(element);
                        // ParameterInfo p = new ParameterInfo();
                        // p.setType(element.getKind());
                        outputParameters.add(element);
                        if (element.getType() != null) {
                            operationName = operationName + element.getType() + ",";
                        } else if (element.getParameterInfos() != null && !element.getParameterInfos().isEmpty()) {
                            for (Object element2 : element.getParameterInfos()) {
                                ParameterInfo elementBranch = (ParameterInfo) element2;
                                if (elementBranch.getType() != null) {
                                    operationName = operationName + elementBranch.getType() + ",";
                                } else {
                                    operationName = operationName + "noType" + ",";
                                }
                            }
                        }
                    }
                    int operationNamelen = operationName.length();
                    operationName = operationName.substring(0, operationNamelen - 1);
                    f.setOutputParameters(outputParameters);
                }
                f.setName(operationName);
                functionsAvailable.add(f);
            }
        }
    } catch (Exception e) {
        MessageBoxExceptionHandler.process(e);
    }
    return functionsAvailable;
}
Also used : ServiceInfo(org.talend.designer.webservice.ws.wsdlinfo.ServiceInfo) OperationInfo(org.talend.designer.webservice.ws.wsdlinfo.OperationInfo) Function(org.talend.designer.webservice.ws.wsdlinfo.Function) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) List(java.util.List) ArrayList(java.util.ArrayList) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo) ComponentBuilder(org.talend.designer.webservice.ws.wsdlutil.ComponentBuilder)

Example 12 with ParameterInfo

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

the class ComponentBuilder method buildParameterFromElements.

private void buildParameterFromElements(String partElement, ParameterInfo parameterRoot, int ioOrRecursion) {
    // XmlSchemaObjectTable elements = xmlSchema.getElements();
    if (ioOrRecursion < 3) {
        parametersName.clear();
        parametersName.add(parameterRoot.getName());
    } else if (ioOrRecursion == 3) {
        parametersName.add(parameterRoot.getName());
    }
    Iterator elementsItr = allXmlSchemaElement.iterator();
    if (partElement != null) {
        while (elementsItr.hasNext()) {
            XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) elementsItr.next();
            if (partElement.equals(xmlSchemaElement.getName())) {
                // parameter.setName(partName);
                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 xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
                            if (xmlSchemaObjectCollection != null) {
                                buildParameterFromCollection(xmlSchemaObjectCollection, parameterRoot, ioOrRecursion);
                            }
                        } else if (xmlSchemaElement.getSchemaTypeName() != null) {
                            String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
                            String paraTypeNamespace = xmlSchemaElement.getSchemaTypeName().getNamespaceURI();
                            if (paraTypeName != null) {
                                parameterRoot.setType(paraTypeName);
                                buileParameterFromTypes(paraTypeNamespace, paraTypeName, parameterRoot, ioOrRecursion);
                            }
                        }
                    } else if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaSimpleType) {
                        XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) xmlSchemaElement.getSchemaType();
                        String typeName = xmlSchemaSimpleType.getName();
                        if (typeName != null && typeName.equals("anyType")) {
                            ParameterInfo parameterSon = new ParameterInfo();
                            parameterSon.setName("anyType");
                            parameterSon.setParent(parameterRoot);
                            parameterRoot.getParameterInfos().add(parameterSon);
                        }
                        parameterRoot.setType(typeName);
                    }
                } else if (xmlSchemaElement.getSchemaTypeName() != null) {
                    String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
                    String paraTypeNamespace = xmlSchemaElement.getSchemaTypeName().getNamespaceURI();
                    if (paraTypeName != null) {
                        parameterRoot.setType(paraTypeName);
                        buileParameterFromTypes(paraTypeNamespace, paraTypeName, parameterRoot, ioOrRecursion);
                    }
                }
            }
        }
    }
}
Also used : XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) Iterator(java.util.Iterator) XmlSchemaComplexType(org.apache.ws.commons.schema.XmlSchemaComplexType) XmlSchemaParticle(org.apache.ws.commons.schema.XmlSchemaParticle) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo) XmlSchemaGroupBase(org.apache.ws.commons.schema.XmlSchemaGroupBase) XmlSchemaObjectCollection(org.apache.ws.commons.schema.XmlSchemaObjectCollection)

Example 13 with ParameterInfo

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

the class WebServiceDialog method saveValue.

private void saveValue() {
    List<InputMappingData> inputList = webServiceUI.getInputParams();
    List<OutPutMappingData> outputList = webServiceUI.getOutputParams();
    String currentURL = webServiceUI.getURL();
    List<PortNames> allPortNames = webServiceUI.getAllPortNames();
    Function function = webServiceUI.getCurrentFunction();
    PortNames currePortName = webServiceUI.getCurrentPortName();
    List<OutPutMappingData> outEleList = webServiceUI.getOutputElement();
    Set<String> insourceList = webServiceUI.getInSourceList();
    Set<String> outsourceList = webServiceUI.getOutSourceList();
    IMetadataTable inputMetaCopy = webServiceUI.getInputMetaCopy();
    IMetadataTable outputMetaCopy = webServiceUI.getOutputMetaCopy();
    IMetadataTable inputMetadata = webServiceUI.getInputMetadata();
    IMetadataTable outputMetadata = webServiceUI.getOutputMetadata();
    List<IMetadataColumn> inputmetadata = webServiceUI.getInputValue();
    WebServiceComponent wenCom = webServiceComponentMain.getWebServiceComponent();
    IMetadataTable wenMetadata = wenCom.getMetadataFromConnector("OUTPUT");
    if (wenMetadata != null && outputMetadata != wenMetadata) {
        outputMetadata = wenMetadata;
    }
    // save schema.
    if (outputMetaCopy != null) {
        if (!outputMetaCopy.sameMetadataAs(outputMetadata, IMetadataColumn.OPTIONS_NONE)) {
            outputMetadata.getListColumns().clear();
            outputMetadata.getListColumns().addAll(outputMetaCopy.getListColumns());
        }
    }
    if (!"".equals(currentURL) && currentURL != null) {
        IElementParameter ENDPOINTPara = wenCom.getElementParameter("ENDPOINT");
        ENDPOINTPara.setValue(currentURL);
    }
    if (currePortName != null) {
        IElementParameter Port_Name = wenCom.getElementParameter("PORT_NAME");
        Port_Name.setValue(currePortName.getPortName());
    } else if (currePortName == null && !allPortNames.isEmpty()) {
        currePortName = allPortNames.get(0);
        IElementParameter Port_Name = wenCom.getElementParameter("PORT_NAME");
        Port_Name.setValue(currePortName.getPortName());
    }
    if (function != null) {
        if (function.getName() != null) {
            IElementParameter METHODPara = wenCom.getElementParameter("METHOD");
            METHODPara.setValue(function.getName());
        }
        if (function.getServerNameSpace() != null) {
            IElementParameter Service_NS = wenCom.getElementParameter("SERVICE_NS");
            Service_NS.setValue(function.getServerNameSpace());
        }
        if (function.getServerName() != null) {
            IElementParameter Service_Name = wenCom.getElementParameter("SERVICE_NAME");
            Service_Name.setValue(function.getServerName());
        }
        if (function.getServerNameSpace() != null) {
            IElementParameter Port_NS = wenCom.getElementParameter("PORT_NS");
            Port_NS.setValue(function.getServerNameSpace());
        }
    // IElementParameter ADDRESSLocation = wenCom.getElementParameter("ADDRESS_LOCATION");
    // ADDRESSLocation.setValue(function.getAddressLocation());
    }
    // save input
    IElementParameter INPUT_PARAMSPara = wenCom.getElementParameter("INPUT_PARAMS");
    List<Map<String, String>> inputparaValue = (List<Map<String, String>>) INPUT_PARAMSPara.getValue();
    if (inputparaValue == null) {
        inputparaValue = new ArrayList<Map<String, String>>();
    } else {
        inputparaValue.clear();
    }
    for (InputMappingData inputData : inputList) {
        Map<String, String> inputMap = new HashMap<String, String>(2);
        if (inputData.getInputColumnValue() != null) {
            inputMap.put("EXPRESSION", inputData.getInputColumnValue());
        }
        if (inputData.getParameterName() != null) {
            String name = inputData.getParameterName();
            if (!name.equals("")) {
                inputMap.put("ELEMENT", name);
            }
        } else if (inputData.getParameterName() == null && inputData.getParameter() != null) {
            if (inputData.getParameter().getParent() != null) {
                String name = new ParameterInfoUtil().getParentName(inputData.getParameter());
                inputMap.put("ELEMENT", name);
            } else {
                inputMap.put("ELEMENT", inputData.getParameter().getName());
            }
        // inputMap.put("ELEMENT", inputData.getInputElementValue());
        // inputMap.put("NAMESPACE", inputData.getParameter().getNameSpace());
        // inputMap.put("TYPE", inputData.getParameter().getKind());
        }
        inputparaValue.add(inputMap);
    }
    for (IMetadataColumn column : inputmetadata) {
        Map<String, String> columnMap = new HashMap<String, String>(1);
        if (column.getLabel() != null) {
            columnMap.put("COLUMN", column.getLabel());
            inputparaValue.add(columnMap);
        }
    }
    for (String insource : insourceList) {
        if (insource == null || "".equals(insource)) {
            continue;
        }
        Map<String, String> sourceMap = new HashMap<String, String>(1);
        sourceMap.put("SOURCE", insource);
        inputparaValue.add(sourceMap);
    }
    List<ParameterInfo> listParamter = new ArrayList();
    if (function != null) {
        List inputParameter = function.getInputParameters();
        if (inputParameter != null) {
            // for (int i = 0; i < inputParameter.size(); i++) {
            boolean mark = true;
            goin: for (Iterator iterator2 = inputParameter.iterator(); iterator2.hasNext(); ) {
                ParameterInfo element = (ParameterInfo) iterator2.next();
                Map<String, String> sourceMap = new HashMap<String, String>(2);
                sourceMap.put("PARAMETERINFO", element.getName());
                if (element.getParent() == null) {
                    sourceMap.put("PARAPARENT", "");
                } else {
                    sourceMap.put("PARAPARENT", element.getParent().getName());
                }
                inputparaValue.add(sourceMap);
                mark = false;
                if (!element.getParameterInfos().isEmpty()) {
                    listParamter.addAll(new ParameterInfoUtil().getAllChildren(element));
                }
                break goin;
            }
            if (!mark) {
                for (ParameterInfo para : listParamter) {
                    Map<String, String> sourceMap = new HashMap<String, String>(2);
                    sourceMap.put("PARAMETERINFO", para.getName());
                    sourceMap.put("PARAPARENT", para.getParent().getName());
                    sourceMap.put("PARAMETERARRAYSIZE", String.valueOf(para.getArraySize()));
                    sourceMap.put("PARAMETERINDEX", para.getIndex());
                    inputparaValue.add(sourceMap);
                }
            }
        // }
        }
    }
    // save output
    IElementParameter OUTPUT_PARAMSPara = wenCom.getElementParameter("OUTPUT_PARAMS");
    List<Map<String, String>> outputMap = (List<Map<String, String>>) OUTPUT_PARAMSPara.getValue();
    if (outputMap == null) {
        outputMap = new ArrayList<Map<String, String>>();
    } else {
        outputMap.clear();
    }
    for (OutPutMappingData outData : outEleList) {
        ParameterInfo para = outData.getParameter();
        if (para.getName() == null || "".equals(para.getName())) {
            continue;
        }
        Map<String, String> eleMap = new HashMap<String, String>(3);
        if (outData.getParameterName() != null) {
            eleMap.put("ELEMENT", outData.getParameterName());
        } else {
            eleMap.put("ELEMENT", para.getName());
        }
        // eleMap.put("NAMESPACE", para.getNameSpace());
        // eleMap.put("TYPE", para.getKind());
        outputMap.add(eleMap);
    }
    for (OutPutMappingData data : outputList) {
        Map<String, String> dataMap = new HashMap<String, String>(2);
        if (data.getParameterName() != null) {
            dataMap.put("EXPRESSION", data.getParameterName());
        } else if (data.getParameterName() == null) {
        // warningDialog("Please Select a Output Item.");
        // return;
        }
        if (data.getMetadataColumn() != null) {
            dataMap.put("COLUMN", data.getMetadataColumn().getLabel());
        }
        // else if (data.getMetadataColumn() == null) {
        // warningDialog("Please Select a Output Item.");
        // return;
        // }
        // Map<String, String> dataMap2 = new HashMap<String, String>(2);
        // if (data.getParameterList().size() > 0) {
        // for (ParameterInfo para : data.getParameterList()) {
        // dataMap2.put("", para.getNameSpace());
        // dataMap2.put("", para.getKind());
        // }
        // }
        //
        // if (data.getOutputColumnValue() != null) {
        // dataMap.put(data.getParameterName(), data.getOutputColumnValue());
        // }
        outputMap.add(dataMap);
    // outputMap.add(dataMap2);
    }
    for (String outsource : outsourceList) {
        if (outsource == null || "".equals(outsource)) {
            continue;
        }
        Map<String, String> sourceMap = new HashMap<String, String>(1);
        sourceMap.put("SOURCE", outsource);
        outputMap.add(sourceMap);
    }
    List<ParameterInfo> ls = new ArrayList();
    if (function != null) {
        List inputParameter = function.getOutputParameters();
        if (inputParameter != null) {
            // for (int i = 0; i < inputParameter.size(); i++) {
            boolean mark = true;
            goin: for (Iterator iterator2 = inputParameter.iterator(); iterator2.hasNext(); ) {
                ParameterInfo element = (ParameterInfo) iterator2.next();
                Map<String, String> sourceMap = new HashMap<String, String>(1);
                sourceMap.put("PARAMETERINFO", element.getName());
                if (element.getParent() == null) {
                    sourceMap.put("PARAPARENT", "");
                } else {
                    sourceMap.put("PARAPARENT", element.getParent().getName());
                }
                outputMap.add(sourceMap);
                mark = false;
                if (!element.getParameterInfos().isEmpty()) {
                    ls.addAll(new ParameterInfoUtil().getAllChildren(element));
                }
                break goin;
            }
            if (!mark) {
                for (ParameterInfo para : ls) {
                    Map<String, String> sourceMap = new HashMap<String, String>(2);
                    sourceMap.put("PARAMETERINFO", para.getName());
                    sourceMap.put("PARAPARENT", para.getParent().getName());
                    sourceMap.put("PARAMETERARRAYSIZE", String.valueOf(para.getArraySize()));
                    sourceMap.put("PARAMETERINDEX", para.getIndex());
                    outputMap.add(sourceMap);
                }
            }
        // }
        }
    }
    super.okPressed();
}
Also used : InputMappingData(org.talend.designer.webservice.data.InputMappingData) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) PortNames(org.talend.designer.webservice.ws.wsdlinfo.PortNames) Function(org.talend.designer.webservice.ws.wsdlinfo.Function) WebServiceComponent(org.talend.designer.webservice.WebServiceComponent) Iterator(java.util.Iterator) IElementParameter(org.talend.core.model.process.IElementParameter) ArrayList(java.util.ArrayList) List(java.util.List) OutPutMappingData(org.talend.designer.webservice.data.OutPutMappingData) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) ParameterInfo(org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) ParameterInfoUtil(org.talend.designer.webservice.ui.ParameterInfoUtil) HashMap(java.util.HashMap) Map(java.util.Map)

Example 14 with ParameterInfo

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

the class ComponentBuilder method buildParameterFromCollection2.

private void buildParameterFromCollection2(XmlSchemaObjectCollection xmlSchemaObjectCollection, ParameterInfo parameter, int ioOrRecursion) {
    // 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, ioOrRecursion);
            }
        } 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);
            Boolean isHave = false;
            if (!parametersName.isEmpty() && parameterSon.getName() != null) {
                for (int p = 0; p < parametersName.size(); p++) {
                    if (parameterSon.getName().equals(parametersName.get(p))) {
                        isHave = true;
                    }
                }
            }
            // }
            if (xmlSchemaElement.getSchemaTypeName() != null) {
                String elementTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
                parameterSon.setType(elementTypeName);
                if (!isHave && !WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
                    buileParameterFromTypes2(elementTypeName, parameterSon, ioOrRecursion);
                }
            } 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 && !isHave) {
                            buildParameterFromCollection(childCollection, parameterSon, ioOrRecursion);
                        }
                    } else if (xmlSchemaElement.getSchemaTypeName() != null) {
                        String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
                        String paraTypeNamespace = xmlSchemaElement.getSchemaTypeName().getNamespaceURI();
                        if (paraTypeName != null && !isHave) {
                            parameter.setType(paraTypeName);
                            buileParameterFromTypes(paraTypeNamespace, paraTypeName, parameterSon, ioOrRecursion);
                        }
                    }
                } else if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaSimpleType) {
                    XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) xmlSchemaElement.getSchemaType();
                    String typeName = xmlSchemaSimpleType.getName();
                    parameter.setType(typeName);
                }
            } else if (xmlSchemaElement.getRefName() != null) {
                String elementTypeName = xmlSchemaElement.getRefName().getLocalPart();
                if (!isHave && !WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
                    buildParameterFromElements(elementTypeName, parameterSon, ioOrRecursion);
                }
            }
        } 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);
            Boolean isHave = false;
            if (!parametersName.isEmpty() && parameterSon.getName() != null) {
                for (int p = 0; p < parametersName.size(); p++) {
                    if (parameterSon.getName().equals(parametersName.get(p))) {
                        isHave = true;
                    }
                }
            }
            if (xmlSchemaAttribute.getSchemaTypeName() != null) {
                String elementTypeName = xmlSchemaAttribute.getSchemaTypeName().getLocalPart();
                String elementTypeNamespace = xmlSchemaAttribute.getSchemaTypeName().getNamespaceURI();
                parameterSon.setType(elementTypeName);
                if (!isHave && !WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
                    buileParameterFromTypes(elementTypeNamespace, elementTypeName, parameterSon, ioOrRecursion);
                }
            } else if (xmlSchemaAttribute.getRefName() != null) {
                String refName = xmlSchemaAttribute.getRefName().getLocalPart();
                parameterSon.setType(refName);
                if (!isHave) {
                    buildParameterFromElements(refName, parameterSon, ioOrRecursion);
                }
            }
        }
    }
}
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 15 with ParameterInfo

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

the class AddArrayIndexForParentsDialog method createParentsArrayIndexItem.

/**
     * DOC gcui Comment method "createParentsArrayIndexItem".
     */
private List<ArrayIndexList> createParentsArrayIndexItem(ParameterInfo itemPara) {
    List<ParameterInfo> allArray = getAllArrayFromParents(itemPara, null);
    for (int i = 0; i < allArray.size(); i++) {
        String name = allArray.get(i).getName();
        ArrayIndexList indexItem = new ArrayIndexList(name);
        arrayIndexList.add(indexItem);
    }
    return arrayIndexList;
}
Also used : ArrayIndexList(org.talend.designer.webservice.data.ArrayIndexList) 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