Search in sources :

Example 1 with WebServiceComponent

use of org.talend.designer.webservice.WebServiceComponent in project tdi-studio-se by Talend.

the class RepositoryWebService method getLastFunction.

private void getLastFunction() {
    //$NON-NLS-1$
    IElementParameter METHODPara = connector.getElementParameter("METHOD");
    Object obj = METHODPara.getValue();
    if (obj == null) {
        return;
    }
    if (obj instanceof String) {
        String str = (String) obj;
        //$NON-NLS-1$
        String wsdlUrl = (String) connector.getElementParameter("ENDPOINT").getValue();
        //$NON-NLS-1$
        String currentURL = (String) connector.getElementParameter("PORT_NAME").getValue();
        WSDLDiscoveryHelper ws = new WSDLDiscoveryHelper();
        List<Function> funList = new ArrayList<Function>();
        WebServiceComponent webServiceComponent = connector;
        boolean isUseProxy = webServiceComponent.getElementParameter("USE_PROXY").getValue().toString().equals("true");
        boolean isUseAuth = webServiceComponent.getElementParameter("NEED_AUTH").getValue().toString().equals("true");
        boolean isUseNTLM = webServiceComponent.getElementParameter("USE_NTLM").getValue().toString().equals("true");
        boolean isUseSSL = webServiceComponent.getElementParameter("NEED_SSL_TO_TRUSTSERVER").getValue().toString().equals("true");
        if (isUseProxy) {
            useProxy();
        }
        if (isUseAuth && !isUseNTLM) {
            useAuth();
        }
        if (isUseSSL) {
            useSSL();
        }
        if (serverConfig != null) {
            if (wsdlUrl != null && !wsdlUrl.contains("\"")) {
                funList = ws.getFunctionsAvailable(parseContextParameter(wsdlUrl), serverConfig);
            } else {
                funList = ws.getFunctionsAvailable(wsdlUrl, serverConfig);
            }
        } else {
            if (wsdlUrl != null && !wsdlUrl.contains("\"")) {
                funList = ws.getFunctionsAvailable(parseContextParameter(wsdlUrl));
            } else {
                funList = ws.getFunctionsAvailable(wsdlUrl);
            }
        }
        PortNames retrivePortName = new PortNames();
        retrivePortName.setPortName(currentURL);
        allPortNames.clear();
        allPortNames.add(retrivePortName);
        for (Function fun : funList) {
            if (fun.getName().equals(str)) {
                allfunList.clear();
                allfunList.add(fun);
                if (fun != null) {
                    currentFunction = fun;
                }
                return;
            }
        }
    }
}
Also used : Function(org.talend.designer.webservice.ws.wsdlinfo.Function) PortNames(org.talend.designer.webservice.ws.wsdlinfo.PortNames) WSDLDiscoveryHelper(org.talend.designer.webservice.ws.WSDLDiscoveryHelper) WebServiceComponent(org.talend.designer.webservice.WebServiceComponent) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter)

Example 2 with WebServiceComponent

use of org.talend.designer.webservice.WebServiceComponent in project tdi-studio-se by Talend.

the class RepositoryWebService method getDataFromNet.

