use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class AllTypeDialog method buildParameterFromElements.
private void buildParameterFromElements(String partElement, ParameterInfo parameterRoot) {
// XmlSchemaObjectTable elements = xmlSchema.getElements();
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);
}
} else if (xmlSchemaElement.getSchemaTypeName() != null) {
String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
if (paraTypeName != null) {
parameterRoot.setType(paraTypeName);
buileParameterFromTypes(paraTypeName, parameterRoot);
}
}
} 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(xmlSchemaElement.getName() + "(anyType)");
parameterSon.setParent(parameterRoot);
parameterRoot.getParameterInfos().add(parameterSon);
}
parameterRoot.setType(typeName);
}
} else if (xmlSchemaElement.getSchemaTypeName() != null) {
String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
if (paraTypeName != null) {
parameterRoot.setType(paraTypeName);
buileParameterFromTypes(paraTypeName, parameterRoot);
}
}
}
}
}
}
use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class AllTypeDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite createDialogArea = (Composite) super.createDialogArea(parent);
createDialogArea.setLayout(new FillLayout());
SashForm baseCom = new SashForm(createDialogArea, SWT.VERTICAL | SWT.BORDER);
baseCom.setLayout(new GridLayout(1, true));
Group group1 = new Group(baseCom, SWT.None);
group1.setText(Messages.getString("AllTypeDialog.Group1Text"));
group1.setLayoutData(new GridData(GridData.FILL_BOTH));
group1.setLayout(new FillLayout());
Font font = new Font(Display.getCurrent(), "Arial", 43, 3);
group1.setFont(font);
font.dispose();
Group group2 = new Group(baseCom, SWT.None);
group2.setText(Messages.getString("AllTypeDialog.Group2Text"));
group2.setLayoutData(new GridData(GridData.FILL_BOTH));
font = new Font(Display.getCurrent(), "Arial", 43, 3);
group2.setFont(font);
group2.setLayout(new FillLayout());
font.dispose();
list = new List(group1, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
list.setItems(allXMLSchemaTypeName);
treeViewer = new TreeViewer(group2, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
tree = treeViewer.getTree();
tree.setHeaderVisible(false);
tree.setLinesVisible(true);
treeViewer.setContentProvider(new WebServiceTreeContentProvider());
treeViewer.setLabelProvider(new AllTypeLabelProvider());
treeViewer.setInput(null);
treeViewer.refresh();
list.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String selection = list.getSelection()[0];
if (selection.contains(COMPLEXTYPE)) {
String[] split = selection.split(":");
String complexTypeName = split[1];
for (XmlSchemaType xmlSchemaType : allXmlSchemaType) {
if (xmlSchemaType.getName().equals(complexTypeName)) {
ParameterInfo parameterRoot = new ParameterInfo();
parameterRoot.setName("parameters");
ParameterInfo parameterSon = new ParameterInfo();
parameterSon.setName(complexTypeName);
parameterSon.setParent(parameterRoot);
parameterRoot.getParameterInfos().add(parameterSon);
XmlSchemaComplexType xmlElementComplexType = (XmlSchemaComplexType) xmlSchemaType;
XmlSchemaParticle xmlSchemaParticle = xmlElementComplexType.getParticle();
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
XmlSchemaObjectCollection childCollection = xmlSchemaGroupBase.getItems();
if (childCollection != null) {
buildParameterFromCollection(childCollection, parameterSon);
}
}
treeViewer.setInput(parameterRoot);
treeViewer.refresh();
selectedParaInfo = parameterSon;
}
}
} else {
treeViewer.setInput(null);
treeViewer.refresh();
selectedParaInfo = null;
}
}
});
return baseCom;
}
use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class WebServiceTableLiner method onXPathValueChanged.
public void onXPathValueChanged(Table sourceTable, Table targetTable, String oldValue, String newValue, String inComeName, int itemIndex) {
TableItem tabletraItem = targetTable.getItem(itemIndex);
boolean needAddLink = true;
TableItem[] items = sourceTable.getItems();
List<TableItem> itemList = new ArrayList<TableItem>();
for (int i = 0; i < items.length; i++) {
String columnLabel = null;
IMetadataColumn column = null;
ParameterInfo parame = null;
if (items[i].getData() instanceof IMetadataColumn) {
column = (IMetadataColumn) items[i].getData();
columnLabel = column.getLabel();
} else // }
if (items[i].getData() instanceof OutPutMappingData) {
parame = ((OutPutMappingData) items[i].getData()).getParameter();
if (!parame.getParameterInfos().isEmpty()) {
continue;
}
// columnLabel = parame.getName();
columnLabel = ((OutPutMappingData) items[i].getData()).getParameterName();
int m = columnLabel.lastIndexOf(".");
columnLabel = columnLabel.substring(m + 1);
}
if (newValue.contains(columnLabel)) {
// if (!pattern(columnLabel, newValue)) {
if (inComeName != null) {
WebServiceExpressionParser webParser = new WebServiceExpressionParser("\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*");
Map<String, String> itemNamemap = webParser.parseInTableEntryLocations(newValue);
Set<Entry<String, String>> set = itemNamemap.entrySet();
Iterator<Entry<String, String>> ite = set.iterator();
while (ite.hasNext()) {
Entry<String, String> entry = ite.next();
String columnValue = entry.getKey();
String rowValue = entry.getValue();
if (!isPatternWord(inComeName + "." + columnLabel, rowValue + "." + columnValue)) {
linksManager.removeLinksFromDataItem2(tabletraItem.getData());
if (tabletraItem.getData() instanceof InputMappingData) {
InputMappingData data = (InputMappingData) tabletraItem.getData();
List<IMetadataColumn> list = data.getMetadataColumnList();
if (column != null) {
list.remove(column);
}
}
needAddLink = false;
for (TableItem item : itemList) {
addLinks(item, item.getData(), targetTable, tabletraItem.getData(), "INPUTMAPPING");
}
getBackgroundRefresher().refreshBackground();
// return;
}
}
} else {
WebServiceExpressionParser webParser = new WebServiceExpressionParser("\\s*\\w+(\\[\\d+?\\])?\\s*");
Set<String> set = webParser.parseOutTableEntryLocations(newValue);
Iterator<String> ite = set.iterator();
while (ite.hasNext()) {
String columnValue = ite.next();
// if (columnValue.equals(columnLabel)) {
if (!isPatternWord(columnLabel, columnValue)) {
linksManager.removeLinksFromDataItem2(tabletraItem.getData());
OutPutMappingData data = (OutPutMappingData) tabletraItem.getData();
if (parame != null) {
data.getParameterList().remove(parame);
}
needAddLink = false;
for (TableItem item : itemList) {
addLinks(item, item.getData(), targetTable, tabletraItem.getData(), "OUTPUTMAPPING");
}
getBackgroundRefresher().refreshBackground();
// return;
// }
}
}
}
if (true) {
// if (!mark) {
if (inComeName != null) {
WebServiceExpressionParser webParser = new WebServiceExpressionParser("\\s*(\\w+)\\s*\\.\\s*(\\w+)\\s*");
Map<String, String> itemNamemap = webParser.parseInTableEntryLocations(newValue);
Set<Entry<String, String>> set = itemNamemap.entrySet();
Iterator<Entry<String, String>> ite = set.iterator();
while (ite.hasNext()) {
Entry<String, String> entry = ite.next();
String columnValue = entry.getKey();
String rowValue = entry.getValue();
if (isPatternWord(inComeName + "." + columnLabel, rowValue + "." + columnValue)) {
itemList.add(items[i]);
addLinks(items[i], items[i].getData(), targetTable, tabletraItem.getData(), "INPUTMAPPING");
getBackgroundRefresher().refreshBackground();
if (tabletraItem.getData() instanceof InputMappingData) {
InputMappingData data = (InputMappingData) tabletraItem.getData();
List<IMetadataColumn> list = data.getMetadataColumnList();
if (column != null && !list.contains(column)) {
list.add(column);
}
}
}
}
} else {
WebServiceExpressionParser webParser = new WebServiceExpressionParser("\\s*\\w+(\\[\\d+?\\])?\\s*");
Set<String> set = webParser.parseOutTableEntryLocations(newValue);
Iterator<String> ite = set.iterator();
while (ite.hasNext()) {
String columnValue = ite.next();
if (isPatternWord(columnLabel, columnValue)) {
itemList.add(items[i]);
addLinks(items[i], items[i].getData(), targetTable, tabletraItem.getData(), "OUTPUTMAPPING");
getBackgroundRefresher().refreshBackground();
}
}
}
}
} else if (oldValue.contains(columnLabel)) {
linksManager.removeLinksFromDataItem2(tabletraItem.getData());
if (tabletraItem.getData() instanceof InputMappingData) {
InputMappingData data = (InputMappingData) tabletraItem.getData();
List<IMetadataColumn> list = data.getMetadataColumnList();
if (column != null) {
list.remove(column);
}
} else if (tabletraItem.getData() instanceof OutPutMappingData) {
OutPutMappingData data = (OutPutMappingData) tabletraItem.getData();
if (parame != null) {
data.getParameterList().remove(parame);
}
}
for (TableItem item : itemList) {
if (inComeName != null) {
addLinks(item, item.getData(), targetTable, tabletraItem.getData(), "INPUTMAPPING");
} else {
addLinks(item, item.getData(), targetTable, tabletraItem.getData(), "OUTPUTMAPPING");
}
}
getBackgroundRefresher().refreshBackground();
}
}
// createFieldLinks(newValue, tableItem, null);
}
use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class WSDLDiscoveryHelper method getAllChildren.
public List<ParameterInfo> getAllChildren(ParameterInfo para) {
List<ParameterInfo> list = new ArrayList<ParameterInfo>();
List<ParameterInfo> childList = para.getParameterInfos();
for (ParameterInfo paraC : childList) {
if (paraC.getParent().getParaFullName() != null) {
paraC.setParaFullName(paraC.getParent().getParaFullName() + "." + paraC.getName());
}
}
list.addAll(childList);
for (ParameterInfo paraC : childList) {
if (paraC.getParameterInfos().size() > 0) {
list.addAll(getAllChildren(paraC));
}
}
return list;
}
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) {
if (currenIndexList != null) {
if (!currenIndexList.isEmpty()) {
return getParentName(para, 2);
}
}
List<ParameterInfo> paraList = getAllParameterInfo(para);
StringBuffer buffer = new StringBuffer();
ParameterInfo nearArrayParent = null;
goout: for (ParameterInfo pa : paraList) {
if (pa.getArraySize() != 0) {
nearArrayParent = pa;
break goout;
}
}
for (int i = paraList.size() - 1; i >= 0; i--) {
ParameterInfo parentPara = paraList.get(i);
if (parentPara == null) {
continue;
}
buffer.append(parentPara.getName());
if (nearArrayParent != null && parentPara == nearArrayParent) {
if (para.getArraySize() == 0 && para.getParameterInfos().size() == 0 && getCurrentindex() != -1 && i != 0) {
buffer.append("[" + getCurrentindex() + "]");
} else if (para.getArraySize() != 0 && para.getParameterInfos().size() == 0 && getCurrentindex() != -1) {
buffer.append("[" + getCurrentindex() + "]");
} else if (para.getArraySize() != 0 && para.getParameterInfos().size() == 0 && getCurrentindex() == -1) {
buffer.append("[*]");
}
}
if (i != 0) {
buffer.append(".");
}
// if (para.getArraySize() != 0) {
// if (i == 0) {
// buffer.append("[]");
// }
// }
}
return buffer.toString();
}
Aggregations