1 package org.simantics.document.server;
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.exception.DatabaseException;
5 import org.simantics.db.layer0.request.VariableRead;
6 import org.simantics.db.layer0.variable.Variable;
7 import org.simantics.document.server.request.DocumentRequest;
9 public class DocumentValue extends VariableRead<Object> {
11 public DocumentValue(Variable variable) {
16 public Object perform(ReadGraph graph) throws DatabaseException {
17 if(DocumentRequest.PROFILE) return performProfiled(graph);
18 return variable.getValue(graph);
21 public Object performProfiled(ReadGraph graph) throws DatabaseException {
22 long start = System.nanoTime();
23 Object result = variable.getValue(graph);
24 //System.err.println("DocumentValue " + result + " " + variable.getURI(graph));
25 long dura = System.nanoTime()-start;
26 if(dura > DocumentRequest.PROFILE_THRESHOLD_VALUEREQUEST * 1e3) {
27 System.err.println("DocumentValue " + System.identityHashCode(this) + " in " + 1e-6*dura + "ms. "+ variable.getURI(graph));
33 public String toString() {
34 return "DocumentValue[" + variable + "]";