Package eu.planets_project.pp.plato.model.tree

Examples of eu.planets_project.pp.plato.model.tree.LibraryTree


public class LibraryExportTest {

    @Test
    public void testExportImport() throws Exception{
        LibraryTree lib = new LibraryTree();
        lib.addMainRequirements();
        lib.getRoot().setDescription("This is a description");
        Leaf c = new Leaf();
        c.setName("ImageWidth");
        MeasurementInfo mInfo = new MeasurementInfo();
        mInfo.fromUri("xcl://imageWidth#equal");
        c.setMeasurementInfo(mInfo);
        ((LibraryRequirement)lib.getRoot().getChildren().get(0).getChildren().get(0)).addChild(c);
       
        LibraryExport export = new LibraryExport();
        File exported = new File ("test-data/lib_export.xml");
        export.exportToStream(lib, new FileOutputStream(exported));
       
View Full Code Here


    public void setLib(LibraryTree lib) {
        this.lib = lib;
    }
   
    public LibraryTree importFromStream(InputStream inthrows IOException, SAXException {
        lib = new LibraryTree();
        Digester d = new Digester();
       
        d.push(lib);
        d.addSetProperties("library");
View Full Code Here

        }
       
        LibraryExport imp = new LibraryExport();
       
        try {
            LibraryTree newLib = imp.importFromStream(new ByteArrayInputStream(file));
            // at the moment we only support one Library definition
            newLib.setName("mainlibrary");
           
            // delete existing library
            LibraryTree oldLib = null;
            List<LibraryTree> trees = null;
            trees = em.createQuery("select l from LibraryTree l where (l.name = 'mainlibrary') ").getResultList();
            if ((trees != null) && (trees.size() > 0)) {
                oldLib = trees.get(0);
            }
View Full Code Here

        }
        return null;
    }
   
    public String exportLibrary() {
        LibraryTree lib = null;
        List<LibraryTree> trees = null;
        trees = em.createQuery("select l from LibraryTree l where (l.name = 'mainlibrary') ").getResultList();
        if ((trees != null) && (trees.size() > 0)) {
            lib = trees.get(0);
        }
View Full Code Here

        log.info("Calling init of RequirementsExpert");
       
        List<LibraryTree> trees = null;
        trees = em.createQuery("select l from LibraryTree l where (l.name = 'mainlibrary') ").getResultList();
        if ((trees == null) || (trees.size() == 0)) {
            libraryTree = new LibraryTree();
            libraryTree.addMainRequirements();
            libraryTree.setName("mainlibrary");
        } else {
            libraryTree = trees.get(0);
        }
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.model.tree.LibraryTree

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.