1 package org.simantics.structural2.scl;
\r
3 import java.util.List;
\r
5 import org.simantics.databoard.Bindings;
\r
6 import org.simantics.databoard.adapter.AdaptException;
\r
7 import org.simantics.databoard.binding.Binding;
\r
8 import org.simantics.db.ReadGraph;
\r
9 import org.simantics.db.Resource;
\r
10 import org.simantics.db.exception.DatabaseException;
\r
11 import org.simantics.db.layer0.variable.Variable;
\r
12 import org.simantics.layer0.Layer0;
\r
13 import org.simantics.structural.stubs.StructuralResource2;
\r
14 import org.simantics.structural2.scl.StructuralComponent;
\r
16 public class VariableStructuralContext extends StructuralComponent<Variable> {
\r
18 final public Variable variable;
\r
20 public VariableStructuralContext(ReadGraph graph, Variable selfVariable) throws DatabaseException {
\r
21 this.variable = selfVariable.getParent(graph).getParent(graph);
\r
24 public VariableStructuralContext(Variable variable) throws DatabaseException {
\r
25 this.variable = variable;
\r
29 public Resource getType(ReadGraph g) throws DatabaseException {
\r
30 throw new UnsupportedOperationException();
\r
34 public Object getValue(ReadGraph g, Resource attribute, Binding binding) throws DatabaseException, AdaptException {
\r
36 Layer0 L0 = Layer0.getInstance(g);
\r
37 StructuralResource2 STR = StructuralResource2.getInstance(g);
\r
38 if(STR.input.equals(attribute)) {
\r
39 return variable.getPropertyValue(g, "input");
\r
42 String name = g.getRelatedValue(attribute, L0.HasName, Bindings.STRING);
\r
43 return variable.getPropertyValue(g, name);
\r
48 public boolean isParametrized(ReadGraph g) throws DatabaseException {
\r
49 throw new UnsupportedOperationException();
\r
53 public Variable getConnection(ReadGraph g, Resource connectionPoint) throws DatabaseException {
\r
54 throw new UnsupportedOperationException();
\r
57 @SuppressWarnings({ "unchecked", "rawtypes" })
\r
59 public List getConnections(ReadGraph g, Resource connectionPoint) throws DatabaseException {
\r
60 throw new UnsupportedOperationException();
\r
64 public Resource getResource() {
\r
65 throw new UnsupportedOperationException();
\r
69 public StructuralComponent<Variable> getContext() {
\r
70 throw new UnsupportedOperationException();
\r