I have an existing REST service that accepts PAGE and SIZE parameters
/fetchrecords?page=0&size=10
which in turn, creates a Spring Pageable to be used with Spring Repository.
Pageable pageRequest = new PageRequest(page, size, Sort.Direction.DESC, "created");
I want to now use Vaadin 8 CallbackDataProvider, however it produces OFFSET and LIMIT to be used for the BackendDataProvider.
dataProvider = new CallbackDataProvider<MyPojo, Void>(
query -> service.fetchrecords(query.getOffset(), query.getLimit()).stream(),
query -> service.getCount());
Of course this won't work as offset != page, and limit value will change based on how many records are left, according to the offset position.
Without rewriting the rest/service, how can I go from the DataProvider OFFSET and LIMIT to PAGE and SIZE, correctly?