-package org.simantics.db.layer0.request;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.request.ResourceRead;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.db.layer0.variable.Variables;\r
-import org.simantics.simulation.ontology.SimulationResource;\r
-\r
-public class ActiveRuns extends ResourceRead<Collection<Variable>> {\r
-\r
- public ActiveRuns(ReadGraph graph, Variable model) throws DatabaseException {\r
- super(model.getRepresents(graph));\r
- }\r
-\r
- public ActiveRuns(Resource model) {\r
- super(model);\r
- }\r
-\r
- @Override\r
- public Collection<Variable> perform(ReadGraph graph) throws DatabaseException {\r
-\r
- Variable variable = Variables.getPossibleVariable(graph, resource);\r
- if (variable == null)\r
- return Collections.emptyList();\r
-\r
- Collection<Variable> result = new ArrayList<Variable>();\r
- SimulationResource SIMU = SimulationResource.getInstance(graph);\r
-\r
- for(Variable experiment : variable.getChildren(graph)) {\r
- Resource experimentType = experiment.getPossibleType(graph, SIMU.Experiment);\r
- if(experimentType == null) continue;\r
- for(Variable run : experiment.getChildren(graph)) {\r
- Resource runType = run.getPossibleType(graph);\r
- if(runType == null) continue;\r
- if(graph.isInheritedFrom(runType, SIMU.Run)) {\r
- Resource represents = run.getRepresents(graph);\r
- if(graph.hasStatement(represents, SIMU.IsActive)) result.add(run);\r
- }\r
- }\r
- }\r
- return result;\r
-\r
- }\r
-\r
-}\r
+package org.simantics.db.layer0.request;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.request.ResourceRead;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.db.layer0.variable.Variables;
+import org.simantics.simulation.ontology.SimulationResource;
+
+public class ActiveRuns extends ResourceRead<Collection<Variable>> {
+
+ public ActiveRuns(ReadGraph graph, Variable model) throws DatabaseException {
+ super(model.getRepresents(graph));
+ }
+
+ public ActiveRuns(Resource model) {
+ super(model);
+ }
+
+ @Override
+ public Collection<Variable> perform(ReadGraph graph) throws DatabaseException {
+
+ Variable variable = Variables.getPossibleVariable(graph, resource);
+ if (variable == null)
+ return Collections.emptyList();
+
+ Collection<Variable> result = new ArrayList<Variable>();
+ SimulationResource SIMU = SimulationResource.getInstance(graph);
+
+ for(Variable experiment : variable.getChildren(graph)) {
+ Resource experimentType = experiment.getPossibleType(graph, SIMU.Experiment);
+ if(experimentType == null) continue;
+ for(Variable run : experiment.getChildren(graph)) {
+ Resource runType = run.getPossibleType(graph);
+ if(runType == null) continue;
+ if(graph.isInheritedFrom(runType, SIMU.Run)) {
+ Resource represents = run.getRepresents(graph);
+ if(graph.hasStatement(represents, SIMU.IsActive)) result.add(run);
+ }
+ }
+ }
+ return result;
+
+ }
+
+}