-package org.simantics.structural2.scl;\r
-\r
-import java.util.List;\r
-\r
-import org.simantics.databoard.Bindings;\r
-import org.simantics.databoard.adapter.AdaptException;\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.layer0.Layer0;\r
-import org.simantics.structural.stubs.StructuralResource2;\r
-import org.simantics.structural2.scl.StructuralComponent;\r
-\r
-public class VariableStructuralContext extends StructuralComponent<Variable> {\r
-\r
- final public Variable variable;\r
- \r
- public VariableStructuralContext(ReadGraph graph, Variable selfVariable) throws DatabaseException {\r
- this.variable = selfVariable.getParent(graph).getParent(graph);\r
- }\r
-\r
- public VariableStructuralContext(Variable variable) throws DatabaseException {\r
- this.variable = variable;\r
- }\r
-\r
- @Override\r
- public Resource getType(ReadGraph g) throws DatabaseException {\r
- throw new UnsupportedOperationException();\r
- }\r
-\r
- @Override\r
- public Object getValue(ReadGraph g, Resource attribute, Binding binding) throws DatabaseException, AdaptException {\r
- \r
- Layer0 L0 = Layer0.getInstance(g);\r
- StructuralResource2 STR = StructuralResource2.getInstance(g);\r
- if(STR.input.equals(attribute)) {\r
- return variable.getPropertyValue(g, "input");\r
- }\r
-\r
- String name = g.getRelatedValue(attribute, L0.HasName, Bindings.STRING);\r
- return variable.getPropertyValue(g, name);\r
- \r
- }\r
-\r
- @Override\r
- public boolean isParametrized(ReadGraph g) throws DatabaseException {\r
- throw new UnsupportedOperationException();\r
- }\r
-\r
- @Override\r
- public Variable getConnection(ReadGraph g, Resource connectionPoint) throws DatabaseException {\r
- throw new UnsupportedOperationException();\r
- }\r
-\r
- @SuppressWarnings({ "unchecked", "rawtypes" })\r
- @Override\r
- public List getConnections(ReadGraph g, Resource connectionPoint) throws DatabaseException {\r
- throw new UnsupportedOperationException();\r
- }\r
-\r
- @Override\r
- public Resource getResource() {\r
- throw new UnsupportedOperationException();\r
- }\r
-\r
- @Override\r
- public StructuralComponent<Variable> getContext() {\r
- throw new UnsupportedOperationException();\r
- }\r
-\r
-}\r
+package org.simantics.structural2.scl;
+
+import java.util.List;
+
+import org.simantics.databoard.Bindings;
+import org.simantics.databoard.adapter.AdaptException;
+import org.simantics.databoard.binding.Binding;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.layer0.Layer0;
+import org.simantics.structural.stubs.StructuralResource2;
+import org.simantics.structural2.scl.StructuralComponent;
+
+public class VariableStructuralContext extends StructuralComponent<Variable> {
+
+ final public Variable variable;
+
+ public VariableStructuralContext(ReadGraph graph, Variable selfVariable) throws DatabaseException {
+ this.variable = selfVariable.getParent(graph).getParent(graph);
+ }
+
+ public VariableStructuralContext(Variable variable) throws DatabaseException {
+ this.variable = variable;
+ }
+
+ @Override
+ public Resource getType(ReadGraph g) throws DatabaseException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Object getValue(ReadGraph g, Resource attribute, Binding binding) throws DatabaseException, AdaptException {
+
+ Layer0 L0 = Layer0.getInstance(g);
+ StructuralResource2 STR = StructuralResource2.getInstance(g);
+ if(STR.input.equals(attribute)) {
+ return variable.getPropertyValue(g, "input");
+ }
+
+ String name = g.getRelatedValue(attribute, L0.HasName, Bindings.STRING);
+ return variable.getPropertyValue(g, name);
+
+ }
+
+ @Override
+ public boolean isParametrized(ReadGraph g) throws DatabaseException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Variable getConnection(ReadGraph g, Resource connectionPoint) throws DatabaseException {
+ throw new UnsupportedOperationException();
+ }
+
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ @Override
+ public List getConnections(ReadGraph g, Resource connectionPoint) throws DatabaseException {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Resource getResource() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public StructuralComponent<Variable> getContext() {
+ throw new UnsupportedOperationException();
+ }
+
+}