Package com.google.gerrit.httpd.rpc
Class BaseServiceImplementation
- java.lang.Object
-
- com.google.gerrit.httpd.rpc.BaseServiceImplementation
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BaseServiceImplementation.Action<T>
Arbitrary action to run with a database connection.static class
BaseServiceImplementation.Failure
Exception whose cause is passed into onFailure.
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseServiceImplementation(com.google.inject.Provider<ReviewDb> schema, com.google.inject.Provider<? extends CurrentUser> currentUser)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Account.Id
getAccountId()
protected ReviewDb
getDb()
protected CurrentUser
getUser()
protected <T> void
run(com.google.gwtjsonrpc.common.AsyncCallback<T> callback, BaseServiceImplementation.Action<T> action)
Executesaction.run
with an active ReviewDb connection.
-
-
-
Constructor Detail
-
BaseServiceImplementation
protected BaseServiceImplementation(com.google.inject.Provider<ReviewDb> schema, com.google.inject.Provider<? extends CurrentUser> currentUser)
-
-
Method Detail
-
getAccountId
protected Account.Id getAccountId()
-
getUser
protected CurrentUser getUser()
-
getDb
protected ReviewDb getDb()
-
run
protected <T> void run(com.google.gwtjsonrpc.common.AsyncCallback<T> callback, BaseServiceImplementation.Action<T> action)
Executesaction.run
with an active ReviewDb connection.A database handle is automatically opened and closed around the action's
BaseServiceImplementation.Action.run(ReviewDb)
method. OrmExceptions are caught and passed into the onFailure method of the callback.- Type Parameters:
T
- type of result the callback expects.- Parameters:
callback
- the callback that will receive the result.action
- the action logic to perform.
-
-