import org.simantics.db.layer0.request.VariableRead;\r
import org.simantics.db.layer0.variable.Variable;\r
import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.db.request.ReadExt;\r
+import org.simantics.db.request.RequestFlags;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.sysdyn.SysdynResource;\r
import org.simantics.sysdyn.manager.SysdynDataSet;\r
}\r
\r
\r
- /**\r
- * Returns rvis in a map in format /ModuleInstance/Variable[1] = /ModuleInstance/Variable[index1]\r
- * @param graph ReadGraph\r
- * @param variable Variable for the rvis\r
- * @return rvis in a map. Keys are numerical formatted array indexes and values are textual.\r
- * @throws DatabaseException\r
- */\r
- public static HashMap<String, String> getActiveRVIs(ReadGraph graph, Variable variable) throws DatabaseException {\r
- return graph.syncRequest(new GetActiveRVIs(variable));\r
- }\r
+// /**\r
+// * Returns rvis in a map in format /ModuleInstance/Variable[1] = /ModuleInstance/Variable[index1]\r
+// * @param graph ReadGraph\r
+// * @param variable Variable for the rvis\r
+// * @return rvis in a map. Keys are numerical formatted array indexes and values are textual.\r
+// * @throws DatabaseException\r
+// */\r
+// public static HashMap<String, String> getActiveRVIs(ReadGraph graph, Variable variable) throws DatabaseException {\r
+// return graph.syncRequest(new GetActiveRVIs(variable));\r
+// }\r
\r
- public static class GetActiveRVIs extends VariableRead<HashMap<String, String>> {\r
+ public static class GetActiveRVIs extends VariableRead<HashMap<String, String>> implements ReadExt {\r
\r
public GetActiveRVIs(Variable variable) {\r
super(variable);\r
}\r
return rvis;\r
}\r
+\r
+ @Override\r
+ public boolean isImmutable(ReadGraph graph) throws DatabaseException {\r
+ return false;\r
+ }\r
+\r
+ @Override\r
+ public int getType() {\r
+ return RequestFlags.IMMEDIATE_UPDATE;\r
+ }\r
}\r
\r
\r
import org.simantics.db.common.request.WriteRequest;\r
import org.simantics.db.common.utils.ListUtils;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.exception.MissingVariableException;\r
import org.simantics.db.layer0.util.EvaluatingListener;\r
import org.simantics.db.layer0.util.EvaluatingListener.Criterion;\r
import org.simantics.db.layer0.util.EvaluatingListener.Evaluation;\r
import org.simantics.db.layer0.variable.Variables;\r
+import org.simantics.db.request.ReadExt;\r
+import org.simantics.db.request.RequestFlags;\r
import org.simantics.layer0.Layer0;\r
import org.simantics.modeling.ModelingResources;\r
import org.simantics.scl.runtime.function.FunctionImpl1;\r
\r
}\r
\r
- public static class LastValueIndexed extends BinaryRead<Resource, String, org.simantics.db.layer0.variable.Variable> {\r
+ public static class LastValueIndexed extends BinaryRead<org.simantics.db.layer0.variable.Variable, String, org.simantics.db.layer0.variable.Variable> implements ReadExt {\r
\r
- public LastValueIndexed(Resource resource, String path) {\r
- super(resource, path);\r
+ public LastValueIndexed(org.simantics.db.layer0.variable.Variable run, String path) {\r
+ super(run, path);\r
}\r
\r
@Override\r
public org.simantics.db.layer0.variable.Variable perform(ReadGraph graph) throws DatabaseException {\r
\r
- org.simantics.db.layer0.variable.Variable run = Variables.getVariable(graph, parameter);\r
- Pair<String, String> nameAndIndices = splitToNameAndIndices(parameter2);\r
- org.simantics.db.layer0.variable.Variable v = run.browsePossible(graph, "/" + nameAndIndices.first + "#value#" + nameAndIndices.second);\r
- if(v == null) throw new MissingVariableException("No variable for SysDyn reference path: " + parameter2);\r
- return v;\r
+ try {\r
+ Pair<String, String> nameAndIndices = splitToNameAndIndices(parameter2);\r
+ org.simantics.db.layer0.variable.Variable v = parameter.browsePossible(graph, "/" + nameAndIndices.first + "#value#" + nameAndIndices.second);\r
+ //if(v == null) throw new MissingVariableException("No variable for SysDyn reference path: " + parameter2);\r
+ if(v == null) return null;\r
+ return v;\r
+ } catch (Throwable e) {\r
+ throw new DatabaseException(e);\r
+ }\r
}\r
+\r
+ @Override\r
+ public boolean isImmutable(ReadGraph graph) throws DatabaseException {\r
+ return false;\r
+ }\r
+\r
+ @Override\r
+ public int getType() {\r
+ return RequestFlags.IMMEDIATE_UPDATE;\r
+ }\r
+ \r
}\r
\r
\r
public static org.simantics.db.layer0.variable.Variable lastValueIndexed(ReadGraph graph, org.simantics.db.layer0.variable.Variable run, String path) throws DatabaseException {\r
if(run == null) return null;\r
- return graph.syncRequest(new LastValueIndexed(run.getRepresents(graph), path));\r
+ return graph.syncRequest(new LastValueIndexed(run, path));\r
} \r
\r
public static org.simantics.db.layer0.variable.Variable equation(ReadGraph graph, org.simantics.db.layer0.variable.Variable input, String path) throws DatabaseException {\r