]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/request/PossibleActiveRun.java
Added resourceId and GUID to diagram DnD content
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / request / PossibleActiveRun.java
1 package org.simantics.db.layer0.request;
2
3 import java.util.Collection;
4
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.common.request.ResourceRead;
8 import org.simantics.db.exception.DatabaseException;
9 import org.simantics.db.layer0.variable.Variable;
10
11 public class PossibleActiveRun extends ResourceRead<Variable> {
12
13     public PossibleActiveRun(Resource model) {
14         super(model);
15     }
16
17     public PossibleActiveRun(ReadGraph graph, Variable model) throws DatabaseException {
18         super(model.getRepresents(graph));
19     }
20
21     @Override
22     public Variable perform(ReadGraph graph) throws DatabaseException {
23
24         Collection<Variable> result = graph.sync(new ActiveRuns(resource));
25         if(result.size() == 1) return result.iterator().next();
26         else return null;
27
28     }
29
30 }