From ab914ca281bc4cfb6f8b7a9a38956c71fbd66839 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Wed, 4 Jan 2017 15:40:04 +0200 Subject: [PATCH] Fixed index query and ontology search request behavior 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 --- .../db/layer0/adapter/impl/EntityInstances.java | 9 ++++----- .../layer0/migration/OntologiesFromLibrary.java | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java index ef5acc97b..488545c5f 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/adapter/impl/EntityInstances.java @@ -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() { diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/OntologiesFromLibrary.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/OntologiesFromLibrary.java index c715a6401..774c6465a 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/OntologiesFromLibrary.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/migration/OntologiesFromLibrary.java @@ -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> { @@ -32,12 +33,20 @@ public class OntologiesFromLibrary extends ResourceRead> { Layer0 L0 = Layer0.getInstance(graph); ArrayList result = new ArrayList(); 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; + } + } -- 2.47.1