]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/AbstractChildVariable.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / layer0 / variable / AbstractChildVariable.java
index 2b6cd0595dc71390875d052e0303a28f3b8ce8cf..7df21813027ab198fd3ccf5c4d0ca3fb6d3fcd99 100644 (file)
-package org.simantics.db.layer0.variable;\r
-\r
-import java.util.Collection;\r
-import java.util.Collections;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.simantics.databoard.binding.Binding;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.common.uri.UnescapedChildMapOfResource;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.exception.MissingVariableValueException;\r
-import org.simantics.db.layer0.variable.RVI.RVIPart;\r
-import org.simantics.db.layer0.variable.RVI.StringRVIPart;\r
-import org.simantics.db.layer0.variable.Variables.Role;\r
-\r
-public abstract class AbstractChildVariable extends AbstractVariable {\r
-       \r
-       public AbstractChildVariable() {\r
-               this(null);\r
-       }\r
-       \r
-       public AbstractChildVariable(VariableNode node) {\r
-               super(node);\r
-       }\r
-\r
-    @Override\r
-    public Role getRole(ReadGraph graph) throws DatabaseException {\r
-        return Role.CHILD;\r
-    }\r
-    \r
-    @Override\r
-    public <T> T getValue(ReadGraph graph) throws DatabaseException {\r
-        throw new MissingVariableValueException("No value in child variable.");\r
-    }\r
-    \r
-    @Override\r
-    public <T> T getValue(ReadGraph graph, Binding binding) throws DatabaseException {\r
-        throw new MissingVariableValueException("No value in child variable.");\r
-    }\r
-    \r
-    @Override\r
-    public void setValue(WriteGraph graph, Object value, Binding binding)\r
-            throws DatabaseException {\r
-        throw new DatabaseException("Cannot write value to a child variable.");\r
-    }\r
-\r
-    \r
-    @Override\r
-    public Resource getRepresents(ReadGraph graph) throws DatabaseException {\r
-        Variable parent = getParent(graph);\r
-        if(!(parent instanceof AbstractChildVariable))\r
-            return null;\r
-        Resource parentRepresents = \r
-            ((AbstractChildVariable)parent).getRepresentsForBrowsingChildResources(graph);\r
-        if(parentRepresents == null)\r
-            return null;\r
-       Resource result = graph.syncRequest(new UnescapedChildMapOfResource(parentRepresents))\r
-                .get(getName(graph)); \r
-//     System.err.println("getRepresents " + getURI(graph) + " -> parent " + parentRepresents + " " + this + " => " + result + " " + getName(graph));\r
-        return result; \r
-    }\r
-    \r
-    public Resource getRepresentsForBrowsingChildResources(ReadGraph graph) throws DatabaseException {\r
-        return getRepresents(graph);\r
-    }\r
-    \r
-    @Override\r
-    public Variable getPossibleExtraProperty(ReadGraph graph, String name) throws DatabaseException {\r
-       return null;\r
-    }\r
-    \r
-    @Override\r
-    public void collectExtraProperties(ReadGraph graph, Map<String, Variable> properties) throws DatabaseException {\r
-    }\r
-    \r
-    @Override\r
-    protected Variable getPossibleDomainProperty(ReadGraph graph, String name) throws DatabaseException {\r
-       return null;\r
-    }\r
-    \r
-    @Override\r
-    public Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException {\r
-       return null;\r
-    }\r
-    \r
-    @Override\r
-    public Map<String, Variable> collectDomainProperties(ReadGraph graph, Map<String, Variable> map) throws DatabaseException {\r
-       return map;\r
-    }\r
-    \r
-    @Override\r
-    public Collection<Variable> getChildren(ReadGraph graph) throws DatabaseException {\r
-       return Collections.emptyList();\r
-    }\r
-    \r
-    @Override\r
-    public RVIPart getRVIPart(ReadGraph graph) throws DatabaseException {\r
-       return new StringRVIPart(Role.CHILD, getName(graph));\r
-    }\r
-\r
-    @Override\r
-    public Set<String> getClassifications(ReadGraph graph) throws DatabaseException {\r
-       return Collections.emptySet();\r
-    }\r
-\r
-}\r
+package org.simantics.db.layer0.variable;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+
+import org.simantics.databoard.binding.Binding;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.common.uri.UnescapedChildMapOfResource;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.exception.MissingVariableValueException;
+import org.simantics.db.layer0.variable.RVI.RVIPart;
+import org.simantics.db.layer0.variable.RVI.StringRVIPart;
+import org.simantics.db.layer0.variable.Variables.Role;
+
+public abstract class AbstractChildVariable extends AbstractVariable {
+       
+       public AbstractChildVariable() {
+               this(null);
+       }
+       
+       public AbstractChildVariable(VariableNode node) {
+               super(node);
+       }
+
+    @Override
+    public Role getRole(ReadGraph graph) throws DatabaseException {
+        return Role.CHILD;
+    }
+    
+    @Override
+    public <T> T getValue(ReadGraph graph) throws DatabaseException {
+        throw new MissingVariableValueException("No value in child variable.");
+    }
+    
+    @Override
+    public <T> T getValue(ReadGraph graph, Binding binding) throws DatabaseException {
+        throw new MissingVariableValueException("No value in child variable.");
+    }
+    
+    @Override
+    public void setValue(WriteGraph graph, Object value, Binding binding)
+            throws DatabaseException {
+        throw new DatabaseException("Cannot write value to a child variable.");
+    }
+
+    
+    @Override
+    public Resource getRepresents(ReadGraph graph) throws DatabaseException {
+        Variable parent = getParent(graph);
+        if(!(parent instanceof AbstractChildVariable))
+            return null;
+        Resource parentRepresents = 
+            ((AbstractChildVariable)parent).getRepresentsForBrowsingChildResources(graph);
+        if(parentRepresents == null)
+            return null;
+       Resource result = graph.syncRequest(new UnescapedChildMapOfResource(parentRepresents))
+                .get(getName(graph)); 
+//     System.err.println("getRepresents " + getURI(graph) + " -> parent " + parentRepresents + " " + this + " => " + result + " " + getName(graph));
+        return result; 
+    }
+    
+    public Resource getRepresentsForBrowsingChildResources(ReadGraph graph) throws DatabaseException {
+        return getRepresents(graph);
+    }
+    
+    @Override
+    public Variable getPossibleExtraProperty(ReadGraph graph, String name) throws DatabaseException {
+       return null;
+    }
+    
+    @Override
+    public void collectExtraProperties(ReadGraph graph, Map<String, Variable> properties) throws DatabaseException {
+    }
+    
+    @Override
+    protected Variable getPossibleDomainProperty(ReadGraph graph, String name) throws DatabaseException {
+       return null;
+    }
+    
+    @Override
+    public Variable getPossibleChild(ReadGraph graph, String name) throws DatabaseException {
+       return null;
+    }
+    
+    @Override
+    public Map<String, Variable> collectDomainProperties(ReadGraph graph, Map<String, Variable> map) throws DatabaseException {
+       return map;
+    }
+    
+    @Override
+    public Collection<Variable> getChildren(ReadGraph graph) throws DatabaseException {
+       return Collections.emptyList();
+    }
+    
+    @Override
+    public RVIPart getRVIPart(ReadGraph graph) throws DatabaseException {
+       return new StringRVIPart(Role.CHILD, getName(graph));
+    }
+
+    @Override
+    public Set<String> getClassifications(ReadGraph graph) throws DatabaseException {
+       return Collections.emptySet();
+    }
+
+}