Package eu.planets_project.pp.plato.xml.freemind

Examples of eu.planets_project.pp.plato.xml.freemind.MindMap


     * that every leaf node is a measurement unit, and the objective tree
     * leaves are one level higher. So we stop one level earlier,
     * the units are not imported at the moment.
     */
    public ObjectiveTree loadFreeMindStream(InputStream in, boolean hasUnits, boolean hasLeaves) {
        MindMap map = new MindMap();

        // load content into temporary structure
        Digester digester = new Digester();
        digester.setSchema("/data/schemas/freemind.xsd");
        digester.setValidating(true);
        digester.push(map);

        digester.addObjectCreate("*/node",
        "eu.planets_project.pp.plato.xml.freemind.Node");
        digester.addSetProperties("*/node");
        digester.addCallMethod("*/node/hook/text","setDESCRIPTION",0);
        digester.addSetNext("*/node","addChild");

        try {
            //InputStream s = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
            digester.setUseContextClassLoader(true);
            digester.parse(in);
        } catch (IOException e) {
            log.error("Error loading Freemind file. Cause: " + e.getMessage());
            return null;
        } catch (SAXException e) {
            log.error("Document is not a valid Freemind file. Cause: " + e.getMessage());
            return null;
        }

        // traverse temp structure of map and nodes and create ObjectiveTree
        ObjectiveTree tree = new ObjectiveTree();
        tree.setRoot(map.getObjectiveTreeRoot(hasUnits, hasLeaves));
        if (tree.getRoot().isLeaf()) {
            return null;
        }
        return tree;
    }
View Full Code Here


        }
        return tree;
    }

    public PolicyTree loadFreeMindPolicyTree(InputStream in) {
        MindMap map = new MindMap();

        // load content into temporary structure
        Digester digester = new Digester();
        digester.setSchema("/data/schemas/freemind.xsd");
        digester.setValidating(true);
        digester.push(map);

        digester.addObjectCreate("*/node",
        "eu.planets_project.pp.plato.xml.freemind.Node");
        digester.addSetProperties("*/node");
        digester.addSetNext("*/node","addChild");

        try {
            //InputStream s = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
            digester.setUseContextClassLoader(true);
            digester.parse(in);
        } catch (IOException e) {
            log.error("Error loading Freemind file. Cause: " + e.getMessage());
            return null;
        } catch (SAXException e) {
            log.error("Document is not a valid Freemind file. Cause: " + e.getMessage());
            return null;
        }

        PolicyTree tree = new PolicyTree();
        tree.setRoot(map.getPolicyTreeRoot());
        return tree;
    }
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.xml.freemind.MindMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.