use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement 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);
}
}
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GenerateXSD method generateSetters.
private void generateSetters(XMLElement type, XMLElement choice, String adapterName, boolean addAsAttribute) throws Exception {
// Generate setters.
Iterator<String> setters = MapMetaData.getInstance().getMapDefinition(adapterName).getValueDefinitions().iterator();
while (setters.hasNext()) {
CaseSensitiveXMLElement x = new CaseSensitiveXMLElement("xs:element");
ValueDefinition vd = MapMetaData.getInstance().getMapDefinition(adapterName).getValueDefinition(setters.next());
x.setAttribute("type", (vd.getDirection().equals("out") ? "MapType" : "SetterType"));
x.setAttribute("name", adapterName + "." + vd.getName());
choice.addChild(x);
if (addAsAttribute) {
CaseSensitiveXMLElement xa = new CaseSensitiveXMLElement("xs:attribute");
xa.setAttribute("name", vd.getName());
xa.setAttribute("type", "xs:string");
if (vd.getRequired().equals("true")) {
xa.setAttribute("use", "required");
}
type.addChild(xa);
}
}
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GeoEdge method createPlaceMark.
@Override
public XMLElement createPlaceMark() {
XMLElement c = new CaseSensitiveXMLElement("Placemark");
c.setAttribute("id", id);
c.addTagKeyValue("name", id);
XMLElement point = createElement();
c.addChild(point);
return c;
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GeoPolygonGroup method createDocument.
public XMLElement createDocument() throws UnsupportedEncodingException, IOException {
XMLElement template = new CaseSensitiveXMLElement();
template.parseFromStream(getClass().getResourceAsStream("template.kml"));
XMLElement doc = template.getElementByTagName("Document");
for (GeoPolygon g : myPolygons) {
XMLElement x = g.createPlaceMark();
doc.addChild(x);
}
return template;
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GeoPolygonGroup method createElement.
@Override
public XMLElement createElement() {
XMLElement c = new CaseSensitiveXMLElement("MultiGeometry");
List<GeoPolygon> polys;
try {
polys = createOutlinePoly();
for (GeoPolygon g : polys) {
XMLElement poly = g.createElement();
c.addChild(poly);
}
return c;
} catch (GeoException e) {
logger.error("Error: ", e);
}
return null;
}
Aggregations