]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java
Layer0Utils.claimAdaptedValue does not support type adapting
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / util / Layer0Utils.java
index 08dd63ce0e25c4bf11084bc8402eb802cd51a49d..936eb58126f0b30563406cd404e1872889d54759 100644 (file)
@@ -569,16 +569,16 @@ public class Layer0Utils {
 
        }
 
-       public static void claimAdaptedValue(WriteGraph graph, Resource objectResource, Object value, Binding binding, Datatype datatype) throws DatabaseException {
+       public static void claimAdaptedValue(WriteGraph graph, Resource objectResource, Object value, Binding binding, Datatype targetDatatype) throws DatabaseException {
 
                try {
 
-                       Datatype source = binding.type();
-                       if(source.equals(datatype)) {
+                       Datatype sourceDatatype = binding.type();
+                       if(sourceDatatype.equals(targetDatatype)) {
                                graph.claimValue(objectResource, value, binding);
                        } else {
-                               Binding target = Bindings.getBinding(datatype);
-                               Adapter adapter = Bindings.getAdapter(binding, target);
+                               Binding target = Bindings.getBinding(targetDatatype);
+                               Adapter adapter = Bindings.getTypeAdapter(binding, target);
                                graph.claimValue(objectResource, adapter.adapt(value), target);
                        }
 
@@ -1379,11 +1379,12 @@ public class Layer0Utils {
        
     }
 
-    public static String prettyPrintResource(ReadGraph graph, Resource resource) throws Exception {
+    public static String prettyPrintResource(ReadGraph graph, Resource resource, boolean ignoreIdentifiers) throws Exception {
         TransferableGraphSource source = makeTGSource(graph, resource);
         TransferableGraph1 tg = TransferableGraphs.create(graph, source);
         GraphRefactoringUtils.fixOntologyExport(tg);
-        return PrettyPrintTG.print(tg);
+        System.out.println("Printing resoure " + graph.getURI(resource));
+        return PrettyPrintTG.print(tg, ignoreIdentifiers);
     }
 
 }