use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class AllTypeDialog method buildParameterFromCollection.
private void buildParameterFromCollection(XmlSchemaObjectCollection xmlSchemaObjectCollection, ParameterInfo parameter) {
// XmlSchemaSequence xmlSchemaSequence = (XmlSchemaSequence) xmlSchemaParticle;
// XmlSchemaObjectCollection xmlSchemaObjectCollection = xmlSchemaSequence.getItems();
int count = xmlSchemaObjectCollection.getCount();
for (int j = 0; j < count; j++) {
XmlSchemaObject xmlSchemaObject = xmlSchemaObjectCollection.getItem(j);
if (xmlSchemaObject instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaObject;
XmlSchemaObjectCollection items = xmlSchemaGroupBase.getItems();
if (items != null) {
buildParameterFromCollection(items, parameter);
}
} else if (xmlSchemaObject instanceof XmlSchemaAny) {
ParameterInfo parameterSon = new ParameterInfo();
parameterSon.setName("_content_");
parameterSon.setParent(parameter);
parameter.getParameterInfos().add(parameterSon);
} else if (xmlSchemaObject instanceof XmlSchemaElement) {
XmlSchemaElement xmlSchemaElement = (XmlSchemaElement) xmlSchemaObject;
String elementName = xmlSchemaElement.getName();
ParameterInfo parameterSon = new ParameterInfo();
parameterSon.setName(elementName);
parameterSon.setParent(parameter);
Long min = xmlSchemaElement.getMinOccurs();
Long max = xmlSchemaElement.getMaxOccurs();
if (max - min > 1) {
parameterSon.setArraySize(-1);
parameterSon.setIndex("*");
}
parameter.getParameterInfos().add(parameterSon);
if (xmlSchemaElement.getSchemaTypeName() != null) {
String elementTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
if (elementTypeName != null && elementTypeName.equals("anyType")) {
parameterSon.setName(xmlSchemaElement.getName() + ":anyType");
}
parameterSon.setType(elementTypeName);
if (!WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
buileParameterFromTypes(elementTypeName, parameterSon);
}
} else if (xmlSchemaElement.getSchemaType() != null) {
if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaComplexType) {
XmlSchemaComplexType xmlElementComplexType = (XmlSchemaComplexType) xmlSchemaElement.getSchemaType();
XmlSchemaParticle xmlSchemaParticle = xmlElementComplexType.getParticle();
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
XmlSchemaObjectCollection childCollection = xmlSchemaGroupBase.getItems();
if (childCollection != null) {
buildParameterFromCollection(childCollection, parameterSon);
}
} else if (xmlSchemaElement.getSchemaTypeName() != null) {
String paraTypeName = xmlSchemaElement.getSchemaTypeName().getLocalPart();
if (paraTypeName != null) {
parameter.setType(paraTypeName);
buileParameterFromTypes(paraTypeName, parameterSon);
}
}
} else if (xmlSchemaElement.getSchemaType() instanceof XmlSchemaSimpleType) {
XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType) xmlSchemaElement.getSchemaType();
String typeName = xmlSchemaSimpleType.getName();
if (typeName != null && typeName.equals("anyType")) {
ParameterInfo pSon = new ParameterInfo();
pSon.setName(xmlSchemaElement.getName() + "(anyType)");
pSon.setParent(parameter);
parameter.getParameterInfos().add(pSon);
}
parameter.setType(typeName);
}
} else if (xmlSchemaElement.getRefName() != null) {
String elementTypeName = xmlSchemaElement.getRefName().getLocalPart();
if (!WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
buildParameterFromElements(elementTypeName, parameterSon);
}
}
} else if (xmlSchemaObject instanceof XmlSchemaAttribute) {
XmlSchemaAttribute xmlSchemaAttribute = (XmlSchemaAttribute) xmlSchemaObject;
String elementName = xmlSchemaAttribute.getName();
ParameterInfo parameterSon = new ParameterInfo();
parameterSon.setName(elementName);
parameterSon.setParent(parameter);
parameter.getParameterInfos().add(parameterSon);
if (xmlSchemaAttribute.getSchemaTypeName() != null) {
String elementTypeName = xmlSchemaAttribute.getSchemaTypeName().getLocalPart();
parameterSon.setType(elementTypeName);
if (!WsdlTypeUtil.isJavaBasicType(elementTypeName)) {
buileParameterFromTypes(elementTypeName, parameterSon);
}
} else if (xmlSchemaAttribute.getRefName() != null) {
String refName = xmlSchemaAttribute.getRefName().getLocalPart();
parameterSon.setType(refName);
}
}
}
}
use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class ParameterInfoUtil method getAllChildren.
public List<ParameterInfo> getAllChildren(ParameterInfo para) {
List<ParameterInfo> list = new ArrayList<ParameterInfo>();
List<ParameterInfo> childList = para.getParameterInfos();
list.addAll(childList);
for (ParameterInfo paraC : childList) {
if (paraC.getParameterInfos().size() > 0) {
list.addAll(getAllChildren(paraC));
}
}
return list;
}
use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class ParameterInfoUtil method getParentName.
public String getParentName(ParameterInfo para, int multi) {
List<ParameterInfo> paraList = getAllParameterInfo(para);
StringBuffer buffer = new StringBuffer();
for (int i = paraList.size() - 1; i >= 0; i--) {
ParameterInfo parentPara = paraList.get(i);
if (parentPara == null) {
continue;
}
buffer.append(parentPara.getName());
for (int m = 0; m < currenIndexList.size(); m++) {
if (currenIndexList.get(m).getParameterName().equals(parentPara.getName())) {
buffer.append("[" + currenIndexList.get(m).getIndexNum() + "]");
}
}
if (i != 0) {
buffer.append(".");
}
}
return buffer.toString();
}
use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class ParameterInfoUtil method getAllChildren.
public static List<ParameterInfo> getAllChildren(ParameterInfo para, String arrayFullName) {
List<ParameterInfo> list = new ArrayList<ParameterInfo>();
List<ParameterInfo> childList = para.getParameterInfos();
for (ParameterInfo paraC : childList) {
if (arrayFullName != null) {
arrayFullName = arrayFullName + "." + paraC.getName() + paraC.getIndex() == null ? "" : ("[" + paraC.getIndex() + "]");
}
}
list.addAll(childList);
for (ParameterInfo paraC : childList) {
if (paraC.getParameterInfos().size() > 0) {
list.addAll(getAllChildren(paraC, arrayFullName));
}
}
return list;
}
use of org.talend.designer.webservice.ws.wsdlinfo.ParameterInfo in project tdi-studio-se by Talend.
the class ParameterInfoUtil method getAllParameterInfo.
public List<ParameterInfo> getAllParameterInfo(ParameterInfo para) {
ParameterInfo parentPara = para.getParent();
List<ParameterInfo> list = new ArrayList<ParameterInfo>();
if (parentPara != null) {
list.add(para);
List<ParameterInfo> pali = getAllParameterInfo(parentPara);
list.addAll(pali);
} else {
list.add(para);
}
return list;
}
Aggregations