use of org.apache.ws.commons.schema.XmlSchemaComplexType 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.XmlSchemaComplexType in project cxf by apache.
the class UnionVisitor method visitDeclaredUnion.
public void visitDeclaredUnion(AST identifierNode) {
Scope unionScope = new Scope(getScope(), identifierNode);
AST discriminatorNode = identifierNode.getNextSibling();
AST caseNode = discriminatorNode.getNextSibling();
// xmlschema:union
XmlSchemaComplexType unionSchemaComplexType = new XmlSchemaComplexType(schema, true);
unionSchemaComplexType.setName(mapper.mapToQName(unionScope));
// REVISIT
// TEMPORARILY
// using TypesVisitor to visit <const_type>
// it should be visited by a SwitchTypeSpecVisitor
TypesVisitor visitor = new TypesVisitor(getScope(), definition, schema, wsdlVisitor, null);
visitor.visit(discriminatorNode);
CorbaType ctype = visitor.getCorbaType();
Scope fullyQualifiedName = visitor.getFullyQualifiedName();
XmlSchemaChoice choice = new XmlSchemaChoice();
choice.setMinOccurs(1);
choice.setMaxOccurs(1);
unionSchemaComplexType.setParticle(choice);
// corba:union
Union corbaUnion = new Union();
corbaUnion.setQName(new QName(typeMap.getTargetNamespace(), unionScope.toString()));
corbaUnion.setRepositoryID(unionScope.toIDLRepositoryID());
corbaUnion.setType(unionSchemaComplexType.getQName());
if (ctype != null) {
corbaUnion.setDiscriminator(ctype.getQName());
} else {
// Discriminator type is forward declared.
UnionDeferredAction unionDiscriminatorAction = new UnionDeferredAction(corbaUnion);
wsdlVisitor.getDeferredActions().add(fullyQualifiedName, unionDiscriminatorAction);
}
boolean recursiveAdd = addRecursiveScopedName(identifierNode);
processCaseNodes(caseNode, unionScope, choice, corbaUnion);
if (recursiveAdd) {
removeRecursiveScopedName(identifierNode);
}
// add corbaType
typeMap.getStructOrExceptionOrUnion().add(corbaUnion);
// REVISIT: are these assignments needed?
setSchemaType(unionSchemaComplexType);
setCorbaType(corbaUnion);
// Need to check if the union was forward declared
processForwardUnionActions(unionScope);
// Once we've finished declaring the union, we should make sure it has been removed from
// the list of scopedNames so that we indicate that is no longer simply forward declared.
scopedNames.remove(unionScope);
}
use of org.apache.ws.commons.schema.XmlSchemaComplexType in project cxf by apache.
the class WSDLParameter method processWrappedOutputParams.
private void processWrappedOutputParams(WSDLToCorbaBinding wsdlToCorbaBinding, Operation operation, SchemaCollection xmlSchemaList, List<ParamType> inputs, List<ParamType> outputs) throws Exception {
Output output = operation.getOutput();
if (output != null) {
Message msg = output.getMessage();
Part part = (Part) msg.getOrderedParts(null).iterator().next();
XmlSchemaComplexType schemaType = null;
XmlSchemaElement el = getElement(part, xmlSchemaList);
if (el == null) {
return;
}
if (el.getSchemaType() != null) {
schemaType = (XmlSchemaComplexType) el.getSchemaType();
}
XmlSchemaSequence seq = (XmlSchemaSequence) schemaType.getParticle();
if (seq != null) {
for (XmlSchemaSequenceMember seqMember : seq.getItems()) {
if (seqMember instanceof XmlSchemaElement) {
el = (XmlSchemaElement) seqMember;
processWrappedOutputParam(wsdlToCorbaBinding, el, inputs, outputs);
}
}
}
}
}
use of org.apache.ws.commons.schema.XmlSchemaComplexType in project cxf by apache.
the class DeclaratorVisitor method duplicateXmlSchemaComplexType.
private XmlSchemaComplexType duplicateXmlSchemaComplexType(Scope newScope) {
XmlSchemaComplexType oldSchemaType = (XmlSchemaComplexType) getSchemaType();
XmlSchemaComplexType newSchemaType = new XmlSchemaComplexType(schema, true);
newSchemaType.setName(newScope.toString());
newSchemaType.setParticle(oldSchemaType.getParticle());
return newSchemaType;
}
use of org.apache.ws.commons.schema.XmlSchemaComplexType in project cxf by apache.
the class SequenceVisitor method generateSchemaType.
private XmlSchemaType generateSchemaType(XmlSchemaType stype, Scope scopedName, long bound, Scope fullyQualifiedName) {
XmlSchemaComplexType ct = new XmlSchemaComplexType(schema, true);
ct.setName(mapper.mapToQName(scopedName));
XmlSchemaSequence sequence = new XmlSchemaSequence();
XmlSchemaElement el = new XmlSchemaElement(schema, false);
el.setName(ELEMENT_NAME);
el.setMinOccurs(0);
if (bound != -1) {
el.setMaxOccurs(bound);
} else {
el.setMaxOccurs(Long.MAX_VALUE);
}
if (stype != null) {
el.setSchemaTypeName(stype.getQName());
if (stype.getQName().equals(ReferenceConstants.WSADDRESSING_TYPE)) {
el.setNillable(true);
}
} else {
SequenceDeferredAction elementAction = new SequenceDeferredAction(el);
wsdlVisitor.getDeferredActions().add(fullyQualifiedName, elementAction);
}
sequence.getItems().add(el);
ct.setParticle(sequence);
return ct;
}
Aggregations