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%2FModelTransferableGraphSource.java;h=f0a0893eb447d40455835d39fdd41cc40d6e3c5f;hp=e7fa24124a2ca1a72fca4955d320e385b87368de;hb=22703b9675e377d3620fb5b9fe1e4c3adc18edc4;hpb=9acebe9584f8f2a78f0322b6e0e24438e7ceb984 diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSource.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSource.java index e7fa24124..f0a0893eb 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSource.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/ModelTransferableGraphSource.java @@ -228,7 +228,7 @@ public class ModelTransferableGraphSource implements TransferableGraphSource { @Override public int getIdentityCount() { - return configuration.roots.size() + state.externals.size() + 1; + return configuration.roots.size() + state.externals.size() + state.internalEntries.size() + 1; } @Override @@ -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); @@ -415,6 +418,8 @@ public class ModelTransferableGraphSource implements TransferableGraphSource { for(InternalEntry ie : state.internalEntries) { if(ie.parent != null && ie.name != null) { procedure.execute(resolveInternal(graph, support, ie, internalMap)); + } else { + throw new DatabaseException("Invalid internal entry " + ie); } } }