]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.layer0/src/org/simantics/db/common/procedure/adapter/DirectStatementProcedure.java
Index tokenized lowercase versions of name and types for UI searches
[simantics/platform.git] / bundles / org.simantics.db.layer0 / src / org / simantics / db / common / procedure / adapter / DirectStatementProcedure.java
1 package org.simantics.db.common.procedure.adapter;
2
3 import org.simantics.db.AsyncReadGraph;
4 import org.simantics.db.DirectStatements;
5 import org.simantics.db.exception.DatabaseException;
6 import org.simantics.db.procedure.AsyncProcedure;
7
8 public class DirectStatementProcedure implements AsyncProcedure<DirectStatements> {
9
10         DirectStatements result = null;
11         DatabaseException exception = null;
12
13         @Override
14         public void execute(AsyncReadGraph graph, final DirectStatements ds) {
15                 result = ds;
16         }
17
18         @Override
19         public void exception(AsyncReadGraph graph, Throwable throwable) {
20                 if(throwable instanceof DatabaseException) {
21                         exception = (DatabaseException)throwable;
22                 } else {
23                         exception = new DatabaseException(throwable);
24                 }
25         }
26         
27         public DirectStatements getOrThrow() throws DatabaseException {
28                 if(exception != null) throw exception;
29                 return result;
30         }
31
32 }