]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graph.db/src/org/simantics/graph/db/TransferableGraphImportProcess.java
TransferableGraph import to VG with different name
[simantics/platform.git] / bundles / org.simantics.graph.db / src / org / simantics / graph / db / TransferableGraphImportProcess.java
index 586562fa34df83ef4bccdffaebe9e5a373bd90f6..3b3c78bac7039c6c7e31147de6bf06a39c084d94 100644 (file)
@@ -13,6 +13,7 @@ import org.simantics.databoard.Bindings;
 import org.simantics.databoard.accessor.error.AccessorException;
 import org.simantics.databoard.adapter.AdaptException;
 import org.simantics.databoard.binding.mutable.Variant;
+import org.simantics.databoard.util.URIStringUtils;
 import org.simantics.db.ReadGraph;
 import org.simantics.db.Resource;
 import org.simantics.db.WriteOnlyGraph;
@@ -173,7 +174,7 @@ public class TransferableGraphImportProcess implements TransferableGraphImporter
                missingExternals.add(external);
        }
        
-       void prepare(ReadGraph graph) throws DatabaseException {
+       public void prepare(ReadGraph graph) throws DatabaseException {
                findBuiltins(graph);
                
                Resource[] resources = new Resource[tg.resourceCount];
@@ -200,14 +201,14 @@ public class TransferableGraphImportProcess implements TransferableGraphImporter
                                                        if(child == null) {
                                                                String uri = graph.getPossibleURI(parent);
                                                                if(uri == null) {
-                                                                       addMissing(NameUtils.getSafeName(graph, parent) + " /" + def.name);
+                                                                       addMissing(URIStringUtils.escape(NameUtils.getSafeName(graph, parent)) + " /" + URIStringUtils.escape(def.name));
                                                                } else {
-                                                                       addMissing(graph.getURI(parent) + "/" + def.name);
+                                                                       addMissing(graph.getURI(parent) + "/" + URIStringUtils.escape(def.name));
                                                                }
                                                        }
                                                        resources[identity.resource] = child;
                                                } else {
-                                                   addMissing(TransferableGraphUtils.getURI(tg, def.parent) + "/" + def.name);
+                                                   addMissing(TransferableGraphUtils.getURI(tg, def.parent) + "/" + URIStringUtils.escape(def.name));
                                                }
                                        }
                                }
@@ -337,7 +338,7 @@ public class TransferableGraphImportProcess implements TransferableGraphImporter
                
        }
 
-       void write(WriteOnlyGraph graph) throws DatabaseException {
+       public void write(WriteOnlyGraph graph) throws DatabaseException {
 
                Resource[] resources = this.resources;