use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GenerateXSD method createSpecialMessageType.
private CaseSensitiveXMLElement createSpecialMessageType(String specialMessageTypeName, String adapterName) throws Exception {
CaseSensitiveXMLElement messageType = new CaseSensitiveXMLElement();
messageType.setName("xs:complexType");
messageType.setAttribute("name", specialMessageTypeName);
CaseSensitiveXMLElement choice2 = new CaseSensitiveXMLElement("xs:choice");
choice2.setAttribute("minOccurs", "0");
choice2.setAttribute("maxOccurs", "unbounded");
messageType.addChild(choice2);
// Add inherited elements
for (int i = 0; i < inherited.length; i++) {
CaseSensitiveXMLElement x = new CaseSensitiveXMLElement("xs:element");
x.setAttribute("ref", inherited[i]);
choice2.addChild(x);
}
CaseSensitiveXMLElement m = new CaseSensitiveXMLElement("xs:element");
m.setAttribute("name", "message");
m.setAttribute("type", specialMessageTypeName);
choice2.addChild(m);
CaseSensitiveXMLElement attr = new CaseSensitiveXMLElement();
attr.setName("xs:attribute");
attr.setAttribute("use", "required");
attr.setAttribute("name", "name");
attr.setAttribute("type", "xs:string");
messageType.addChild(attr);
attr = new CaseSensitiveXMLElement();
attr.setName("xs:attribute");
attr.setAttribute("name", "type");
attr.setAttribute("type", "xs:string");
messageType.addChild(attr);
attr = new CaseSensitiveXMLElement();
attr.setName("xs:attribute");
attr.setAttribute("name", "condition");
attr.setAttribute("type", "xs:string");
messageType.addChild(attr);
attr = new CaseSensitiveXMLElement();
attr.setName("xs:attribute");
attr.setAttribute("name", "mode");
attr.setAttribute("type", "xs:string");
messageType.addChild(attr);
attr = new CaseSensitiveXMLElement();
attr.setName("xs:attribute");
attr.setAttribute("name", "index");
attr.setAttribute("type", "xs:string");
messageType.addChild(attr);
CaseSensitiveXMLElement insertedadapters = new CaseSensitiveXMLElement("adapters:insertedadapters");
choice2.addChild(insertedadapters);
generateSetters(messageType, choice2, adapterName, false);
generateMethods(choice2, adapterName);
return messageType;
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GenerateXSD method createAdapterXSD.
private XMLElement createAdapterXSD(String adapterName, CaseSensitiveXMLElement parent) throws Exception {
String specialMessageTypeName = adapterName + "MessageType";
CaseSensitiveXMLElement basic = new CaseSensitiveXMLElement("xs:element");
basic.setAttribute("name", "map." + adapterName);
CaseSensitiveXMLElement type = new CaseSensitiveXMLElement("xs:complexType");
basic.addChild(type);
CaseSensitiveXMLElement choice = new CaseSensitiveXMLElement("xs:choice");
choice.setAttribute("minOccurs", "0");
choice.setAttribute("maxOccurs", "unbounded");
type.addChild(choice);
// Add inherited elements
for (int i = 0; i < inherited.length; i++) {
CaseSensitiveXMLElement x = new CaseSensitiveXMLElement("xs:element");
x.setAttribute("ref", inherited[i]);
choice.addChild(x);
}
// Add Special message type reference.
CaseSensitiveXMLElement m = new CaseSensitiveXMLElement("xs:element");
m.setAttribute("name", "message");
m.setAttribute("type", specialMessageTypeName);
choice.addChild(m);
CaseSensitiveXMLElement specialMessage = createSpecialMessageType(specialMessageTypeName, adapterName);
parent.addChild(specialMessage);
// Add adapters:insertedadapters
CaseSensitiveXMLElement insertedadapters = new CaseSensitiveXMLElement("adapters:insertedadapters");
choice.addChild(insertedadapters);
generateSetters(type, choice, adapterName, true);
CaseSensitiveXMLElement conditionAttr = new CaseSensitiveXMLElement("xs:attribute");
conditionAttr.setAttribute("name", "condition");
conditionAttr.setAttribute("type", "xs:string");
type.addChild(conditionAttr);
generateMethods(choice, adapterName);
return basic;
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GenerateXSD method generateXSD.
public String generateXSD() throws Exception {
CaseSensitiveXMLElement xml = new CaseSensitiveXMLElement();
InputStreamReader fis = new InputStreamReader(getClass().getClassLoader().getResourceAsStream("basenavascript.xsd"));
xml.parseFromReader(fis);
fis.close();
MapMetaData mmd = MapMetaData.getInstance();
Set<String> maps = mmd.getMapDefinitions();
Iterator<String> all = maps.iterator();
while (all.hasNext()) {
String mappie = all.next();
if (!mappie.equals("__empty__")) {
XMLElement x = createAdapterXSD(mappie, xml);
xml.addChild(x);
}
}
ArrayList<XMLElement> tags = new ArrayList<XMLElement>();
findTags(xml, "adapters:insertedadapters", tags);
for (int i = 0; i < tags.size(); i++) {
XMLElement x = tags.get(i);
XMLElement parent = x.getParent();
// <xs:element ref="map.sqlquery"/>
all = maps.iterator();
while (all.hasNext()) {
String mappie = all.next();
if (!mappie.equals("__empty__")) {
CaseSensitiveXMLElement replace = new CaseSensitiveXMLElement("xs:element");
replace.setAttribute("ref", "map." + mappie);
parent.addChild(replace);
}
}
parent.removeChild(x);
}
StringWriter sb = new StringWriter();
xml.write(sb);
return sb.toString();
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GeoEdge method createElement.
@Override
public XMLElement createElement() {
XMLElement c = new CaseSensitiveXMLElement("LineString");
c.addTagKeyValue("extrude", "0");
c.addTagKeyValue("altitudeMode", "clampToGround");
c.addTagKeyValue("tesselate", "0");
c.addTagKeyValue("coordinates", toString());
return c;
}
use of com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement in project navajo by Dexels.
the class GeoPolygonGroup method dumpMe.
private void dumpMe(String filename, List<GeoPolygon> pp) {
List<XMLElement> debugList = new ArrayList<XMLElement>();
for (GeoPolygon geoPoly : pp) {
debugList.addAll(geoPoly.createPlaceMarkList());
}
XMLElement kml = new CaseSensitiveXMLElement("kml");
XMLElement doc = new CaseSensitiveXMLElement("Document");
kml.addChild(doc);
for (XMLElement element : debugList) {
doc.addChild(element);
}
try {
writeElement(filename, kml);
} catch (IOException e) {
logger.error("Error: ", e);
}
}
Aggregations