]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Fixed index query and ontology search request behavior 49/249/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 4 Jan 2017 13:40:04 +0000 (15:40 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Wed, 4 Jan 2017 13:40:04 +0000 (15:40 +0200)
EntityInstances.QueryIndex request did not return proper information
from its isImmutable(ReadGraph) method.

OntologiesFromLibrary in turn did not stop browsing primarily at
L0.IndexRoot instances like it should have to find ontologies.

refs #6937

Change-Id: I262684fdeeee97913308a5aa096a9ea254dbd607

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java
bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/OntologiesFromLibrary.java

index ef5acc97b438d1b06ed627c3c6269a2c3b57af3a..488545c5fec781c80876b9cf7035f8b0eed31c06 100644 (file)
@@ -127,11 +127,10 @@ public class EntityInstances implements Instances {
                return "QueryIndex " + parameter + " " + parameter2 + " " + parameter3;
         }
 
-               @Override
-               public boolean isImmutable(ReadGraph graph) throws DatabaseException {
-                       // TODO Auto-generated method stub
-                       return false;
-               }
+        @Override
+        public boolean isImmutable(ReadGraph graph) throws DatabaseException {
+            return graph.isImmutable(parameter);
+        }
 
                @Override
                public int getType() {
index c715a6401aaa5c52f2329ac4ce808e746d052b72..774c6465a3a327e0da60b73c97a9a645291b6554 100644 (file)
@@ -19,6 +19,7 @@ import org.simantics.db.Resource;
 import org.simantics.db.common.request.ObjectsWithType;
 import org.simantics.db.common.request.ResourceRead;
 import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.request.RequestFlags;
 import org.simantics.layer0.Layer0;
 
 public class OntologiesFromLibrary extends ResourceRead<List<Resource>> {
@@ -32,12 +33,20 @@ public class OntologiesFromLibrary extends ResourceRead<List<Resource>> {
         Layer0 L0 = Layer0.getInstance(graph);
         ArrayList<Resource> result = new ArrayList<Resource>();
         for(Resource r : graph.syncRequest(new ObjectsWithType(resource, L0.ConsistsOf, L0.Library))) {
-            if(graph.isInstanceOf(r, L0.Ontology))
-                result.add(r);
-            else
+            if(graph.isInstanceOf(r, L0.IndexRoot)) {
+                if(graph.isInstanceOf(r, L0.Ontology)) {
+                    result.add(r);
+                }
+            } else {
                 result.addAll(graph.syncRequest(new OntologiesFromLibrary(r)));
+            }
         }
         return result;
     }
 
+    @Override
+    public int getType() {
+        return RequestFlags.IMMEDIATE_UPDATE;
+    }
+
 }