]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.server/src/org/simantics/document/server/request/NodeRequestDynamic.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.document.server / src / org / simantics / document / server / request / NodeRequestDynamic.java
index 299608f569c2d7bd17239486902ee76eb7fef5bf..91b4d9e9708145cc9edff780b82852a2f4b7e38c 100644 (file)
@@ -1,65 +1,65 @@
-package org.simantics.document.server.request;\r
-\r
-import gnu.trove.map.hash.THashMap;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.request.VariableRead;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.document.base.ontology.DocumentationResource;\r
-import org.simantics.document.server.DocumentServerUtils;\r
-import org.simantics.structural.stubs.StructuralResource2;\r
-\r
-class NodeRequestDynamic extends VariableRead<Map<String,Object>> {\r
-\r
-       public NodeRequestDynamic(Variable node) {\r
-               super(node);\r
-       }\r
-\r
-       @Override\r
-       public Map<String,Object> perform(ReadGraph graph) throws DatabaseException {\r
-\r
-               long s = System.nanoTime();\r
-\r
-               StructuralResource2.getInstance(graph);\r
-               DocumentationResource DOC = DocumentationResource.getInstance(graph);\r
-\r
-               Collection<Variable> attributes = DocumentServerUtils.getDynamicAttributes(graph, DOC, variable);\r
-               if(attributes.isEmpty()) return Collections.emptyMap();\r
-               \r
-               Map<String,Object> result = new THashMap<String,Object>();\r
-               for(Variable attrib : attributes) {\r
-                       String name = attrib.getName(graph);\r
-                       try {\r
-                           Object value = DocumentServerUtils.getValue(graph, attrib);\r
-                           result.put(name, value);\r
-                       } catch (Throwable t) {\r
-                @SuppressWarnings("unchecked")\r
-                List<String> errorList = (List<String>) result.get(NodeRequest.ERRORS);\r
-                if(errorList == null)\r
-                    errorList = new ArrayList<String>();\r
-                \r
-                   String errorMessage = NodeRequestUtils.formatErrorMessage(name, t);                \r
-                \r
-                errorList.add(errorMessage);\r
-                result.put(NodeRequest.ERRORS, errorList);\r
-                       }\r
-\r
-               }\r
-\r
-        if(DocumentRequest.PROFILE) {\r
-               long dura = System.nanoTime()-s;\r
-               System.err.println("NodeRequestDynamic " + System.identityHashCode(this) + " " + variable.getURI(graph) + " in " + 1e-6*dura + "ms." + result);\r
-        }\r
-\r
-               return result;\r
-\r
-       }               \r
-\r
+package org.simantics.document.server.request;
+
+import gnu.trove.map.hash.THashMap;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.request.VariableRead;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.document.base.ontology.DocumentationResource;
+import org.simantics.document.server.DocumentServerUtils;
+import org.simantics.structural.stubs.StructuralResource2;
+
+class NodeRequestDynamic extends VariableRead<Map<String,Object>> {
+
+       public NodeRequestDynamic(Variable node) {
+               super(node);
+       }
+
+       @Override
+       public Map<String,Object> perform(ReadGraph graph) throws DatabaseException {
+
+               long s = System.nanoTime();
+
+               StructuralResource2.getInstance(graph);
+               DocumentationResource DOC = DocumentationResource.getInstance(graph);
+
+               Collection<Variable> attributes = DocumentServerUtils.getDynamicAttributes(graph, DOC, variable);
+               if(attributes.isEmpty()) return Collections.emptyMap();
+               
+               Map<String,Object> result = new THashMap<String,Object>();
+               for(Variable attrib : attributes) {
+                       String name = attrib.getName(graph);
+                       try {
+                           Object value = DocumentServerUtils.getValue(graph, attrib);
+                           result.put(name, value);
+                       } catch (Throwable t) {
+                @SuppressWarnings("unchecked")
+                List<String> errorList = (List<String>) result.get(NodeRequest.ERRORS);
+                if(errorList == null)
+                    errorList = new ArrayList<String>();
+                
+                   String errorMessage = NodeRequestUtils.formatErrorMessage(name, t);                
+                
+                errorList.add(errorMessage);
+                result.put(NodeRequest.ERRORS, errorList);
+                       }
+
+               }
+
+        if(DocumentRequest.PROFILE) {
+               long dura = System.nanoTime()-s;
+               System.err.println("NodeRequestDynamic " + System.identityHashCode(this) + " " + variable.getURI(graph) + " in " + 1e-6*dura + "ms." + result);
+        }
+
+               return result;
+
+       }               
+
 }
\ No newline at end of file