]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleExperiment.java
Index tokenized lowercase versions of name and types for UI searches
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / request / PossibleExperiment.java
1 package org.simantics.db.layer0.request;
2
3 import org.simantics.db.ReadGraph;
4 import org.simantics.db.Resource;
5 import org.simantics.db.common.request.ResourceRead;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.layer0.Layer0;
8 import org.simantics.simulation.ontology.SimulationResource;
9
10 public class PossibleExperiment extends ResourceRead<Resource> {
11
12     public PossibleExperiment(Resource partOfExperiment) {
13         super(partOfExperiment);
14     }
15
16     @Override
17     public Resource perform(ReadGraph graph) throws DatabaseException {
18
19
20         SimulationResource SIMU = SimulationResource.getInstance(graph);
21         Layer0 L0 = Layer0.getInstance(graph);
22         
23         if (graph.isInstanceOf(resource, SIMU.Experiment))
24             return resource;
25         
26         Resource parent = graph.getPossibleObject(resource, L0.PartOf);
27         if (parent == null)
28             return null;
29         
30         else return graph.syncRequest(new PossibleExperiment(parent));
31
32     }
33
34 }