Package eu.planets_project.pp.plato.xml

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


                    }
                }
                );
        boolean success = true;
        for (File demoFile : demoFiles) {
            ProjectImporter importer = new ProjectImporter();
            ProjectExporter exporter = new ProjectExporter();

            //
            // for xml compare, we leave the jhoveXML out. we don't compare it.
            // it changes after import, because we call jhove when importing a plan
            List<String> nodesToExclude = new ArrayList<String>();
            nodesToExclude.add("//*[name()='jhoveXML']");
            nodesToExclude.add("//*[name()='changelog']");
           
            String logText = "";
           
            try {
               
                logText = "Test plan: " + demoFile.getAbsolutePath();
                System.out.println(logText);
                log.info(logText);
               
                List<Plan> importedPlans = importer.importProjects(demoFile.getAbsolutePath());
               
                assert importedPlans.size() == 1;
               
                logText = " - organisation: "+ importedPlans.get(0).getPlanProperties().getOrganization();
               
View Full Code Here


        Assert.assertTrue(success, "At least some plans are not the same after export/import, check dir: " + outputPath);
    }
   
    private String createSortedXml(File original) {
       
        ProjectImporter importer = new ProjectImporter();
       
        String file = System.getProperties().getProperty("java.io.tmpdir") + "/sorted" + System.nanoTime() + ".xml";
       
        try {
            //File xslt = new File("data/xslt/sort.xsl");
            if (!importer.transformXmlData(original.getAbsolutePath(), file, "data/xslt/compareFilter.xsl")) {
                return "";
            }
        } catch (IOException e) {
            e.printStackTrace();
            return "";
View Full Code Here

                    }
                }
                );
        String tempPath = currentVersionPath + "migrations/";
        File tempDir = new File(tempPath);
        ProjectImporter importer = new ProjectImporter();
        for (int i = 0; i < originalFiles.length; i++) {
            tempDir.mkdirs();
            File file = originalFiles[i];
            try {
                System.out.println("migrating plan: " + file.getAbsolutePath());
                String currentFile = importer.getCurrentVersionData(
                        new FileInputStream(file), tempPath);
                if (currentFile == null) {
                    System.out.println(" - failed");
                } else {
                    File current = new File(currentFile);
View Full Code Here

                        && xmlFileName.endsWith(".xml")) {
                    log.info("Adding Case Study XML " + xmlFileName + ".");
                    InputStream in = Thread.currentThread()
                    .getContextClassLoader().getResourceAsStream(
                            xmlFileName);
                    ProjectImporter projectImporter = new ProjectImporter();
                    try {
                        for (Plan plan : projectImporter.importProjects(in)) {

                            em.persist(plan);
                            em.flush();
                        }
                    } catch (IOException e) {
View Full Code Here

                        && xmlFileName.endsWith(type+".xml")) {
                    log.info("Adding DEMO PLAN " + xmlFileName + " for user "+user.getUsername()+".");
                    InputStream in = Thread.currentThread()
                    .getContextClassLoader().getResourceAsStream(
                            xmlFileName);
                    ProjectImporter projectImporter = new ProjectImporter();
                    try {
                        for (Plan plan : projectImporter.importProjects(in)) {
                            PlanProperties pp = plan.getPlanProperties();
                            // We set the current user as the owner of the project.
                            if (user == null) {
                                log.error("user is null! why?");
                            } else {
View Full Code Here

TOP

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

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.