Layer0Utils.claimAdaptedValue does not support type adapting 62/662/1
authorjsimomaa <jani.simomaa@gmail.com>
Thu, 29 Jun 2017 05:09:43 +0000 (08:09 +0300)
committerjsimomaa <jani.simomaa@gmail.com>
Thu, 29 Jun 2017 05:09:43 +0000 (08:09 +0300)
refs #7336

Change-Id: I31cf518661eaf30dd1484bdba812c4c3b0d9db4d

bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/util/Layer0Utils.java

index 198ee41b77e060ad4cdf205e46a10038cbaa494b..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);
                        }