1 package org.simantics.db.impl.graph;
3 import org.simantics.db.Resource;
4 import org.simantics.db.exception.DatabaseException;
5 import org.simantics.db.exception.NoSingleResultException;
6 import org.simantics.db.impl.query.IntProcedure;
7 import org.simantics.db.impl.query.QueryProcessor;
9 public class PossibleObjectProcedure implements IntProcedure {
11 private static DatabaseException DUMMY = new DatabaseException();
13 final private QueryProcessor processor;
14 private DatabaseException exception;
15 private Resource result;
17 public PossibleObjectProcedure(QueryProcessor processor) {
18 this.processor = processor;
22 public void execute(ReadGraphImpl graph, int i) {
23 Resource resource = processor.querySupport.getResource(i);
32 public void finished(ReadGraphImpl graph) {
36 public void exception(ReadGraphImpl graph, Throwable throwable) {
37 if(throwable instanceof DatabaseException) exception = (DatabaseException)throwable;
38 else throwable = new DatabaseException(throwable);
41 public Resource get() throws DatabaseException {
42 if(exception == DUMMY) return null;
43 else if(exception != null) throw exception;