Package org.jboss.dashboard.workspace.export.structure

Examples of org.jboss.dashboard.workspace.export.structure.ImportResult


                return false;
            }

            // Load the file.
            ExportManager exportManager = UIServices.lookup().getExportManager();
            ImportResult result = exportManager.loadXML(pf.getName(), new FileInputStream(pf));
            if (result == null) {
                log.warn("Error on importation. Nothing to import");
                return false;
            }

            if (result.getException() != null) throw result.getException();
            if (result.getWarnings() != null && result.getWarnings().size() > 0) {
                for (int j = 0; j < result.getWarnings().size(); j++) {
                    log.warn("Problems importing entry " + result.getEntryName() + ": " + result.getWarnings().get(j));
                }
            }

            exportManager.create(new ImportResult[]{result}, null, true);
            return true;
View Full Code Here


        }
        return (ImportResult[]) list.toArray(new ImportResult[list.size()]);
    }

    public ImportResult loadXML(String name, InputStream is) {
        return new ImportResult(name, is);
    }
View Full Code Here

    public CreateResult[] create(ImportResult[] results, int[][] indexes, boolean onStartup) {
        List elementsToCreate = new ArrayList();
        List attributesForCreation = new ArrayList();
        if (indexes == null) {
            for (int i = 0; i < results.length; i++) {
                ImportResult result = results[i];
                elementsToCreate.addAll(result.getRootNode().getChildren());
                while (attributesForCreation.size() < elementsToCreate.size())
                    attributesForCreation.add(result.getAttributes());
            }
        } else {
            for (int i = 0; i < indexes.length; i++) {
                int[] index = indexes[i];
                if (index != null)
                    if (index.length == 1) {
                        ImportResult result = results[index[0]];
                        elementsToCreate.addAll(result.getRootNode().getChildren());
                        while (attributesForCreation.size() < elementsToCreate.size())
                            attributesForCreation.add(result.getAttributes());
                    } else if (index.length > 1) {
                        ImportResult result = results[index[0]];
                        for (int j = 1; j < index.length; j++) {
                            int idx = index[j];
                            elementsToCreate.add(result.getRootNode().getChildren().get(idx));
                            while (attributesForCreation.size() < elementsToCreate.size())
                                attributesForCreation.add(result.getAttributes());
                        }
                    }
            }
        }
        List createResults = new ArrayList();
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.workspace.export.structure.ImportResult

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.