private void getDataFromNet() {
    List<Function> funList = new ArrayList<Function>();
    List<PortNames> portNameList = new ArrayList<PortNames>();
    URLValue = wsdlField.getText();
    if (URLValue == null) {
        //$NON-NLS-1$
        URLValue = "";
    }
    final WSDLDiscoveryHelper ws = new WSDLDiscoveryHelper();
    WebServiceComponent webServiceComponent = connector;
    boolean isUseProxy = webServiceComponent.getElementParameter("USE_PROXY").getValue().toString().equals("true");
    boolean isUseNTLM = webServiceComponent.getElementParameter("USE_NTLM").getValue().toString().equals("true");
    boolean isUseAuth = webServiceComponent.getElementParameter("NEED_AUTH").getValue().toString().equals("true");
    if (isUseProxy) {
        useProxy();
    }
    if (isUseAuth && !isUseNTLM) {
        useAuth();
    }
    boolean isUseSSL = webServiceComponent.getElementParameter("NEED_SSL_TO_TRUSTSERVER").getValue().toString().equals("true");
    if (isUseSSL) {
        useSSL();
    }
    if (serverConfig != null) {
        if (URLValue != null && !URLValue.contains("\"")) {
            funList = ws.getFunctionsAvailable(parseContextParameter(URLValue), serverConfig);
        } else {
            funList = ws.getFunctionsAvailable(URLValue, serverConfig);
        }
    } else {
        if (URLValue != null && !URLValue.contains("\"")) {
            funList = ws.getFunctionsAvailable(parseContextParameter(URLValue));
        } else {
            funList = ws.getFunctionsAvailable(URLValue);
        }
    }
    if (!funList.isEmpty()) {
        if (funList.get(0) != null) {
            if (funList.get(0).getPortNames() != null) {
                portNameList = funList.get(0).getPortNames();
            }
        }
    }
    ExtendedTableModel<Function> listModel = listTableView.getExtendedTableModel();
    ExtendedTableModel<PortNames> portListModel = portListTableView.getExtendedTableModel();
    listModel.removeAll();
    listModel.addAll(funList);
    portListModel.removeAll();
    portListModel.addAll(portNameList);
    connection.setPortName(portNameList.get(0).getPortName());
}
Also used : Function(org.talend.designer.webservice.ws.wsdlinfo.Function) PortNames(org.talend.designer.webservice.ws.wsdlinfo.PortNames) WSDLDiscoveryHelper(org.talend.designer.webservice.ws.WSDLDiscoveryHelper) WebServiceComponent(org.talend.designer.webservice.WebServiceComponent) ArrayList(java.util.ArrayList)

Example 3 with WebServiceComponent

use of org.talend.designer.webservice.WebServiceComponent in project tdi-studio-se by Talend.

the class WebServiceHelper method getWebServiceUI.

@Override
public AbstractWebService getWebServiceUI(Composite uiParent, ConnectionItem connectionItem, INode node) {
    if (node != null) {
        IExternalNode enode = node.getExternalNode();
        if (enode instanceof WebServiceComponent) {
            WebServiceComponentMain b = new WebServiceComponentMain((WebServiceComponent) enode);
            enode.setComponent(b.getWebServiceComponent().getComponent());
            webServiceUI = new WebServiceUI(uiParent, b, connectionItem);
            webServiceUI.init();
            manager.addWebServiceSaveListener(this);
            return webServiceUI;
        }
    }
    return getWebServiceUI(uiParent, connectionItem);
}
Also used : WebServiceComponent(org.talend.designer.webservice.WebServiceComponent) WebServiceComponentMain(org.talend.designer.webservice.WebServiceComponentMain) IExternalNode(org.talend.core.model.process.IExternalNode)

Example 4 with WebServiceComponent

use of org.talend.designer.webservice.WebServiceComponent in project tdi-studio-se by Talend.

the class WebServiceHelper method getWebServiceUI.

/*
     * (non-Javadoc)
     * 
     * @see
     * org.talend.repository.ui.wizards.metadata.connection.wsdl.IWebService#getWebServiceUI(org.eclipse.swt.widgets
     * .Composite, org.talend.core.model.components.IComponent)
     */
