An ApiOperation
that the Repository
pushes asynchronously.
The Repository
can push AsyncApiOperation
objects using the EventBus
passed in from its init(RepositoryContext)
method. Typically, the
Repository
performs on-demand API operations whenever it implements a scheduled or
event-driven change-detection mechanism.
The ListenableFuture
result represents the future result of the operation accessible
from getResult()
.
Sample usage:
public MyRepository implements Repository {
@Override
public void init(RepositoryContext context) {
this.context = context;
}
private void onDocumentRemoved(String docId) {
AsyncApiOperation operation = new AsyncApiOperation(ApiOperations.deleteItem(docId));
this.context.postAsyncOperation(operation);
}
// other implemented methods
}
Public Constructor Summary
AsyncApiOperation(ApiOperation operation)
Constructs
AsyncApiOperation to be posted on postAsyncOperation(AsyncApiOperation) . |
Public Method Summary
ApiOperation |
getOperation()
Gets
ApiOperation to be executed. |
ListenableFuture<List<GenericJson>> |
getResult()
Gets result for
ApiOperation operation execution. |
Inherited Method Summary
Public Constructors
public AsyncApiOperation (ApiOperation operation)
Constructs AsyncApiOperation
to be posted on postAsyncOperation(AsyncApiOperation)
.
Parameters
operation | ApiOperation to be executed asynchronously.
|
---|
Public Methods
public ApiOperation getOperation ()
Gets ApiOperation
to be executed.
Returns
- operation to be executed.
public ListenableFuture<List<GenericJson>> getResult ()
Gets result for ApiOperation
operation execution.
Returns
- result for
ApiOperation
operation execution.