X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics%2Fsrc%2Forg%2Fsimantics%2FSimanticsPlatform.java;h=54b96054719e993986a7ab6ad2e938b67fc0e430;hp=91c34f0c788f59f4a35984aa764d184ad2d95f9f;hb=8d11ebc5a0d82e3e602d521d29a29e5cd78bc2a1;hpb=1dd02a0d0e604a82e67f04559e213db76c9ebac5 diff --git a/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java b/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java index 91c34f0c7..54b960547 100644 --- a/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java +++ b/bundles/org.simantics/src/org/simantics/SimanticsPlatform.java @@ -79,6 +79,7 @@ import org.simantics.db.layer0.util.TGTransferableGraphSource; import org.simantics.db.layer0.variable.VariableRepository; import org.simantics.db.management.SessionContext; import org.simantics.db.request.Read; +import org.simantics.db.request.Write; import org.simantics.db.service.LifecycleSupport.LifecycleListener; import org.simantics.db.service.LifecycleSupport.LifecycleState; import org.simantics.db.service.QueryControl; @@ -397,21 +398,18 @@ public class SimanticsPlatform implements LifecycleListener { } throw new PlatformException(sb.toString()); } - + List sortedBundles = analyzer.getSortedGraphs(); if(!sortedBundles.isEmpty()) { - - session.syncRequest(new WriteRequest() { - @Override - public void perform(WriteGraph graph) throws DatabaseException { - try { - graph.newClusterSet(graph.getRootLibrary()); - } catch (ClusterSetExistException e) { - // Cluster set exist already, no problem. - } - graph.setClusterSet4NewResource(graph.getRootLibrary()); - graph.flushCluster(); + + session.syncRequest((Write) graph -> { + try { + graph.newClusterSet(graph.getRootLibrary()); + } catch (ClusterSetExistException e) { + // Cluster set exist already, no problem. } + graph.setClusterSet4NewResource(graph.getRootLibrary()); + graph.flushCluster(); }); boolean mergedOntologies = false; @@ -469,13 +467,10 @@ public class SimanticsPlatform implements LifecycleListener { } } } - - session.syncRequest(new WriteRequest() { - @Override - public void perform(WriteGraph graph) throws DatabaseException { - graph.setClusterSet4NewResource(graph.getRootLibrary()); - graph.flushCluster(); - } + + session.syncRequest((Write) graph -> { + graph.setClusterSet4NewResource(graph.getRootLibrary()); + graph.flushCluster(); }); if (mergedOntologies) @@ -582,15 +577,10 @@ public class SimanticsPlatform implements LifecycleListener { Collection groupsWithoutVersion = GroupReference.stripVersions(publishedFeatureGroups); try { - Transaction.startTransaction(session, true); - try { - Projects.setProjectInstalledGroups(writeGraph(), projectResource, groupsWithoutVersion); - Transaction.commit(); - } finally { - Transaction.endTransaction(); - } - //session.getService( LifecycleSupport.class ).save(); - } catch(DatabaseException ae) { + session.syncRequest( + (Write) graph -> + Projects.setProjectInstalledGroups(graph, projectResource, groupsWithoutVersion)); + } catch (DatabaseException ae) { throw new PlatformException("Failed to install features", ae); } progressMonitor.worked(10); @@ -854,7 +844,7 @@ public class SimanticsPlatform implements LifecycleListener { installProject = assertProject(progressMonitor, workspacePolicy, installProject); // 6. Install all features into project, if in debug mode - updateInstalledGroups(progressMonitor, installProject); + updateInstalledGroups(progressMonitor, true); //installProject); TimeLogger.log("Installed all features into project"); // 7. Assert L0.Session in database for this session @@ -863,14 +853,9 @@ public class SimanticsPlatform implements LifecycleListener { session.getService(XSupport.class).setServiceMode(false, false); try { - session.sync(new WriteRequest() { - - @Override - public void perform(WriteGraph graph) throws DatabaseException { - QueryControl qc = graph.getService(QueryControl.class); - qc.flush(graph); - } - + session.syncRequest((Write) graph -> { + QueryControl qc = graph.getService(QueryControl.class); + qc.flush(graph); }); TimeLogger.log("Flushed queries"); } catch (DatabaseException e) {