]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodeRequest.java
Do not override jersey in p2.site pom.xml as release/1.43.0 is jdk8
[simantics/platform.git] / bundles / org.simantics.document.server / src / org / simantics / document / server / request / NodeRequest.java
1 package org.simantics.document.server.request;
2
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.DocumentServerUtils.AttributesRequest;
8 import org.simantics.document.server.JSONObject;
9
10 public class NodeRequest extends VariableRead<JSONObject> {
11
12     public static final String ERRORS = "Errors";
13     public static final String PROPERTY_VALUE_EXCEPTIONS = "_PropertyValueExceptions";
14
15     public NodeRequest(Variable node) {
16         super(node);
17     }
18
19     @Override
20     public JSONObject perform(ReadGraph graph) throws DatabaseException {
21         long s = DocumentRequest.PROFILE ? System.nanoTime() : 0L;
22
23         JSONObject staticContent = graph.syncRequest(new AttributesRequest(variable));
24
25         if (DocumentRequest.PROFILE) {
26             long dura = System.nanoTime()-s;
27             if (dura > DocumentRequest.PROFILE_THRESHOLD_NODEREQUEST * 1e3) {
28                 System.err.println("NodeRequest " + System.identityHashCode(this) + " in " + 1e-6*dura + "ms. " + variable.getURI(graph));
29             }
30         }
31
32         return staticContent;
33     }
34
35 }