]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling/src/org/simantics/modeling/adapters/CompositeCopyHandler.java
Clean up and support internal seed resources in tg export
[simantics/platform.git] / bundles / org.simantics.modeling / src / org / simantics / modeling / adapters / CompositeCopyHandler.java
index 6167334fdd79815ad98a60cb1db1762d611a116f..8c91852cdd83b143189290654b0fa814f4b7fa79 100644 (file)
@@ -26,7 +26,8 @@ import org.simantics.db.function.DbConsumer;
 import org.simantics.db.layer0.adapter.SubgraphExtent.ExtentStatus;
 import org.simantics.db.layer0.adapter.impl.DefaultCopyHandler;
 import org.simantics.db.layer0.util.TransferableGraphConfiguration2;
-import org.simantics.db.layer0.util.TransferableGraphConfiguration2.RootSpec;
+import org.simantics.db.layer0.util.TransferableGraphConfiguration2.SeedSpec;
+import org.simantics.db.layer0.util.TransferableGraphConfiguration2.SeedSpec.SeedSpecType;
 import org.simantics.diagram.stubs.DiagramResource;
 import org.simantics.layer0.Layer0;
 import org.simantics.modeling.ModelingResources;
@@ -59,7 +60,7 @@ public class CompositeCopyHandler extends DefaultCopyHandler {
                 ? (Set<Resource>) resources : new HashSet<>(resources);
         Set<Resource> exclusions = new HashSet<>();
         Set<Resource> externals = new HashSet<>();
-        List<RootSpec> roots = new ArrayList<>();
+        List<SeedSpec> roots = new ArrayList<>();
 
         Resource indexRoot = graph.syncRequest(new PossibleIndexRoot(resources.iterator().next()));
         if(indexRoot == null) throw new DatabaseException("Composite is not part of any index root");
@@ -143,17 +144,17 @@ public class CompositeCopyHandler extends DefaultCopyHandler {
 
             // Include resource as root
             CompositeInfo info = CompositeInfo.fromResource(graph, resource);
-            roots.add(new RootSpec(resource, info.getTGName(), true, typeId(graph, L0, indexRootUri, resource)));
+            roots.add(new SeedSpec(resource, info.getTGName(), SeedSpecType.ROOT, typeId(graph, L0, indexRootUri, resource)));
             identifierExcluder.accept(resource);
             // Include components as roots
             for (Resource child : graph.sync(new ObjectsWithType(resource, L0.ConsistsOf, SR.Component))) {
                 DiagramComponentInfo cinfo = DiagramComponentInfo.fromResource(graph, info, child);
                 identifierExcluder.accept(child);
-                roots.add(new RootSpec(child, cinfo.getTGName(info), true, typeId(graph, L0, indexRootUri, child)));
+                roots.add(new SeedSpec(child, cinfo.getTGName(info), SeedSpecType.ROOT, typeId(graph, L0, indexRootUri, child)));
             }
         }
 
-        roots.add(new RootSpec(indexRoot, "%model", false));
+        roots.add(new SeedSpec(indexRoot, "%model", SeedSpecType.SPECIAL_ROOT));
 
         TransferableGraphConfiguration2 config = TransferableGraphConfiguration2.createWithNames2(graph, roots, exclusions, true, false);
         for (Resource external : externals)