]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/internal/XSupportImpl.java
DB query swapping to file system
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / internal / XSupportImpl.java
index 1e8d2731ff4bb65bc47983d5f162412882e636c7..7a9be048055fdcff23e9831a2882917d2d5ede6d 100644 (file)
@@ -1,5 +1,7 @@
 package fi.vtt.simantics.procore.internal;
 
+import java.io.IOException;
+
 import org.simantics.db.Database;
 import org.simantics.db.Resource;
 import org.simantics.db.Session;
@@ -16,6 +18,7 @@ import org.simantics.db.request.WriteTraits;
 import org.simantics.db.service.ClusterUID;
 import org.simantics.db.service.SerialisationSupport;
 import org.simantics.db.service.XSupport;
+import org.simantics.utils.datastructures.Pair;
 
 public class XSupportImpl implements XSupport {
     final private boolean DEBUG = false;
@@ -112,6 +115,12 @@ public class XSupportImpl implements XSupport {
                session.clusterSetsSupport.clear();
         }
     }
+    
+    @Override
+    public Pair<Boolean, Boolean> getServiceMode() {
+       return Pair.make((session.serviceMode & 1) == 1, (session.serviceMode & 2) == 2);
+    }
+    
     @Override
     public Resource convertDelayedResourceToResource(Resource resource) {
         return DelayedWriteGraph.convertDelayedResource(resource);
@@ -162,4 +171,20 @@ public class XSupportImpl implements XSupport {
     public boolean rolledback() {
         return session.graphSession.rolledback();
     }
+
+       @Override
+       public boolean isClusterLoaded(ClusterUID clusterUID) throws DatabaseException {
+               ClusterImpl clusterImpl = session.clusterTable.getClusterByClusterUIDOrMakeProxy(clusterUID);
+               return clusterImpl.isLoaded();
+       }
+
+    @Override
+    public void saveQueries() throws DatabaseException {
+        try {
+            session.queryProvider2.save();
+        } catch (IOException e) {
+            throw new DatabaseException(e);
+        }
+    }
+
 }