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