import org.simantics.db.WriteGraph;
import org.simantics.db.common.primitiverequest.Adapter;
import org.simantics.db.common.procedure.adapter.TransientCacheListener;
-import org.simantics.db.common.request.UnaryRead;
+import org.simantics.db.common.request.BinaryRead;
import org.simantics.db.common.request.UniqueRead;
import org.simantics.db.common.request.WriteResultRequest;
import org.simantics.db.common.utils.Logger;
import org.simantics.document.server.request.ServerSCLValueRequest;
import org.simantics.document.server.serverResponse.ServerResponse;
import org.simantics.document.server.serverResponse.SuccessResponse;
+import org.simantics.document.server.state.StateNodeManager;
+import org.simantics.document.server.state.StateRealm;
+import org.simantics.document.server.state.StateSessionManager;
import org.simantics.modeling.ModelingResources;
import org.simantics.modeling.scl.SCLRealm;
import org.simantics.modeling.scl.SCLSessionManager;
}
DirectQuerySupport dqs = graph.getService(DirectQuerySupport.class);
- PrimitivePropertyStatementsProcedure foo = new PrimitivePropertyStatementsProcedure();
+ //PrimitivePropertyStatementsProcedure foo = new PrimitivePropertyStatementsProcedure();
- dqs.forEachDirectPersistentStatement(graph, parentRes, foo);
+ DirectStatements ds = dqs.getDirectPersistentStatements(graph, parentRes);
- for(Statement stm : foo.result) {
+ for(Statement stm : ds) {
Resource predicate = stm.getPredicate();
PropertyInfo info = graph.syncRequest(new PropertyInfoRequest(predicate));
final List<TCon> effects = ServerSCLHandlerValueRequest.getEffects(graph, anyFunction);
- final Function1<CommandContext, CommandResult> fn = anyFunction.getValue(graph);
- String expression = anyFunction.getPropertyValue(graph, "expression");
+ Function1<CommandContext, CommandResult> fn = anyFunction.getValue(graph);
+ //String expression = anyFunction.getPropertyValue(graph, "expression");
final Session session = graph.getSession();
- return new AbstractResponseHandler(expression) {
+ return new AbstractResponseHandler(fn) {
private String formatError(RequestProcessor proc, Throwable t) {
} else {
- String id = sclStateKey(graph, base, self, ref);
-
- SCLRealm realm = SCLSessionManager.getOrCreateSCLRealm(base.getURI(graph) + "/__scl__");
- realm.getConnection().setVariable(id, getSCLType(defaultValue), defaultValue);
-
return defaultValue;
}
String id = sclStateKey(graph, base, self, ref);
- SCLRealm realm = SCLSessionManager.getOrCreateSCLRealm(base.getURI(graph)+"/__scl__");
- realm.getConnection().setVariable(id, getSCLType(value), value);
- realm.refreshVariablesSync();
+ StateRealm realm = (StateRealm) StateSessionManager.getInstance().getOrCreateRealm(graph, base.getURI(graph)+"/__scl__");
+ StateNodeManager nodeManager = (StateNodeManager) realm.getNodeManager();
+ nodeManager.setState(id, value);
}
return true;
}
} else {
- Variable parentCp = graph.sync(new UnaryRead<Connection, Variable>(conn) {
+ Variable parentCp = graph.sync(new BinaryRead<Variable, Connection, Variable>(widget, conn) {
@Override
public Variable perform(ReadGraph graph) throws DatabaseException {
DocumentationResource DOC = DocumentationResource.getInstance(graph);
- Collection<VariableConnectionPointDescriptor> descs = parameter.getConnectionPointDescriptors(graph, null);
+ Collection<VariableConnectionPointDescriptor> descs = parameter2.getConnectionPointDescriptors(graph, parameter, null);
for(VariableConnectionPointDescriptor desc : descs) {
if (DOC.Relations_partN.equals(desc.getConnectionPointResource(graph))) {
LOGGER.debug("", e);
return e.getMessage();
}
+
+ static class StandardDocumentProperties implements DocumentProperties {
+
+ @Override
+ public Collection<String> getKeys(ReadGraph graph, Variable context) throws DatabaseException {
+
+ DocumentationResource DOC = DocumentationResource.getInstance(graph);
+ StandardGraphPropertyVariable asd = new StandardGraphPropertyVariable(graph, context, DOC.Properties_primitiveProperties);
+ Map<String, Variable> ps = primitiveProperties.getVariables(graph, asd, null);
+ return ps.keySet();
+
+ }
+
+ @Override
+ public Object getValue(ReadGraph graph, Variable context, String key) throws DatabaseException {
+
+ DocumentationResource DOC = DocumentationResource.getInstance(graph);
+ StandardGraphPropertyVariable asd = new StandardGraphPropertyVariable(graph, context, DOC.Properties_primitiveProperties);
+ Map<String, Variable> ps = primitiveProperties.getVariables(graph, asd, null);
+ return ps.get(key).getValue(graph);
+
+ }
+
+ }
+
+ public static DocumentProperties primitiveProperties() throws DatabaseException {
+ return new StandardDocumentProperties();
+ }
}
\ No newline at end of file