X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fgenericrelation%2FDependenciesRelation.java;h=4f98af7b4ab33fe4349e7bae9845fe703e728e98;hp=fc32222084c0f7e08509c152a882b893e7bd5b61;hb=0d9b90834ce56b292c00b1a39850ed842c3e4d42;hpb=e5db6157fd8722c946613d4e46d7aaf6bfa92609 diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java index fc3222208..4f98af7b4 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/genericrelation/DependenciesRelation.java @@ -23,7 +23,6 @@ import java.util.UUID; import org.simantics.databoard.Bindings; import org.simantics.databoard.util.ObjectUtils; import org.simantics.datatypes.literal.GUID; -import org.simantics.db.AsyncReadGraph; import org.simantics.db.ChangeSet; import org.simantics.db.ChangeSet.StatementChange; import org.simantics.db.MetadataI; @@ -51,8 +50,8 @@ import org.simantics.db.layer0.genericrelation.DependencyChanges.ComponentAdditi import org.simantics.db.layer0.genericrelation.DependencyChanges.ComponentModification; import org.simantics.db.layer0.genericrelation.DependencyChanges.ComponentRemoval; import org.simantics.db.layer0.genericrelation.DependencyChanges.LinkChange; -import org.simantics.db.procedure.AsyncContextMultiProcedure; -import org.simantics.db.procedure.AsyncContextProcedure; +import org.simantics.db.procedure.SyncContextMultiProcedure; +import org.simantics.db.procedure.SyncContextProcedure; import org.simantics.db.service.CollectionSupport; import org.simantics.db.service.DirectQuerySupport; import org.simantics.db.service.GraphChangeListenerSupport; @@ -95,9 +94,9 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic class Process { final ArrayList result = new ArrayList(); - final AsyncContextMultiProcedure structure; - final AsyncContextProcedure names; - final AsyncContextProcedure type; + final SyncContextMultiProcedure structure; + final SyncContextProcedure names; + final SyncContextProcedure type; Process(ReadGraph graph, final Resource resource) throws DatabaseException { @@ -105,38 +104,38 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic final DirectQuerySupport dqs = graph.getService(DirectQuerySupport.class); final CollectionSupport cs = graph.getService(CollectionSupport.class); - names = dqs.compilePossibleRelatedValue(graph, L0.HasName, new AsyncContextProcedure() { + names = dqs.compilePossibleRelatedValue(graph, L0.HasName, new SyncContextProcedure() { @Override - public void execute(AsyncReadGraph graph, Entry entry, String name) { + public void execute(ReadGraph graph, Entry entry, String name) { entry.name = name; } @Override - public void exception(AsyncReadGraph graph, Throwable throwable) { + public void exception(ReadGraph graph, Throwable throwable) { LOGGER.error("Could not compile possible related value for resource {}", resource, throwable); } }); - type = new AsyncContextProcedure() { + type = new SyncContextProcedure() { @Override - public void execute(AsyncReadGraph graph, Entry entry, Resource type) { + public void execute(ReadGraph graph, Entry entry, Resource type) { entry.principalType = type; } @Override - public void exception(AsyncReadGraph graph, Throwable throwable) { + public void exception(ReadGraph graph, Throwable throwable) { LOGGER.error("Could not find type for resource {}", resource, throwable); } }; - structure = dqs.compileForEachObject(graph, L0.ConsistsOf, new AsyncContextMultiProcedure() { + structure = dqs.compileForEachObject(graph, L0.ConsistsOf, new SyncContextMultiProcedure() { @Override - public void execute(AsyncReadGraph graph, Resource parent, Resource child) { + public void execute(ReadGraph graph, Resource parent, Resource child) { // WORKAROUND: don't browse virtual child resources if(!child.isPersistent()) return; Entry entry = new Entry(parent, child, "", "", ""); @@ -147,11 +146,11 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic } @Override - public void finished(AsyncReadGraph graph, Resource parent) { + public void finished(ReadGraph graph, Resource parent) { } @Override - public void exception(AsyncReadGraph graph, Throwable throwable) { + public void exception(ReadGraph graph, Throwable throwable) { if (throwable instanceof NoSingleResultException) { // Ignore if (LOGGER.isDebugEnabled()) @@ -233,6 +232,7 @@ public class DependenciesRelation extends UnsupportedRelation implements Generic ArrayList result = new ArrayList(); for (Entry entry : entries) { + if(entry.name == null) continue; result.add(new Object[] { ss.getRandomAccessId(entry.parent), ss.getRandomAccessId(entry.resource), entry.name, entry.types, entry.id }); } return result;