@Override
public AbstractWebService getWebServiceUI(Composite uiParent, ConnectionItem connectionItem) {
    // TODO Auto-generated method stub
    WebServiceComponent wenCom = new WebServiceComponent();
    wenCom.initialize();
    IComponent iComponent = ComponentsFactoryProvider.getInstance().get("tWebService", ComponentCategory.CATEGORY_4_DI.getName());
    List<? extends IElementParameter> parameters = iComponent.createElementParameters(wenCom);
    wenCom.setElementParameters(parameters);
    if (connectionItem.getState() != null) {
        WSDLSchemaConnection connection = (WSDLSchemaConnection) connectionItem.getConnection();
        wenCom.getElementParameter("ENDPOINT").setValue(connection.getEndpointURI());
        String currentURL = connection.getWSDL();
        String method = connection.getMethodName();
        String currePortName = connection.getPortName();
        String nameSpace = connection.getServerNameSpace();
        String serverName = connection.getServerName();
        String portNameSpace = connection.getPortNameSpace();
        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);
        }
        //
        if (method != null) {
            IElementParameter METHODPara = wenCom.getElementParameter("METHOD");
            METHODPara.setValue(method);
        }
        if (nameSpace != null) {
            IElementParameter Service_NS = wenCom.getElementParameter("SERVICE_NS");
            Service_NS.setValue(nameSpace);
        }
        if (serverName != null) {
            IElementParameter Service_Name = wenCom.getElementParameter("SERVICE_NAME");
            Service_Name.setValue(serverName);
        }
        if (portNameSpace != null) {
            IElementParameter Port_NS = wenCom.getElementParameter("PORT_NS");
            Port_NS.setValue(portNameSpace);
        }
        if (connection.getParameterValue() != null) {
            IElementParameter INPUT_PARAMSPara = wenCom.getElementParameter("INPUT_PARAMS");
            List<Map<String, String>> inputparaValue = (List<Map<String, String>>) INPUT_PARAMSPara.getValue();
            EList inputList = connection.getParameterValue();
            for (int i = 0; i < inputList.size(); i++) {
                Map<String, String> inputMap = new HashMap<String, String>(2);
                WSDLParameter parameter = (WSDLParameter) inputList.get(i);
                if (parameter.getElement() != null) {
                    if (parameter.getExpression() != null) {
                        inputMap.put("EXPRESSION", parameter.getExpression());
                    }
                    inputMap.put("ELEMENT", parameter.getElement());
                    inputparaValue.add(inputMap);
                }
                if (parameter.getSource() != null) {
                    inputMap.put("SOURCE", parameter.getSource());
                    inputparaValue.add(inputMap);
                }
                if (parameter.getColumn() != null) {
                    inputMap.put("COLUMN", parameter.getColumn());
                    inputparaValue.add(inputMap);
                }
                if (parameter.getParameterInfo() != null) {
                    inputMap.put("PARAMETERINFO", parameter.getParameterInfo());
                    inputMap.put("PARAPARENT", parameter.getParameterInfoParent());
                    inputparaValue.add(inputMap);
                }
            }
        }
        if (connection.getOutputParameter() != null) {
            IElementParameter OUTPUT_PARAMSPara = wenCom.getElementParameter("OUTPUT_PARAMS");
            List<Map<String, String>> outputMap = (List<Map<String, String>>) OUTPUT_PARAMSPara.getValue();
            EList inputList = connection.getOutputParameter();
            for (int i = 0; i < inputList.size(); i++) {
                Map<String, String> eleMap = new HashMap<String, String>(3);
                WSDLParameter parameter = (WSDLParameter) inputList.get(i);
                if (parameter.getExpression() != null || parameter.getColumn() != null) {
                    if (parameter.getExpression() != null) {
                        eleMap.put("EXPRESSION", parameter.getExpression());
                    }
                    // if (parameter.getColumn() != null) {
                    eleMap.put("COLUMN", parameter.getColumn());
                    // }
                    outputMap.add(eleMap);
                }
                if (parameter.getElement() != null) {
                    eleMap.put("ELEMENT", parameter.getElement());
                    outputMap.add(eleMap);
                }
                if (parameter.getSource() != null) {
                    eleMap.put("SOURCE", parameter.getSource());
                    outputMap.add(eleMap);
                }
                if (parameter.getParameterInfo() != null) {
                    eleMap.put("PARAMETERINFO", parameter.getParameterInfo());
                    eleMap.put("PARAPARENT", parameter.getParameterInfoParent());
                    outputMap.add(eleMap);
                }
            }
        }
    }
    MetadataTable inputMetadata = new MetadataTable();
    inputMetadata.setAttachedConnector("FLOW");
    inputMetadata.setLabel("Input");
    MetadataTable outputMetadaTable = null;
    List<org.talend.core.model.metadata.IMetadataColumn> newColumnList = new ArrayList<org.talend.core.model.metadata.IMetadataColumn>();
    List<org.talend.core.model.metadata.IMetadataColumn> newInputColumnList = new ArrayList<org.talend.core.model.metadata.IMetadataColumn>();
    if (connectionItem.getState() != null) {
        outputMetadaTable = new MetadataTable();
        outputMetadaTable.setAttachedConnector("OUTPUT");
        outputMetadaTable.setLabel("Output");
        WSDLSchemaConnection connection = (WSDLSchemaConnection) connectionItem.getConnection();
        Set<org.talend.core.model.metadata.builder.connection.MetadataTable> tables = ConnectionHelper.getTables(connection);
        //
        // EList<MetadataColumn> schemaMetadataColumn =
        // ((org.talend.core.model.metadata.builder.connection.MetadataTable) ConnectionHelper
        // .getTables(connection).toArray()[0]).getColumns();
        Iterator it = tables.iterator();
        while (it.hasNext()) {
            org.talend.core.model.metadata.builder.connection.MetadataTable metadatatable = (org.talend.core.model.metadata.builder.connection.MetadataTable) it.next();
            if (metadatatable.getLabel().equals("Output")) {
                for (int i = 0; i < metadatatable.getColumns().size(); i++) {
                    org.talend.core.model.metadata.builder.connection.MetadataColumn col = metadatatable.getColumns().get(i);
                    org.talend.core.model.metadata.MetadataColumn newColumn = new org.talend.core.model.metadata.MetadataColumn();
                    newColumn.setLabel(col.getLabel());
                    newColumn.setTalendType(col.getTalendType());
                    newColumn.setOriginalDbColumnName(col.getLabel());
                    newColumnList.add(newColumn);
                }
                outputMetadaTable.setListColumns(newColumnList);
            } else {
                // .getTables(connection).toArray()[1]).getColumns();
                for (int i = 0; i < metadatatable.getColumns().size(); i++) {
                    org.talend.core.model.metadata.builder.connection.MetadataColumn col = metadatatable.getColumns().get(i);
                    org.talend.core.model.metadata.MetadataColumn newColumn = new org.talend.core.model.metadata.MetadataColumn();
                    newColumn.setLabel(col.getLabel());
                    newColumn.setTalendType(col.getTalendType());
                    newColumn.setOriginalDbColumnName(col.getLabel());
                    newInputColumnList.add(newColumn);
                }
                inputMetadata.setListColumns(newInputColumnList);
            }
        }
    } else {
        outputMetadaTable = new MetadataTable();
        outputMetadaTable.setAttachedConnector("OUTPUT");
    }
    List<IMetadataTable> metadataTableList = new ArrayList<IMetadataTable>(4);
    metadataTableList.add(inputMetadata);
    metadataTableList.add(outputMetadaTable);
    wenCom.setMetadataList(metadataTableList);
    WebServiceComponentMain b = new WebServiceComponentMain(wenCom);
    wenCom.setComponent(b.getWebServiceComponent().getComponent());
    webServiceUI = new WebServiceUI(uiParent, b, connectionItem);
    webServiceUI.init();
    manager.addWebServiceSaveListener(this);
    return webServiceUI;
}
Also used : HashMap(java.util.HashMap) IComponent(org.talend.core.model.components.IComponent) ArrayList(java.util.ArrayList) WebServiceComponent(org.talend.designer.webservice.WebServiceComponent) WebServiceComponentMain(org.talend.designer.webservice.WebServiceComponentMain) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) MetadataTable(org.talend.core.model.metadata.MetadataTable) Iterator(java.util.Iterator) IElementParameter(org.talend.core.model.process.IElementParameter) ArrayList(java.util.ArrayList) EList(org.eclipse.emf.common.util.EList) List(java.util.List) WSDLSchemaConnection(org.talend.core.model.metadata.builder.connection.WSDLSchemaConnection) IMetadataTable(org.talend.core.model.metadata.IMetadataTable) EList(org.eclipse.emf.common.util.EList) WSDLParameter(org.talend.core.model.metadata.builder.connection.WSDLParameter) HashMap(java.util.HashMap) Map(java.util.Map)

