Search in sources :

Example 1 with UmlUtil

use of com.devonfw.cobigen.templates.devon4j.utils.uml.UmlUtil in project cobigen by devonfw.

the class UmlUtilTest method getConnectors.

private List<Connector> getConnectors() {
    UmlUtil uml = new UmlUtil();
    Node source = null;
    Node target = null;
    String className = "";
    NodeList connectors = this.root.getElementsByTagName("connector");
    for (int i = 0; i < connectors.getLength(); i++) {
        Node connector = connectors.item(i);
        NodeList attributes = connector.getChildNodes();
        for (int j = 0; j < attributes.getLength(); j++) {
            DeferredNode attr = (DeferredNode) attributes.item(j);
            if (attr.getNodeName().equals("source")) {
                source = attr;
                NodeList sourceAttributes = attr.getChildNodes();
                for (int k = 0; k < sourceAttributes.getLength(); k++) {
                    Node sourceAttr = sourceAttributes.item(k);
                    if (sourceAttr.getNodeName().equals("model")) {
                        className = sourceAttr.getAttributes().getNamedItem("name").getTextContent();
                    }
                }
            } else if (attr.getNodeName().equals("target")) {
                target = attr;
            }
        }
        uml.resolveConnectorsContent(source, target, className);
    }
    return uml.getConnectors();
}
Also used : DeferredNode(org.apache.xerces.dom.DeferredNode) Node(org.w3c.dom.Node) NodeList(org.w3c.dom.NodeList) DeferredNode(org.apache.xerces.dom.DeferredNode) UmlUtil(com.devonfw.cobigen.templates.devon4j.utils.uml.UmlUtil)

Aggregations

UmlUtil (com.devonfw.cobigen.templates.devon4j.utils.uml.UmlUtil)1 DeferredNode (org.apache.xerces.dom.DeferredNode)1 Node (org.w3c.dom.Node)1 NodeList (org.w3c.dom.NodeList)1