]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.document.server/src/org/simantics/document/server/Functions.java
Polling and pollingfunction fixes
[simantics/platform.git] / bundles / org.simantics.document.server / src / org / simantics / document / server / Functions.java
index 8b68cc409cde83d0442ae081163c15e3dcf0071c..6ccffbe973ddecdeef07e4a8bcbdaebe3acf52e2 100644 (file)
@@ -136,7 +136,7 @@ public class Functions {
                 for(Variable property : procedural.getProperties(graph/*, DocumentationResource.URIs.Document_AttributeRelation*/)) {
                     if(property instanceof StandardAssertedGraphPropertyVariable) {
                         StandardAssertedGraphPropertyVariable ass = (StandardAssertedGraphPropertyVariable)property;
-                        if("datadefinitions".equals(ass.property.name) || "commands".equals(ass.property.name)) {
+                        if("datadefinitions".equals(ass.property.name) || "commands".equals(ass.property.name)  || "pollingFunction".equals(ass.property.name)) {
                             Object value = property.getPossibleValue(graph);
                             if(value != null) map.put(ass.property.name, new ConstantPropertyVariable(parent, ass.property.name, value, null));
                         }
@@ -160,15 +160,28 @@ public class Functions {
                 PrimitivePropertyStatementsProcedure foo = new PrimitivePropertyStatementsProcedure();
 
                 dqs.forEachDirectPersistentStatement(graph, parent.getRepresents(graph), foo);
-       
+
                 for(Statement stm : foo.result) {
                     Resource predicate = stm.getPredicate();
                     PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(predicate));
+
                     if(info.isHasProperty && info.hasClassification(DocumentationResource.URIs.Document_AttributeRelation)) {
                         if(map == null) map = new HashMap<String,Variable>();
                         Variable prop = new StandardGraphPropertyVariable(graph, parent, predicate);
                         Object value = prop.getValue(graph);
                         map.put(info.name, new ConstantPropertyVariable(parent, info.name, value, null));
+                    } else {
+                        Resource definition = graph.getPossibleObject(predicate, DOC.Document_definesAttributeRelation);
+                        if(definition != null) {
+                            if(map == null) map = new HashMap<String,Variable>();
+                            try {
+                                PropertyInfo info2 = graph.syncRequest(new PropertyInfoRequest(definition));
+                                Variable prop = new StandardGraphPropertyVariable(graph, parent, definition);
+                                map.put(info2.name, new PrimitiveValueVariable(parent, info2.name, prop));
+                            } catch (DatabaseException e) {
+                                Logger.defaultLogError(e);
+                            }
+                        }
                     }
                 }