Search in sources :

Example 46 with CaseSensitiveXMLElement

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);
        }
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) ParameterDefinition(com.dexels.navajo.mapping.compiler.meta.ParameterDefinition)

Example 47 with CaseSensitiveXMLElement

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);
        }
    }
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) ValueDefinition(com.dexels.navajo.mapping.compiler.meta.ValueDefinition)

Example 48 with CaseSensitiveXMLElement

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;
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 49 with CaseSensitiveXMLElement

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;
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Example 50 with CaseSensitiveXMLElement

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;
}
Also used : CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) CaseSensitiveXMLElement(com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement) XMLElement(com.dexels.navajo.document.nanoimpl.XMLElement)

Aggregations

CaseSensitiveXMLElement (com.dexels.navajo.document.nanoimpl.CaseSensitiveXMLElement)53 XMLElement (com.dexels.navajo.document.nanoimpl.XMLElement)49 IOException (java.io.IOException)10 InputStreamReader (java.io.InputStreamReader)7 FileReader (java.io.FileReader)5 HashMap (java.util.HashMap)5 File (java.io.File)3 FileInputStream (java.io.FileInputStream)3 APIException (com.dexels.navajo.article.APIException)2 Message (com.dexels.navajo.document.Message)2 Property (com.dexels.navajo.document.Property)2 BufferedReader (java.io.BufferedReader)2 InputStream (java.io.InputStream)2 PrintWriter (java.io.PrintWriter)2 Reader (java.io.Reader)2 StringReader (java.io.StringReader)2 StringWriter (java.io.StringWriter)2 ArrayList (java.util.ArrayList)2 XMLParseException (com.dexels.navajo.document.nanoimpl.XMLParseException)1 AdapterFieldDependency (com.dexels.navajo.mapping.compiler.meta.AdapterFieldDependency)1