use of org.glassfish.jaxb.runtime.v2.schemagen.xmlschema.ComplexType in project metro-jax-ws by eclipse-ee4j.
the class ServiceArtifactSchemaGenerator method generate.
public void generate(SchemaOutputResolver resolver) {
xsdResolver = resolver;
List<WrapperParameter> wrappers = new ArrayList<>();
for (JavaMethodImpl method : model.getJavaMethods()) {
if (method.getBinding().isRpcLit())
continue;
for (ParameterImpl p : method.getRequestParameters()) {
if (p instanceof WrapperParameter) {
if (WrapperComposite.class.equals((p.getTypeInfo().type))) {
wrappers.add((WrapperParameter) p);
}
}
}
for (ParameterImpl p : method.getResponseParameters()) {
if (p instanceof WrapperParameter) {
if (WrapperComposite.class.equals((p.getTypeInfo().type))) {
wrappers.add((WrapperParameter) p);
}
}
}
}
if (wrappers.isEmpty())
return;
HashMap<String, Schema> xsds = initWrappersSchemaWithImports(wrappers);
postInit(xsds);
for (WrapperParameter wp : wrappers) {
String tns = wp.getName().getNamespaceURI();
Schema xsd = xsds.get(tns);
Element e = xsd._element(Element.class);
e._attribute("name", wp.getName().getLocalPart());
e.type(wp.getName());
ComplexType ct = xsd._element(ComplexType.class);
ct._attribute("name", wp.getName().getLocalPart());
ExplicitGroup sq = ct.sequence();
for (ParameterImpl p : wp.getWrapperChildren()) if (p.getBinding().isBody())
addChild(sq, p);
}
for (Schema xsd : xsds.values()) xsd.commit();
}
Aggregations