X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph.db%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fdb%2FTransferableGraphs.java;h=4d5cc7e3c3a4eac99cb60c150fd2936130bed05b;hp=edcbc51d86499597619ee29b504de0bd087f2d19;hb=9acebe9584f8f2a78f0322b6e0e24438e7ceb984;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07 diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java index edcbc51d8..4d5cc7e3c 100644 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java +++ b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphs.java @@ -62,11 +62,14 @@ import org.simantics.graph.representation.Identity; import org.simantics.graph.representation.TransferableGraph1; import org.simantics.graph.representation.Value; import org.simantics.utils.datastructures.BinaryFunction; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import gnu.trove.list.array.TIntArrayList; import gnu.trove.map.hash.TObjectIntHashMap; public class TransferableGraphs { + final static Logger LOGGER = LoggerFactory.getLogger(TransferableGraphs.class); public static long[] importGraph(Session session, Object tg, IImportAdvisor advisor) throws DatabaseException, TransferableGraphException { if (tg instanceof TransferableGraph1) @@ -170,15 +173,15 @@ public class TransferableGraphs { }); } - public static void importGraph1(Session session, final TransferableGraphSource tg, IImportAdvisor advisor) throws Exception { - importGraph1(session, tg, advisor, null); + public static ImportResult importGraph1(Session session, final TransferableGraphSource tg, IImportAdvisor advisor) throws Exception { + return importGraph1(session, tg, advisor, null); } - public static void importGraph1(Session session, final TransferableGraphSource tg, IImportAdvisor advisor, TGStatusMonitor monitor) throws DatabaseException { - importGraph1(session, null, tg, advisor, monitor); + public static ImportResult importGraph1(Session session, final TransferableGraphSource tg, IImportAdvisor advisor, TGStatusMonitor monitor) throws DatabaseException { + return importGraph1(session, null, tg, advisor, monitor); } - public static void importGraph1(Session session, VirtualGraph vg, final TransferableGraphSource tg, IImportAdvisor advisor_, TGStatusMonitor monitor) throws DatabaseException { + public static ImportResult importGraph1(Session session, VirtualGraph vg, final TransferableGraphSource tg, IImportAdvisor advisor_, TGStatusMonitor monitor) throws DatabaseException { final IImportAdvisor2 advisor = (advisor_ instanceof IImportAdvisor2) ? ((IImportAdvisor2)advisor_) : new WrapperAdvisor(advisor_); @@ -207,6 +210,8 @@ public class TransferableGraphs { } } }); + + return new ImportResult(process.missingExternals); } public static void importGraph1WithMonitor(Session session, final TransferableGraph1 tg, IImportAdvisor advisor_, TGStatusMonitor monitor) throws DatabaseException { @@ -579,7 +584,7 @@ public class TransferableGraphs { }); long end = System.nanoTime(); - System.err.println("Wrote transferable graph in " + 1e-9*(end-start) + " seconds."); + LOGGER.info("Wrote transferable graph in {} seconds.", 1e-9*(end-start)); } public static TransferableGraph1 create(ReadGraph graph, TransferableGraphSource source) throws DatabaseException {