use of com.dexels.navajo.mapping.compiler.meta.ParameterDefinition in project navajo by Dexels.
the class GenerateXSD method generateMethods.
private void generateMethods(XMLElement choice, String adapterName) throws Exception {
// Generate methods.
Iterator<String> methods = MapMetaData.getInstance().getMapDefinition(adapterName).getMethodDefinitions().iterator();
while (methods.hasNext()) {
CaseSensitiveXMLElement x = new CaseSensitiveXMLElement("xs:element");
String method = methods.next();
x.setAttribute("name", adapterName + "." + method);
choice.addChild(x);
CaseSensitiveXMLElement typex = new CaseSensitiveXMLElement("xs:complexType");
x.addChild(typex);
// Add parameters.
int count = 0;
Iterator<String> params = MapMetaData.getInstance().getMapDefinition(adapterName).getMethodDefinition(method).getParameters().iterator();
while (params.hasNext()) {
ParameterDefinition pd = MapMetaData.getInstance().getMapDefinition(adapterName).getMethodDefinition(method).getParameterDefinition(params.next());
if (!pd.getRequired().equals("automatic")) {
CaseSensitiveXMLElement xp = new CaseSensitiveXMLElement("xs:attribute");
xp.setAttribute("name", pd.getName());
xp.setAttribute("type", "xs:string");
if (pd.getRequired().equals("true")) {
xp.setAttribute("use", "required");
}
typex.addChild(xp);
count++;
}
}
if (count == 0) {
x.removeChild(typex);
}
}
}
Aggregations