]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSource.java
Allow external customization fo TG Root type URIs.
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / util / ModelTransferableGraphSource.java
index 2d0fbcfe18282dc733a8e6be4596a5c344be2bca..f0a0893eb447d40455835d39fdd41cc40d6e3c5f 100644 (file)
@@ -396,10 +396,13 @@ public class ModelTransferableGraphSource implements TransferableGraphSource {
 
                // Declare internal and external roots
                for(RootSpec r : configuration.roots) {
-                       Resource type = graph.getPossibleType(r.resource, L0.Entity);
-                       if(type == null) type = L0.Entity;
+                       String typeId = r.type;
+                       if (typeId == null) {
+                               Resource type = graph.getPossibleType(r.resource, L0.Entity);
+                               typeId = type != null ? graph.getURI(type) : Layer0.URIs.Entity;
+                       }
                        int id = state.ids.get(support.getTransientId(r.resource));
-                       Root root = new Root(r.name, graph.getURI(type));
+                       Root root = new Root(r.name, typeId);
                        Identity rootId = new Identity(id,root);
                        internalMap.put(id, rootId);
                        procedure.execute(rootId);