]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.impl/src/org/simantics/db/impl/graph/ReadGraphImpl.java
Variable optimizations for documents (Simupedia)
[simantics/platform.git] / bundles / org.simantics.db.impl / src / org / simantics / db / impl / graph / ReadGraphImpl.java
index 3feb22e00ebda688379b6ed7c8785b09fb8035ca..2ef40c29459d4be20009b30a73f54bd85b6fb08f 100644 (file)
@@ -45,6 +45,7 @@ import org.simantics.databoard.type.Datatype;
 import org.simantics.databoard.util.binary.BinaryFile;
 import org.simantics.databoard.util.binary.RandomAccessBinary;
 import org.simantics.db.AsyncReadGraph;
+import org.simantics.db.ComputationalValue;
 import org.simantics.db.DevelopmentKeys;
 import org.simantics.db.ExternalValueSupport;
 import org.simantics.db.ReadGraph;
@@ -6102,12 +6103,18 @@ public class ReadGraphImpl implements AsyncReadGraph {
                        return getValue(r, binding);
                }
        } else if(types.contains(L0.ExternalValue)) {
-               try {
-                       return (T)ReflectionUtils.getValue(getURI(r)).getValue();
-               } catch(ValueNotFoundException e) {
-                       throw new DatabaseException(e);
-               } catch(ClassCastException e) {
-                       throw new DatabaseException(e);
+               ComputationalValue cv = syncRequest(new PossibleAdapter<ComputationalValue>(r, ComputationalValue.class), TransientCacheAsyncListener.instance());
+               if(cv != null) {
+                       return cv.getValue(this, r);
+               } else {
+                       // This should not even be possible since L0 defines an adapter for all values
+                       try {
+                               return (T)ReflectionUtils.getValue(getURI(r)).getValue();
+                       } catch(ValueNotFoundException e) {
+                               throw new DatabaseException(e);
+                       } catch(ClassCastException e) {
+                               throw new DatabaseException(e);
+                       }
                }
        }
        else {