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.impl.query.IntProcedure;
6 import org.simantics.db.impl.query.QueryProcessor;
8 public class PossibleObjectProcedure implements IntProcedure {
10 private static DatabaseException DUMMY = new DatabaseException();
12 final private QueryProcessor processor;
13 private DatabaseException exception;
14 private Resource result;
16 public PossibleObjectProcedure(QueryProcessor processor) {
17 this.processor = processor;
21 public void execute(ReadGraphImpl graph, int i) {
22 Resource resource = processor.querySupport.getResource(i);
31 public void finished(ReadGraphImpl graph) {
35 public void exception(ReadGraphImpl graph, Throwable throwable) {
36 if(throwable instanceof DatabaseException) exception = (DatabaseException)throwable;
37 else throwable = new DatabaseException(throwable);
40 public Resource get() throws DatabaseException {
41 if(exception == DUMMY) return null;
42 else if(exception != null) throw exception;