X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.common%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fcommon%2Frequest%2FIndexRoots.java;fp=bundles%2Forg.simantics.db.common%2Fsrc%2Forg%2Fsimantics%2Fdb%2Fcommon%2Frequest%2FIndexRoots.java;h=92746feca6868a568120f8cbf9dc9602db9e37e7;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=e7ea43a9a7549115494f7f42df1eeaab7ace6fec;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/IndexRoots.java b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/IndexRoots.java index e7ea43a9a..92746feca 100644 --- a/bundles/org.simantics.db.common/src/org/simantics/db/common/request/IndexRoots.java +++ b/bundles/org.simantics.db.common/src/org/simantics/db/common/request/IndexRoots.java @@ -1,31 +1,31 @@ -package org.simantics.db.common.request; - -import java.util.Collection; -import java.util.Collections; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.ResourceSet; -import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; -import org.simantics.db.exception.DatabaseException; -import org.simantics.db.service.CollectionSupport; -import org.simantics.layer0.Layer0; - -public class IndexRoots extends ResourceRead> { - - public IndexRoots(Resource r) { - super(r); - } - - @Override - public Collection perform(ReadGraph graph) throws DatabaseException { - Layer0 L0 = Layer0.getInstance(graph); - if (graph.isInstanceOf(resource, L0.IndexRoot)) - return Collections.singletonList(resource); - CollectionSupport cs = graph.getService(CollectionSupport.class); - ResourceSet types = cs.getResourceSet(graph, L0.IndexRoot); - ResourceSetGraph rsg = graph.syncRequest(new DependentInstances3(resource), TransientCacheAsyncListener.instance()); - return rsg.resolve(graph, types); - } - +package org.simantics.db.common.request; + +import java.util.Collection; +import java.util.Collections; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.ResourceSet; +import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener; +import org.simantics.db.exception.DatabaseException; +import org.simantics.db.service.CollectionSupport; +import org.simantics.layer0.Layer0; + +public class IndexRoots extends ResourceRead> { + + public IndexRoots(Resource r) { + super(r); + } + + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + Layer0 L0 = Layer0.getInstance(graph); + if (graph.isInstanceOf(resource, L0.IndexRoot)) + return Collections.singletonList(resource); + CollectionSupport cs = graph.getService(CollectionSupport.class); + ResourceSet types = cs.getResourceSet(graph, L0.IndexRoot); + ResourceSetGraph rsg = graph.syncRequest(new DependentInstances3(resource), TransientCacheAsyncListener.instance()); + return rsg.resolve(graph, types); + } + } \ No newline at end of file