Package eu.planets_project.pp.plato.xml

Examples of eu.planets_project.pp.plato.xml.LibraryExport


        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));
       
        lib = export.importFromStream(new FileInputStream(exported));
        File reExported = new File(exported + "_out.xml");
        export.exportToStream(lib, new FileOutputStream(reExported));
       
        if (Arrays.equals(FileUtils.getBytesFromFile(exported), FileUtils.getBytesFromFile(reExported))) {
            // they are equal, remove the exported plan
            exported.delete();
            reExported.delete();
View Full Code Here


            FacesMessages.instance().add(FacesMessage.SEVERITY_ERROR,
                    "Please select a Library-export file.");
            return null;
        }
       
        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;
View Full Code Here

           
            String binarydataTempPath = OS.getTmpPath() + "RequirementsLibrary-" + System.currentTimeMillis() + "/";
            File binarydataTempDir = new File(binarydataTempPath);
            binarydataTempDir.mkdirs();
           
            LibraryExport exp = new LibraryExport();
            try {
                HttpServletResponse response = (HttpServletResponse)FacesContext.getCurrentInstance().getExternalContext().getResponse();
                response.setContentType("application/x-download");
                response.setHeader("Content-Disposition", "attachement; filename=\""+filename+".xml\"");
                // the length of the resulting XML file is unknown due to formatting: response.setContentLength(xml.length());
                try {
                    BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
                   
                    exp.exportToStream(lib, out);
                   
                    out.flush();
                    out.close();
   
                } catch (IOException e) {
View Full Code Here

TOP

Related Classes of eu.planets_project.pp.plato.xml.LibraryExport

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.