Previously the installed feature group update code was only executed
when the workspace was first initialized. This does work when new
features are installed into Simantics programs running on existing
workspaces.
refs #7005
Change-Id: I5879c398c966dc5d0e15344569b37610703d5e51
import org.simantics.db.layer0.variable.VariableRepository;
import org.simantics.db.management.SessionContext;
import org.simantics.db.request.Read;
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;
import org.simantics.db.service.LifecycleSupport.LifecycleListener;
import org.simantics.db.service.LifecycleSupport.LifecycleState;
import org.simantics.db.service.QueryControl;
}
throw new PlatformException(sb.toString());
}
}
throw new PlatformException(sb.toString());
}
List<GraphBundle> sortedBundles = analyzer.getSortedGraphs();
if(!sortedBundles.isEmpty()) {
List<GraphBundle> 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;
});
boolean mergedOntologies = false;
-
- 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)
});
if (mergedOntologies)
Collection<GroupReference> groupsWithoutVersion = GroupReference.stripVersions(publishedFeatureGroups);
try {
Collection<GroupReference> 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);
throw new PlatformException("Failed to install features", ae);
}
progressMonitor.worked(10);
installProject = assertProject(progressMonitor, workspacePolicy, installProject);
// 6. Install all features into project, if in debug mode
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
TimeLogger.log("Installed all features into project");
// 7. Assert L0.Session in database for this session
session.getService(XSupport.class).setServiceMode(false, false);
try {
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) {
});
TimeLogger.log("Flushed queries");
} catch (DatabaseException e) {