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));
}
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);
+ }
+ }
}
}
--- /dev/null
+package org.simantics.document.server;
+
+import org.simantics.databoard.binding.Binding;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.ConstantPropertyVariable;
+import org.simantics.db.layer0.variable.Variable;
+
+public class PrimitiveValueVariable extends ConstantPropertyVariable {
+
+ final private Variable property;
+
+ public PrimitiveValueVariable(Variable parent, String name, Variable property) {
+ super(parent, name, null, null);
+ this.property = property;
+ }
+
+ @Override
+ public <T> T getValue(ReadGraph graph) throws DatabaseException {
+ return property.getValue(graph);
+ }
+
+ @Override
+ public <T> T getValue(ReadGraph graph, Binding binding) throws DatabaseException {
+ return property.getValue(graph, binding);
+ }
+
+}