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%2Futil%2FConsistsOfProcess.java;fp=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Futil%2FConsistsOfProcess.java;h=55fe1ac0111f008f90c3d0b816720b01ce34ce03;hp=75c75764adb2b5668ef0e8736818cf4718cb6fa9;hb=0d9b90834ce56b292c00b1a39850ed842c3e4d42;hpb=e5db6157fd8722c946613d4e46d7aaf6bfa92609 diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ConsistsOfProcess.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ConsistsOfProcess.java index 75c75764a..55fe1ac01 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ConsistsOfProcess.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ConsistsOfProcess.java @@ -6,7 +6,7 @@ import java.util.HashSet; import java.util.List; import java.util.Set; -import org.simantics.db.AsyncReadGraph; +import org.simantics.databoard.Bindings; import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.ResourceMap; @@ -16,8 +16,7 @@ import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.adapter.SubgraphExtent.ExtentStatus; import org.simantics.db.layer0.util.TransferableGraphConfiguration2.SeedSpec; import org.simantics.db.layer0.util.TransferableGraphConfiguration2.SeedSpec.SeedSpecType; -import org.simantics.db.procedure.AsyncContextMultiProcedure; -import org.simantics.db.procedure.Procedure; +import org.simantics.db.procedure.SyncContextMultiProcedure; import org.simantics.db.service.DirectQuerySupport; import org.simantics.layer0.Layer0; import org.simantics.utils.datastructures.Pair; @@ -26,8 +25,8 @@ class ConsistsOfProcess { final List result; final Set childrenWithNoName; - final AsyncContextMultiProcedure structure; - final AsyncContextMultiProcedure names; + final SyncContextMultiProcedure structure; + final SyncContextMultiProcedure names; public static Pair,Set> walk(ReadGraph graph, Collection specs, boolean ignoreVirtual) throws DatabaseException { return walk(graph, null, specs, ignoreVirtual); @@ -58,44 +57,35 @@ class ConsistsOfProcess { result = new ArrayList<>(); childrenWithNoName = new HashSet<>(); - names = dqs.compileForEachObject(graph, L0.HasName, new AsyncContextMultiProcedure() { + names = dqs.compileForEachObject(graph, L0.HasName, new SyncContextMultiProcedure() { @Override - public void execute(AsyncReadGraph graph, ConsistsOfProcessEntry entry, Resource nameResource) { + public void execute(ReadGraph graph, ConsistsOfProcessEntry entry, Resource nameResource) throws DatabaseException { if(status != null) status.put(nameResource, ExtentStatus.EXCLUDED); - graph.forPossibleValue(nameResource, new Procedure() { - - @Override - public void execute(String name) { - if(!entry.valid) return; - - if(name == null) { - entry.valid = false; - } else if (entry.name != null) { - entry.valid = false; - } else { - entry.name = name; - } - } + if(!entry.valid) return; + + String name = graph.getValue(nameResource, Bindings.STRING); + if(name == null) { + entry.valid = false; + } else if (entry.name != null) { + entry.valid = false; + } else { + entry.name = name; + } - @Override - public void exception(Throwable t) { - Logger.defaultLogError(t); - } - - }); + } @Override - public void exception(AsyncReadGraph graph, Throwable throwable) { + public void exception(ReadGraph graph, Throwable throwable) { Logger.defaultLogError(throwable); } @Override - public void finished(AsyncReadGraph graph, ConsistsOfProcessEntry entry) { + public void finished(ReadGraph graph, ConsistsOfProcessEntry entry) { if(entry.valid) { if(entry.name != null) { result.add(entry); @@ -110,10 +100,10 @@ class ConsistsOfProcess { } }); - structure = dqs.compileForEachObject(graph, L0.ConsistsOf, new AsyncContextMultiProcedure() { + structure = dqs.compileForEachObject(graph, L0.ConsistsOf, new SyncContextMultiProcedure() { @Override - public void execute(AsyncReadGraph graph, ConsistsOfProcessEntry parent, Resource child) { + public void execute(ReadGraph graph, ConsistsOfProcessEntry parent, Resource child) { if(status != null) if(ExtentStatus.EXCLUDED.equals(status.get(child))) return; @@ -127,11 +117,11 @@ class ConsistsOfProcess { } @Override - public void finished(AsyncReadGraph graph, ConsistsOfProcessEntry parent) { + public void finished(ReadGraph graph, ConsistsOfProcessEntry parent) { } @Override - public void exception(AsyncReadGraph graph, Throwable throwable) { + public void exception(ReadGraph graph, Throwable throwable) { Logger.defaultLogError(throwable); }