X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.db.layer0%2Fsrc%2Forg%2Fsimantics%2Fdb%2Flayer0%2Fvariable%2FStandardRVIResolver.java;h=7c7ba292d851d8bfde2cbf1f13d2fe3713885848;hb=1ecae6e1ad40507badb8807fb14bb67b4adf199c;hp=7c632f3f43b26bdc4c40f5f161cad268f962ff98;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardRVIResolver.java b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardRVIResolver.java index 7c632f3f4..7c7ba292d 100644 --- a/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardRVIResolver.java +++ b/bundles/org.simantics.db.layer0/src/org/simantics/db/layer0/variable/StandardRVIResolver.java @@ -32,15 +32,15 @@ public class StandardRVIResolver implements RVIResolver { @Override public RVI getRVI(ReadGraph graph, Variable variable) throws DatabaseException { - Databoard databoard = graph.getService( Databoard.class ); - Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); if(Variables.isContext(graph, variable)) { + Databoard databoard = graph.getService( Databoard.class ); + Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); return RVI.empty( rviBinding ); } else { Variable parent = variable.getParent(graph); if (parent == null) // TODO: consider using a more suitable exception here to better convey the situation. - throw new MissingVariableException("no parent for variable " + variable + " (URI=" + variable.getURI(graph) + ")"); + throw new MissingVariableException("no parent for variable " + variable + " (URI=" + variable.getURI(graph) + ")", variable.getPossibleRepresents(graph)); RVI base = graph.syncRequest(new VariableRVIRequest(parent)); RVIPart part = getRVIPart(graph, variable); return new RVIBuilder(base).append(part).toRVI(); @@ -49,9 +49,9 @@ public class StandardRVIResolver implements RVIResolver { @Override public RVI getPossibleRVI(ReadGraph graph, Variable variable) throws DatabaseException { - Databoard databoard = graph.getService( Databoard.class ); - Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); if(Variables.isContext(graph, variable)) { + Databoard databoard = graph.getService( Databoard.class ); + Binding rviBinding = databoard.getBindingUnchecked( RVI.class ); return RVI.empty( rviBinding ); } else { Variable parent = variable.getParent(graph); @@ -90,7 +90,7 @@ public class StandardRVIResolver implements RVIResolver { return child; } } - throw new DatabaseException("Could not resolve child " + part); + throw new MissingVariableException("Could not resolve child " + part, variable.getPossibleRepresents(graph)); } public static Variable resolvePropertyDefault(ReadGraph graph, Variable variable, GuidRVIPart part) throws DatabaseException { @@ -102,7 +102,7 @@ public class StandardRVIResolver implements RVIResolver { return child; } } - throw new DatabaseException("Could not resolve property " + part); + throw new MissingVariableException("Could not resolve property " + part, variable.getPossibleRepresents(graph)); } @Override @@ -120,7 +120,7 @@ public class StandardRVIResolver implements RVIResolver { if(Role.CHILD.equals(grp.getRole())) return resolveChild(graph, context, grp); else if(Role.PROPERTY.equals(grp.getRole())) return resolveProperty(graph, context, grp); } - throw new DatabaseException("Unrecognized RVIPart: " + part); + throw new MissingVariableException("Unrecognized RVIPart: " + part, context.getPossibleRepresents(graph)); } }