use of org.apache.ws.commons.schema.XmlSchemaType in project tdi-studio-se by Talend.
the class ComponentBuilder method buileParameterFromTypes2.
private void buileParameterFromTypes2(String paraType, ParameterInfo parameter, int ioOrRecursion) {
if (ioOrRecursion < 3) {
parametersName.clear();
parametersName.add(parameter.getName());
} else if (ioOrRecursion == 3) {
parametersName.add(parameter.getName());
}
for (int i = 0; i < allXmlSchemaType.size(); i++) {
XmlSchemaType type = allXmlSchemaType.get(i);
String typeName = type.getName();
if (paraType.equals(typeName)) {
if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
Object obj = xmlSchemaComplexType.getContentModel().getContent();
if (obj instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
if (xscce != null) {
xmlSchemaParticle = xscce.getParticle();
}
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
} else if (obj instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
xmlSchemaObjectCollection = xsccr.getAttributes();
}
} else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
if (xmlSchemaObjectCollection != null) {
buildParameterFromCollection2(xmlSchemaObjectCollection, parameter, 3);
}
} else if (type instanceof XmlSchemaSimpleType) {
// Will TO DO if need.
// System.out.println("XmlSchemaSimpleType");
}
break;
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaType in project tdi-studio-se by Talend.
the class ComponentBuilder method buileParameterFromTypes.
/**
* DOC gcui Comment method "buileParameterFromTypes".
*
* @param paraType
* @param parameter
* @param operationInfo
* @param i
*/
private void buileParameterFromTypes(String paraNamespace, String paraType, ParameterInfo parameter, int ioOrRecursion) {
if (ioOrRecursion < 3) {
parametersName.clear();
parametersName.add(parameter.getName());
} else if (ioOrRecursion == 3) {
parametersName.add(parameter.getName());
}
for (int i = 0; i < allXmlSchemaType.size(); i++) {
XmlSchemaType type = allXmlSchemaType.get(i);
String typeName = type.getName();
if (paraType.equals(typeName) && paraNamespace.equals(type.getQName().getNamespaceURI())) {
if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType xmlSchemaComplexType = (XmlSchemaComplexType) type;
XmlSchemaParticle xmlSchemaParticle = xmlSchemaComplexType.getParticle();
XmlSchemaObjectCollection xmlSchemaObjectCollection = null;
if (xmlSchemaParticle == null && xmlSchemaComplexType.getContentModel() != null) {
Object obj = xmlSchemaComplexType.getContentModel().getContent();
if (obj instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
if (xscce.getBaseTypeName() != null) {
buileParameterFromTypes(xscce.getBaseTypeName().getNamespaceURI(), xscce.getBaseTypeName().getLocalPart(), parameter, ioOrRecursion);
}
if (xscce != null) {
xmlSchemaParticle = xscce.getParticle();
}
if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
} else if (obj instanceof XmlSchemaComplexContentRestriction) {
XmlSchemaComplexContentRestriction xsccr = (XmlSchemaComplexContentRestriction) obj;
xmlSchemaObjectCollection = xsccr.getAttributes();
}
} else if (xmlSchemaParticle instanceof XmlSchemaGroupBase) {
XmlSchemaGroupBase xmlSchemaGroupBase = (XmlSchemaGroupBase) xmlSchemaParticle;
xmlSchemaObjectCollection = xmlSchemaGroupBase.getItems();
}
if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() > 0) {
buildParameterFromCollection(xmlSchemaObjectCollection, parameter, 3);
} else if (xmlSchemaObjectCollection != null && xmlSchemaObjectCollection.getCount() == 0 && xmlSchemaComplexType.isAbstract()) {
findExtendtion(xmlSchemaComplexType, parameter, 3);
}
} else if (type instanceof XmlSchemaSimpleType) {
// Will TO DO if need.
// System.out.println("XmlSchemaSimpleType");
}
break;
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaType in project tdi-studio-se by Talend.
the class ComponentBuilder method findExtendtion.
private void findExtendtion(XmlSchemaType xmlSchemaType, ParameterInfo parameterSon, int ioOrRecursion) {
for (int i = 0; i < allXmlSchemaType.size(); i++) {
XmlSchemaType type = allXmlSchemaType.get(i);
if (type != null) {
if (type instanceof XmlSchemaComplexType) {
XmlSchemaComplexType xmlElementComplexType = (XmlSchemaComplexType) type;
if (xmlElementComplexType.getContentModel() != null) {
Object obj = xmlElementComplexType.getContentModel().getContent();
if (obj instanceof XmlSchemaComplexContentExtension) {
XmlSchemaComplexContentExtension xscce = (XmlSchemaComplexContentExtension) obj;
if (xscce.getBaseTypeName().getLocalPart() != null && xmlSchemaType.getName().equals(xscce.getBaseTypeName().getLocalPart())) {
if (xmlElementComplexType.isAbstract()) {
findExtendtion(type, parameterSon, ioOrRecursion);
break;
} else {
if (!alldExtendtion.contains(type.getName())) {
alldExtendtion.add(type.getName());
ParameterInfo parameterType = new ParameterInfo();
parameterType.setName(parameterSon.getName() + ".@type");
boolean flag = false;
for (int x = 0; x < parameterSon.getParameterInfos().size(); x++) {
ParameterInfo info = parameterSon.getParameterInfos().get(x);
if (info.getName().equals(parameterType.getName())) {
flag = true;
}
}
if (!flag) {
parameterType.setParent(parameterSon);
parameterSon.getParameterInfos().add(parameterType);
}
ParameterInfo parameterSubSon = new ParameterInfo();
parameterSubSon.setName(type.getName());
parameterSubSon.setParent(parameterSon);
parameterSon.getParameterInfos().add(parameterSubSon);
buileParameterFromTypes2(type.getName(), parameterSubSon, ioOrRecursion);
parametersName.clear();
}
}
}
}
}
}
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaType 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.apache.ws.commons.schema.XmlSchemaType in project cxf by apache.
the class WSDLToCorbaBinding method addCorbaElements.
private void addCorbaElements(CorbaType corbaTypeImpl, XmlSchema xmlSchemaTypes) throws Exception {
Map<QName, XmlSchemaElement> elements = xmlSchemaTypes.getElements();
for (XmlSchemaElement el : elements.values()) {
QName elName = el.getQName();
XmlSchemaType schemaType = el.getSchemaType();
if (elName == null) {
elName = el.getRef().getTargetQName();
schemaType = helper.getSchemaType(elName);
}
boolean anonymous = false;
if (schemaType == null) {
anonymous = true;
} else {
anonymous = WSDLTypes.isAnonymous(schemaType.getName());
}
if (schemaType != null) {
XmlSchemaAnnotation annotation = null;
if (el.getAnnotation() != null) {
annotation = el.getAnnotation();
}
// this situation won't be handled. REVISIT.
if (annotation != null) {
XmlSchemaAppInfo appInfo = null;
for (XmlSchemaAnnotationItem ann : annotation.getItems()) {
if (ann instanceof XmlSchemaAppInfo) {
appInfo = (XmlSchemaAppInfo) ann;
break;
}
}
if (appInfo != null) {
NodeList nlist = appInfo.getMarkup();
Node node = nlist.item(0);
String info = node.getNodeValue();
info = info.trim();
String annotationBindingName = "";
if ("corba:binding=".equals(info.substring(0, 14))) {
annotationBindingName = info.substring(14);
}
if (bindingName.equals(annotationBindingName)) {
annotation = null;
}
}
}
corbaTypeImpl = helper.convertSchemaToCorbaType(schemaType, elName, schemaType, annotation, anonymous);
if (el.isNillable()) {
QName uname = helper.createQNameCorbaNamespace(corbaTypeImpl.getQName().getLocalPart() + "_nil");
boolean isQualified = corbaTypeImpl.isSetQualified() && corbaTypeImpl.isQualified();
corbaTypeImpl = helper.createNillableUnion(uname, helper.checkPrefix(elName), helper.checkPrefix(corbaTypeImpl.getQName()), isQualified);
}
if (corbaTypeImpl != null && !helper.isDuplicate(corbaTypeImpl)) {
typeMappingType.getStructOrExceptionOrUnion().add(corbaTypeImpl);
}
}
}
}
Aggregations