Reputation: 349
I have an error like this:
and here is my code :
CallbackDataProvider<AccountModel, Void> accountDataProvider = DataProvider
.fromCallbacks(query -> accountServices.getAccountTable(
query.getOffset(), query.getLimit()
), accountServices.getAccountTableCount());
and here is the services code:
public List<AccountModel> getAccountTable(int offset, int limit) throws JsonProcessingException, EndpointException {
List<AccountModel> datalog = new JsonResponseReader(restMockvaEndpoint.send(new EndpointRequestBuilder()
.method("GET")
.resource("/account")
.property("offset", offset)
.property("limit", limit)
.build()
)).getContentTable(AccountModel.class).getData();
return datalog;
}
public int getAccountTableCount() throws JsonProcessingException, EndpointException {
int datalog = new JsonResponseReader(restMockvaEndpoint.send(new EndpointRequestBuilder()
.method("GET")
.resource("/account")
.build()
)).getContentTable(AccountModel.class).getData().size();
return datalog;
}
it's seems the error from getAccountTableCount()
method that can't implement to CallbackDataProvider
. Any idea?
Thank you.
Upvotes: 1
Views: 246
Reputation: 36113
CallbackDataProvider<AccountModel, Void> accountDataProvider =
DataProvider
.fromCallbacks(
query -> accountServices.getAccountTable(
query.getOffset(), query.getLimit()).stream(),
query -> accountServices.getAccountTableCount());
Upvotes: 2