X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.document.server%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fserver%2Frequest%2FNodeRequest.java;fp=bundles%2Forg.simantics.document.server%2Fsrc%2Forg%2Fsimantics%2Fdocument%2Fserver%2Frequest%2FNodeRequest.java;h=50c8827efdf73d4cb7e238cac0a169de61462120;hb=3850fec72035293b9a4ede780d01aedc5fbc9056;hp=d9418db9947d482fecd4daf547d85359363bea5c;hpb=1e957fc9da518f3bef8a2c19cad72772087e1b6a;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodeRequest.java b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodeRequest.java index d9418db99..50c8827ef 100644 --- a/bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodeRequest.java +++ b/bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodeRequest.java @@ -17,60 +17,27 @@ public class NodeRequest extends VariableRead { public static final String ERRORS = "Errors"; public static final String PROPERTY_VALUE_EXCEPTIONS = "_PropertyValueExceptions"; - - public NodeRequest(Variable node) { - super(node); - } - @SuppressWarnings("unchecked") - @Override - public JSONObject perform(ReadGraph graph) throws DatabaseException { - - long s = System.nanoTime(); - - Pair> attribs = graph.syncRequest(new AttributesRequest(variable)); - - JSONObject staticContent = attribs.first; - if(attribs.second.isEmpty()) { - - if(DocumentRequest.PROFILE) { - long dura = System.nanoTime()-s; - if(dura > DocumentRequest.PROFILE_THRESHOLD_NODEREQUEST * 1e3) { - System.err.println("NodeRequest " + System.identityHashCode(this) + " in " + 1e-6*dura + "ms. " + variable.getURI(graph)); - } - } - - return staticContent; - } - - Map dynamicContent = graph.syncRequest(new NodeRequestDynamic(variable)); - if(dynamicContent.isEmpty()) { - return staticContent; - } - - JSONObject result = staticContent.clone(); - result.add(dynamicContent); + public NodeRequest(Variable node) { + super(node); + } - if(dynamicContent.containsKey(ERRORS) || staticContent.getJSONField(ERRORS) != null) { - ArrayList errorList = new ArrayList<>(); + @SuppressWarnings("unchecked") + @Override + public JSONObject perform(ReadGraph graph) throws DatabaseException { - if(dynamicContent.containsKey(ERRORS)) - errorList.addAll((List)dynamicContent.get(ERRORS)); + long s = System.nanoTime(); - if(staticContent.getJSONField(ERRORS) != null) - errorList.addAll((List)staticContent.getJSONField(ERRORS)); + JSONObject staticContent = graph.syncRequest(new AttributesRequest(variable)); - result.addJSONField(ERRORS, errorList); - } + if(DocumentRequest.PROFILE) { + long dura = System.nanoTime()-s; + if(dura > DocumentRequest.PROFILE_THRESHOLD_NODEREQUEST * 1e3) { + System.err.println("NodeRequest " + System.identityHashCode(this) + " in " + 1e-6*dura + "ms. " + variable.getURI(graph)); + } + } - if(DocumentRequest.PROFILE) { - long dura = System.nanoTime()-s; - if(dura > DocumentRequest.PROFILE_THRESHOLD_NODEREQUEST * 1e3) { - System.err.println("NodeRequest " + System.identityHashCode(this) + " in " + 1e-6*dura + "ms. " + variable.getURI(graph)); - } - } - - return result; + return staticContent; }