X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.graph.db%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fdb%2Fold%2FOldTransferableGraphs.java;h=4786abd3b6d30aaa8ea0250e09a814c280cf9e0f;hb=f03893d9b643eae3f03debf7a656edbfa5b9b501;hp=10794a189afe809bed38c323815255900a03d558;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphs.java b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphs.java index 10794a189..4786abd3b 100644 --- a/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphs.java +++ b/bundles/org.simantics.graph.db/src/org/simantics/graph/db/old/OldTransferableGraphs.java @@ -1,56 +1,57 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.graph.db.old; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Session; -import org.simantics.db.WriteGraph; -import org.simantics.db.WriteOnlyGraph; -import org.simantics.db.common.request.ReadRequest; -import org.simantics.db.common.request.WriteOnlyRequest; -import org.simantics.db.exception.DatabaseException; -import org.simantics.graph.db.IImportAdvisor; -import org.simantics.graph.db.ImportAdvisor; -import org.simantics.graph.db.TransferableGraphException; -import org.simantics.graph.representation.old.OldTransferableGraph1; -import org.simantics.utils.datastructures.BinaryFunction; - -public class OldTransferableGraphs { - - public static void importGraph1(Session session, final OldTransferableGraph1 tg, IImportAdvisor advisor, final BinaryFunction callback) throws DatabaseException, TransferableGraphException { - final OldTransferableGraphImportProcess1 process = new OldTransferableGraphImportProcess1(tg, - advisor == null ? new ImportAdvisor() : advisor); - session.syncRequest(new ReadRequest() { - @Override - public void run(ReadGraph graph) throws DatabaseException { - process.prepare(graph); - } - }); - session.syncRequest(new WriteOnlyRequest() { - @Override - public void perform(WriteOnlyGraph graph) throws DatabaseException { - process.write(graph); - if(callback != null) - callback.call(graph, process); - } - }); - } - - public static void importGraph1(WriteGraph graph, final OldTransferableGraph1 tg, IImportAdvisor advisor) throws DatabaseException { - final OldTransferableGraphImportProcess1 process = new OldTransferableGraphImportProcess1(tg, - advisor == null ? new ImportAdvisor() : advisor); - process.prepare(graph); - process.write2(graph); - - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.graph.db.old; + +import java.util.function.BiFunction; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Session; +import org.simantics.db.WriteGraph; +import org.simantics.db.WriteOnlyGraph; +import org.simantics.db.common.request.ReadRequest; +import org.simantics.db.common.request.WriteOnlyRequest; +import org.simantics.db.exception.DatabaseException; +import org.simantics.graph.db.IImportAdvisor; +import org.simantics.graph.db.ImportAdvisor; +import org.simantics.graph.db.TransferableGraphException; +import org.simantics.graph.representation.old.OldTransferableGraph1; + +public class OldTransferableGraphs { + + public static void importGraph1(Session session, final OldTransferableGraph1 tg, IImportAdvisor advisor, final BiFunction callback) throws DatabaseException, TransferableGraphException { + final OldTransferableGraphImportProcess1 process = new OldTransferableGraphImportProcess1(tg, + advisor == null ? new ImportAdvisor() : advisor); + session.syncRequest(new ReadRequest() { + @Override + public void run(ReadGraph graph) throws DatabaseException { + process.prepare(graph); + } + }); + session.syncRequest(new WriteOnlyRequest() { + @Override + public void perform(WriteOnlyGraph graph) throws DatabaseException { + process.write(graph); + if(callback != null) + callback.apply(graph, process); + } + }); + } + + public static void importGraph1(WriteGraph graph, final OldTransferableGraph1 tg, IImportAdvisor advisor) throws DatabaseException { + final OldTransferableGraphImportProcess1 process = new OldTransferableGraphImportProcess1(tg, + advisor == null ? new ImportAdvisor() : advisor); + process.prepare(graph); + process.write2(graph); + + } + +}