X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Frequest%2FActiveRuns.java;fp=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Frequest%2FActiveRuns.java;h=e4fc411fe8aef4350a31901b41b7355a7e03b957;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=b58f9aaa05e45a51060dbd50face65f0be7e5c25;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/ActiveRuns.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/ActiveRuns.java index b58f9aaa0..e4fc411fe 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/ActiveRuns.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/ActiveRuns.java @@ -1,51 +1,51 @@ -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> { - - public ActiveRuns(ReadGraph graph, Variable model) throws DatabaseException { - super(model.getRepresents(graph)); - } - - public ActiveRuns(Resource model) { - super(model); - } - - @Override - public Collection perform(ReadGraph graph) throws DatabaseException { - - Variable variable = Variables.getPossibleVariable(graph, resource); - if (variable == null) - return Collections.emptyList(); - - Collection result = new ArrayList(); - 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; - - } - -} +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> { + + public ActiveRuns(ReadGraph graph, Variable model) throws DatabaseException { + super(model.getRepresents(graph)); + } + + public ActiveRuns(Resource model) { + super(model); + } + + @Override + public Collection perform(ReadGraph graph) throws DatabaseException { + + Variable variable = Variables.getPossibleVariable(graph, resource); + if (variable == null) + return Collections.emptyList(); + + Collection result = new ArrayList(); + 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; + + } + +}