1 package org.simantics.modeling.query;
3 import java.util.Collection;
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.exception.DatabaseException;
7 import org.simantics.db.layer0.variable.ProxyChildVariable;
8 import org.simantics.db.layer0.variable.Variable;
10 public class QueryProxyChildVariable extends ProxyChildVariable {
12 public QueryProxyChildVariable(Variable base, Variable parent, Variable other, String name) {
13 super(base, parent, other, name);
17 public Variable create(Variable base, Variable parent, Variable other, String name) {
18 return new QueryProxyChildVariable(base, parent, other, name);
21 public Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException {
23 if(CONTEXT_END.equals(name)) {
24 if(other instanceof ProxyChildVariable) {
25 // The context is also a proxy - let it do the job
26 return super.getPossibleChild(graph, name);
28 return new QueryRootVariable(this, base.getRepresents(graph));
32 return super.getPossibleChild(graph, name);
36 public Collection<Variable> getChildren(ReadGraph graph) throws DatabaseException {
38 Collection<Variable> result = super.getChildren(graph);
39 if(!(base instanceof ProxyChildVariable)) {
40 result.add(new QueryRootVariable(this, base.getRepresents(graph)));