X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Frequest%2FPossibleActiveExperiment.java;h=d9d668099f34ccf943d75c99d50e79124673b7f2;hb=3a10ce856f7124f83cf03d6e7f7576da237a7cbb;hp=6caca12c5fe20cb00572fdeb0674fe0d90f6fc4d;hpb=ad8333027322fda6b9a8a524c7a7e15a54c52f38;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleActiveExperiment.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleActiveExperiment.java index 6caca12c5..d9d668099 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleActiveExperiment.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleActiveExperiment.java @@ -1,54 +1,54 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Association for Decentralized Information Management - * in Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.db.layer0.request; - -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.common.request.PossibleIndexRoot; -import org.simantics.db.common.request.ResourceRead; -import org.simantics.db.exception.DatabaseException; -import org.simantics.layer0.Layer0; -import org.simantics.simulation.ontology.SimulationResource; - -public class PossibleActiveExperiment extends ResourceRead { - - public PossibleActiveExperiment(Resource partOfModel) { - super(partOfModel); - } - - @Override - public Resource perform(ReadGraph graph) throws DatabaseException { - - Resource model = graph.sync(new PossibleIndexRoot(resource)); - if(model == null) return null; - - Layer0 b = Layer0.getInstance(graph); - SimulationResource SIMU = SimulationResource.getInstance(graph); - Resource result = null; - for(Resource config : graph.getObjects(model, b.ConsistsOf)) { - if(graph.isInstanceOf(config, SIMU.Experiment)) { - for(Resource run : graph.getObjects(config, b.ConsistsOf)) { - if(graph.isInstanceOf(run, SIMU.Run)) { - if(graph.hasStatement(run, SIMU.IsActive)) { - if(result != null) return null; - result = run; - } - } - } - } - } - - return result; - - } - -} +/******************************************************************************* + * Copyright (c) 2007, 2010 Association for Decentralized Information Management + * in Industry THTH ry. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * VTT Technical Research Centre of Finland - initial API and implementation + *******************************************************************************/ +package org.simantics.db.layer0.request; + +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.common.request.PossibleIndexRoot; +import org.simantics.db.common.request.ResourceRead; +import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; +import org.simantics.simulation.ontology.SimulationResource; + +public class PossibleActiveExperiment extends ResourceRead { + + public PossibleActiveExperiment(Resource partOfModel) { + super(partOfModel); + } + + @Override + public Resource perform(ReadGraph graph) throws DatabaseException { + + Resource model = graph.sync(new PossibleIndexRoot(resource)); + if(model == null) return null; + + Layer0 b = Layer0.getInstance(graph); + SimulationResource SIMU = SimulationResource.getInstance(graph); + Resource result = null; + for(Resource config : graph.getObjects(model, b.ConsistsOf)) { + if(graph.isInstanceOf(config, SIMU.Experiment)) { + for(Resource run : graph.getObjects(config, b.ConsistsOf)) { + if(graph.isInstanceOf(run, SIMU.Run)) { + if(graph.hasStatement(run, SIMU.IsActive)) { + if(result != null) return null; + result = run; + } + } + } + } + } + + return result; + + } + +}