import org.simantics.db.common.utils.ListUtils;
import org.simantics.db.common.utils.Logger;
import org.simantics.db.common.utils.NameUtils;
+import org.simantics.db.common.utils.NearestOwnerFinder;
import org.simantics.db.common.validation.L0Validations;
+import org.simantics.db.exception.AdaptionException;
import org.simantics.db.exception.DatabaseException;
import org.simantics.db.exception.DoesNotContainValueException;
import org.simantics.db.exception.NoSingleResultException;
import org.simantics.db.exception.RuntimeDatabaseException;
+import org.simantics.db.layer0.exception.InvalidVariableException;
+import org.simantics.db.layer0.exception.MissingVariableException;
import org.simantics.db.layer0.exception.MissingVariableValueException;
import org.simantics.db.layer0.exception.PendingVariableException;
-import org.simantics.db.layer0.exception.VariableException;
import org.simantics.db.layer0.request.PossibleURI;
import org.simantics.db.layer0.request.PropertyInfo;
import org.simantics.db.layer0.request.PropertyInfoRequest;
if(value == null) throw new MissingVariableValueException(variable.getPossibleURI(graph));
return value.getValue(binding);
} catch (AdaptException e) {
- throw new DatabaseException(e);
+ throw new AdaptionException("Could not get value for " + context.getURI(graph), e);
}
}
try {
modifier.apply(graph, context, value, Bindings.getBinding(value.getClass()));
} catch (BindingConstructionException e) {
- throw new DatabaseException(e);
+ throw new org.simantics.db.exception.BindingException("",e);
}
}
}
if (variable.parentResource == null)
- throw new VariableException("Variable is not represented by any resource (URI=" + variable.getPossibleURI(graph) + ").");
+ throw new InvalidVariableException("Variable is not represented by any resource (URI=" + variable.getPossibleURI(graph) + ").");
try {
return graph.getRelatedValue2(variable.parentResource, variable.property.predicate, variable);
} catch (NoSingleResultException e) {
- throw new MissingVariableValueException(variable.getPossibleURI(graph));
+ throw new MissingVariableValueException(variable.getPossibleURI(graph), e);
} catch (DoesNotContainValueException e) {
- throw new MissingVariableValueException(variable.getPossibleURI(graph));
+ throw new MissingVariableValueException(variable.getPossibleURI(graph), e);
}
}
}
if (variable.parentResource == null)
- throw new VariableException("Variable is not represented by any resource (URI=" + variable.getPossibleURI(graph) + ").");
+ throw new MissingVariableException("Variable is not represented by any resource (URI=" + variable.getPossibleURI(graph) + ").", context.getPossibleRepresents(graph));
try {
return graph.getRelatedValue2(variable.parentResource, variable.property.predicate, variable);
} catch (NoSingleResultException e) {
- throw new MissingVariableValueException(variable.getPossibleURI(graph));
+ throw new MissingVariableValueException(variable.getPossibleURI(graph), e);
} catch (DoesNotContainValueException e) {
- throw new MissingVariableValueException(variable.getPossibleURI(graph));
+ throw new MissingVariableValueException(variable.getPossibleURI(graph), e);
}
}
ClusteringSupport cs = graph.getService(ClusteringSupport.class);
if(cs.isClusterSet(resource) && !base.equals(resource)) return resource;
- Resource nearest = CommonDBUtils.getNearestOwner(graph, Collections.singletonList(resource));
+ Resource nearest = NearestOwnerFinder.getNearestOwner(graph, resource);
if(nearest == null) return null;
return getPossibleNearestClusterSet(graph, base, nearest);