From: Antti Villberg Date: Wed, 9 Nov 2016 10:13:36 +0000 (+0200) Subject: Use Layer0Utils.getDomainOf X-Git-Tag: v1.25.0~56 X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=commitdiff_plain;h=8eeb0657ef6613c55f5918c66618b1f4cc10a5ef Use Layer0Utils.getDomainOf The result can be cached by several uses. refs #6800 Change-Id: I65c32408b1afdc1ca96de126e7ac86c46896b250 --- diff --git a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/ReadComponentTypeInterfaceRequest.java b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/ReadComponentTypeInterfaceRequest.java index 2c2f0f7b2..8180b3f1b 100644 --- a/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/ReadComponentTypeInterfaceRequest.java +++ b/bundles/org.simantics.structural2/src/org/simantics/structural2/scl/ReadComponentTypeInterfaceRequest.java @@ -9,6 +9,7 @@ import org.simantics.db.ReadGraph; import org.simantics.db.Resource; import org.simantics.db.common.request.ResourceRead; import org.simantics.db.exception.DatabaseException; +import org.simantics.db.layer0.util.Layer0Utils; import org.simantics.layer0.Layer0; import org.simantics.scl.compiler.environment.Environment; import org.simantics.scl.compiler.environment.Environments; @@ -26,9 +27,11 @@ public class ReadComponentTypeInterfaceRequest extends ResourceRead result) throws DatabaseException { Layer0 L0 = Layer0.getInstance(graph); - for(Resource relation : graph.getObjects(t, L0.DomainOf)) { + Map domain = Layer0Utils.getDomainOf(graph, t); + for(Map.Entry entry : domain.entrySet()) { + String name = entry.getKey(); + Resource relation = entry.getValue(); if(graph.isSubrelationOf(relation, L0.HasProperty)) { - String name = graph.getRelatedValue(relation, L0.HasName, Bindings.STRING); String typeName = graph.getPossibleRelatedValue(relation, L0.RequiresValueType, Bindings.STRING); if(typeName == null) continue; Type type; @@ -52,7 +55,7 @@ public class ReadComponentTypeInterfaceRequest extends ResourceRead(); collect(graph, resource, result); - for(Resource t : graph.getSupertypes(resource)) collect(graph, t, result); + //for(Resource t : graph.getSupertypes(resource)) collect(graph, t, result); return result;