use of org.talend.designer.webservice.ws.wsdlinfo.PortNames in project tdi-studio-se by Talend.
the class RepositoryWebService method addListenerForWSDLCom.
private void addListenerForWSDLCom() {
refreshbut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell().getShell());
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(final IProgressMonitor monitor) {
//$NON-NLS-1$
monitor.beginTask("Retrieve WSDL parameter from net.", IProgressMonitor.UNKNOWN);
Display.getDefault().syncExec(new Runnable() {
public void run() {
getDataFromNet();
}
});
monitor.done();
}
};
try {
progressDialog.run(true, true, runnable);
} catch (InvocationTargetException e1) {
ExceptionHandler.process(e1);
} catch (InterruptedException e1) {
ExceptionHandler.process(e1);
} catch (WebServiceCancelException e1) {
return;
}
if (currentPortName != null) {
connection.setPortName(currentPortName.getPortName());
} else if (currentPortName == null && allPortNames != null) {
currentPortName = allPortNames.get(0);
connection.setPortName(currentPortName.getPortName());
}
listTable.setSelection(listTable.getItem(0));
if (currentFunction != null) {
connection.setMethodName(currentFunction.getName());
connection.setServerNameSpace(currentFunction.getServerNameSpace());
connection.setServerName(currentFunction.getServerName());
connection.setPortNameSpace(currentFunction.getServerNameSpace());
}
// listTable.select(0);
isFirst = false;
}
});
// TableItem firstItem = listTable.getItem(0);
// currentFunction = firstItem.getData();
listTable = listTableView.getTable();
portListTable = portListTableView.getTable();
listTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] item = listTable.getSelection();
currentFunction = (Function) item[0].getData();
if (currentFunction != null) {
connection.setServerName(currentFunction.getServerName());
connection.setServerNameSpace(currentFunction.getServerNameSpace());
connection.setMethodName(currentFunction.getName());
}
// if select the same as before ,don't change it
// IElementParameter METHODPara = connector.getElementParameter("METHOD"); //$NON-NLS-1$
// Object obj = METHODPara.getValue();
// if (currentFunction.getName().equals(obj.toString())) {
// return;
// }
List<ParameterInfo> listIn = currentFunction.getInputParameters();
List<ParameterInfo> listOut = currentFunction.getOutputParameters();
}
});
portListTable.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
TableItem[] item = portListTable.getSelection();
currentPortName = (PortNames) item[0].getData();
connection.setPortName(currentPortName.getPortName());
}
});
}
use of org.talend.designer.webservice.ws.wsdlinfo.PortNames in project tdi-studio-se by Talend.
the class RepositoryWebService method ctrate.
public void ctrate() {
wsdlComposite = new Composite(uiParent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 20;
layout.marginHeight = 20;
wsdlComposite.setLayout(layout);
wsdlComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
// WSDL URL
Composite wsdlUrlcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData layoutData = new GridData(GridData.FILL_HORIZONTAL);
layoutData.verticalIndent = 2;
layoutData.verticalSpan = 1;
wsdlUrlcomposite.setLayoutData(layoutData);
layout = new GridLayout(4, false);
wsdlUrlcomposite.setLayout(layout);
wsdlField = new LabelledFileField(wsdlUrlcomposite, ExternalWebServiceUIProperties.FILE_LABEL, ExternalWebServiceUIProperties.FILE_EXTENSIONS, 1, SWT.BORDER) {
@Override
protected void setFileFieldValue(String result) {
if (result != null) {
getTextControl().setText(TalendTextUtils.addQuotes(PathUtils.getPortablePath(result)));
getDataFromNet();
isFirst = false;
}
}
};
wsdlField.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
// TODO Auto-generated method stub
URLValue = wsdlField.getText();
connection.setWSDL(URLValue);
}
});
// add a listener for ctrl+space.
TalendProposalUtils.installOn(wsdlField.getTextControl(), connector.getProcess(), connector);
//$NON-NLS-1$
String wsdlUrl = (String) connector.getElementParameter("ENDPOINT").getValue();
if (wsdlUrl != null) {
wsdlField.setText(wsdlUrl);
}
refreshbut = new Button(wsdlUrlcomposite, SWT.PUSH | SWT.CENTER);
refreshbut.setImage(ImageProvider.getImage(EImage.REFRESH_ICON));
GridData butData = new GridData();
butData.verticalSpan = 1;
refreshbut.setLayoutData(butData);
// add port name UI
Composite wsdlPortcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData portlayoutData = new GridData(GridData.FILL_HORIZONTAL);
portlayoutData.verticalIndent = 2;
portlayoutData.verticalSpan = 3;
wsdlPortcomposite.setLayoutData(portlayoutData);
layout = new GridLayout(2, false);
layout.verticalSpacing = 1;
wsdlPortcomposite.setLayout(layout);
portNameLabel = new Label(wsdlPortcomposite, SWT.NONE);
//$NON-NLS-1$
portNameLabel.setText(Messages.getString("WebServiceUI.Port"));
GridData portLabelGridData = new GridData();
portLabelGridData.verticalAlignment = SWT.TOP;
portNameLabel.setLayoutData(portLabelGridData);
Composite portTabComposite = new Composite(wsdlPortcomposite, SWT.BORDER);
portTabComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
portTabComposite.setLayout(new FillLayout());
//$NON-NLS-1$
ExtendedTableModel<PortNames> portModel = new ExtendedTableModel<PortNames>("PORTNAMELIST", allPortNames);
portListTableView = new AbstractDataTableEditorView<PortNames>(portTabComposite, SWT.NONE, portModel, false, true, false) {
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<PortNames> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setHeaderVisible(false);
newTableViewerCreator.setVerticalScroll(true);
newTableViewerCreator.setReadOnly(true);
}
@Override
protected void createColumns(TableViewerCreator<PortNames> tableViewerCreator, Table table) {
TableViewerCreatorColumn rowColumn = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
rowColumn.setTitle(Messages.getString("WebServiceUI.COLUMN"));
rowColumn.setBeanPropertyAccessors(new IBeanPropertyAccessors<PortNames, String>() {
public String get(PortNames bean) {
return bean.getPortName();
}
public void set(PortNames bean, String value) {
bean.setPortName(value);
}
});
rowColumn.setWeight(60);
rowColumn.setModifiable(true);
rowColumn.setMinimumWidth(60);
rowColumn.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
}
};
// WSDL Operation
Composite wsdlOperationcomposite = new Composite(wsdlComposite, SWT.NONE);
GridData operationlayoutData = new GridData(GridData.FILL_BOTH);
operationlayoutData.verticalIndent = 2;
operationlayoutData.verticalSpan = 5;
wsdlOperationcomposite.setLayoutData(operationlayoutData);
layout = new GridLayout(2, false);
layout.verticalSpacing = 3;
wsdlOperationcomposite.setLayout(layout);
// wsdlOperationcomposite.setLayoutData(new GridData(GridData.FILL_BOTH));
operationLabel = new Label(wsdlOperationcomposite, SWT.NONE);
//$NON-NLS-1$
operationLabel.setText(Messages.getString("WebServiceUI.Operation"));
GridData opertionLabelGridData = new GridData();
opertionLabelGridData.verticalAlignment = SWT.TOP;
operationLabel.setLayoutData(opertionLabelGridData);
Composite tabComposite = new Composite(wsdlOperationcomposite, SWT.BORDER);
GridData tabGridData = new GridData(GridData.FILL_BOTH);
// tabGridData.verticalSpan = 3;
tabComposite.setLayoutData(tabGridData);
tabComposite.setLayout(new FillLayout());
//$NON-NLS-1$
ExtendedTableModel<Function> funModel = new ExtendedTableModel<Function>("FUNCTIONLIST", allfunList);
listTableView = new AbstractDataTableEditorView<Function>(tabComposite, SWT.NONE, funModel, false, true, false) {
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<Function> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setHeaderVisible(false);
newTableViewerCreator.setVerticalScroll(true);
newTableViewerCreator.setReadOnly(true);
}
@Override
protected void createColumns(TableViewerCreator<Function> tableViewerCreator, Table table) {
TableViewerCreatorColumn rowColumn = new TableViewerCreatorColumn(tableViewerCreator);
//$NON-NLS-1$
rowColumn.setTitle(Messages.getString("WebServiceUI.COLUMN"));
rowColumn.setBeanPropertyAccessors(new IBeanPropertyAccessors<Function, String>() {
public String get(Function bean) {
return bean.getName();
}
public void set(Function bean, String value) {
bean.setName(value);
}
});
rowColumn.setWeight(60);
rowColumn.setModifiable(true);
rowColumn.setMinimumWidth(60);
rowColumn.setCellEditor(new TextCellEditor(tableViewerCreator.getTable()));
}
};
addListenerForWSDLCom();
}
use of org.talend.designer.webservice.ws.wsdlinfo.PortNames 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());
}
use of org.talend.designer.webservice.ws.wsdlinfo.PortNames in project tdi-studio-se by Talend.
the class RepositoryWebService method initWebserviceUI.
private void initWebserviceUI() {
//$NON-NLS-1$
IElementParameter METHODPara = connector.getElementParameter("METHOD");
Object obj = METHODPara.getValue();
if (obj == null) {
return;
}
if (obj != null && obj instanceof String && !"".equals(obj)) {
//$NON-NLS-1$
String currentURL = (String) connector.getElementParameter("PORT_NAME").getValue();
PortNames retrivePortName = new PortNames();
retrivePortName.setPortName(currentURL);
allPortNames.clear();
allPortNames.add(retrivePortName);
retrivePortName.setPortName(currentURL);
Function fun = new Function(obj.toString());
allfunList.clear();
allfunList.add(fun);
if (fun != null) {
currentFunction = fun;
}
}
}
use of org.talend.designer.webservice.ws.wsdlinfo.PortNames 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();
}
Aggregations