]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/utils/StructuralUtils.java
Multiple readers and variable optimization
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / utils / StructuralUtils.java
index 9f5897f06a24d476a44d2b4424ac7d58444170a8..3181dd7c45d7ea2434eed586393a2d2c7127c5b2 100644 (file)
@@ -7,7 +7,6 @@ import java.util.List;
 import java.util.Set;
 
 import org.simantics.databoard.Bindings;
-import org.simantics.datatypes.literal.GUID;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.RequestProcessor;
 import org.simantics.db.Resource;
@@ -141,8 +140,8 @@ public class StructuralUtils {
         Resource component = ir.perform(g);        
         g.claim(component, L0.HasName, Layer0Utils.literal(g, name));
         g.claim(component, L0.HasLabel, Layer0Utils.literal(g, ""));
-        g.addLiteral(component, L0.identifier, L0.identifier_Inverse, L0.GUID, GUID.random(), GUID.BINDING);
         g.claim(parent, L0.ConsistsOf, component);
+        Layer0Utils.claimNewIdentifier(g, component, true);
         // Add comment to change set.
         CommentMetadata cm = g.getMetadata(CommentMetadata.class);
         g.addMetadata(cm.add("Created component " + component));
@@ -266,7 +265,7 @@ public class StructuralUtils {
        if(property == null) return null;
        Connection conn = property.getPossibleValue(graph);
        if(conn == null) return null;
-       Collection<Variable> cps = conn.getConnectionPoints(graph, null);
+       Collection<Variable> cps = conn.getConnectionPoints(graph, component, null);
        if(cps.size() == 2) {
                for(Variable var : cps) {
                        if(property.equals(var)) continue;
@@ -288,8 +287,8 @@ public class StructuralUtils {
                 ;
     }
     
-    public static List<Variable> structuralConnectionConnectionPoints(ReadGraph graph, Connection conn, Resource relationType) throws DatabaseException {
-       return new ArrayList<Variable>(conn.getConnectionPoints(graph, relationType));
+    public static List<Variable> structuralConnectionConnectionPoints(ReadGraph graph, Variable component, Connection conn, Resource relationType) throws DatabaseException {
+       return new ArrayList<Variable>(conn.getConnectionPoints(graph, component, relationType));
     }
 
 }