X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FNodeManagerVariableBuilder.java;h=157d42529f0361032618e6e44e5ed17da2b05b46;hb=15af8a20abe8b2ba24b52c9da8bce6c92351dc43;hp=d49869464e8a1e116f51f48a884af1c9fce54cde;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeManagerVariableBuilder.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeManagerVariableBuilder.java index d49869464..157d42529 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeManagerVariableBuilder.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/NodeManagerVariableBuilder.java @@ -1,32 +1,32 @@ -package org.simantics.db.layer0.variable; - -import org.simantics.databoard.Bindings; -import org.simantics.db.ReadGraph; -import org.simantics.db.Resource; -import org.simantics.db.exception.DatabaseException; -import org.simantics.layer0.Layer0; - -abstract public class NodeManagerVariableBuilder implements VariableBuilder { - - @Override - public Variable buildChild(ReadGraph graph, Variable parent, VariableNode node, Resource child) throws DatabaseException { - Layer0 L0 = Layer0.getInstance(graph); - String childName = graph.getRelatedValue(child, L0.HasName, Bindings.STRING); - String sessionName = parent.getURI(graph) + "/" + childName; - return createChild(graph, parent, sessionName, child); - } - - protected Variable createChild(ReadGraph graph, Variable parent, String sessionName, Resource child) throws DatabaseException { - NodeSupport support = getNodeSupport(graph, sessionName); - return new StandardGraphChildVariable(parent, new VariableNode(support, getRoot(graph, support, sessionName)), child); - } - - @Override - public Variable buildProperty(ReadGraph graph, Variable parent, VariableNode node, Resource subject, Resource predicate) throws DatabaseException { - throw new UnsupportedOperationException(); - } - - protected abstract NodeSupport getNodeSupport(ReadGraph graph, String sessionName) throws DatabaseException; - protected abstract Object getRoot(ReadGraph graph, NodeSupport support, String sessionName) throws DatabaseException; - -} +package org.simantics.db.layer0.variable; + +import org.simantics.databoard.Bindings; +import org.simantics.db.ReadGraph; +import org.simantics.db.Resource; +import org.simantics.db.exception.DatabaseException; +import org.simantics.layer0.Layer0; + +abstract public class NodeManagerVariableBuilder implements VariableBuilder { + + @Override + public Variable buildChild(ReadGraph graph, Variable parent, VariableNode node, Resource child) throws DatabaseException { + Layer0 L0 = Layer0.getInstance(graph); + String childName = graph.getRelatedValue(child, L0.HasName, Bindings.STRING); + String sessionName = parent.getURI(graph) + "/" + childName; + return createChild(graph, parent, sessionName, child); + } + + protected Variable createChild(ReadGraph graph, Variable parent, String sessionName, Resource child) throws DatabaseException { + NodeSupport support = getNodeSupport(graph, sessionName); + return new StandardGraphChildVariable(parent, new VariableNode(support, getRoot(graph, support, sessionName)), child); + } + + @Override + public Variable buildProperty(ReadGraph graph, Variable parent, VariableNode node, Resource subject, Resource predicate) throws DatabaseException { + throw new UnsupportedOperationException(); + } + + protected abstract NodeSupport getNodeSupport(ReadGraph graph, String sessionName) throws DatabaseException; + protected abstract Object getRoot(ReadGraph graph, NodeSupport support, String sessionName) throws DatabaseException; + +}