Example 5 with WebServiceComponent

use of org.talend.designer.webservice.WebServiceComponent 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)

Aggregations

WebServiceComponent (org.talend.designer.webservice.WebServiceComponent)5 ArrayList (java.util.ArrayList)4 IElementParameter (org.talend.core.model.process.IElementParameter)3 Function (org.talend.designer.webservice.ws.wsdlinfo.Function)3 PortNames (org.talend.designer.webservice.ws.wsdlinfo.PortNames)3 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Map (java.util.Map)2 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)2 WebServiceComponentMain (org.talend.designer.webservice.WebServiceComponentMain)2 WSDLDiscoveryHelper (org.talend.designer.webservice.ws.WSDLDiscoveryHelper)2 EList (org.eclipse.emf.common.util.EList)1 IComponent (org.talend.core.model.components.IComponent)1 IMetadataColumn (org.talend.core.model.metadata.IMetadataColumn)1 MetadataTable (org.talend.core.model.metadata.MetadataTable)1 WSDLParameter (org.talend.core.model.metadata.builder.connection.WSDLParameter)1 WSDLSchemaConnection (org.talend.core.model.metadata.builder.connection.WSDLSchemaConnection)1 IExternalNode (org.talend.core.model.process.IExternalNode)1 InputMappingData (org.talend.designer.webservice.data.InputMappingData)1