-
Notifications
You must be signed in to change notification settings - Fork 303
Basic implementation of a page-based pagination. #239
Conversation
Converted order search to use this new pagination.
Can one of the admins verify this patch? |
Here is my review feedback:
|
Thanks for your feedback, Joerg:
|
I agree. But we can simply configure Jackson (later JSON-B) and JAXB in a way that the property is not serialized from/to client. |
Maybe the easiest way to proceed. However, if there is such a "standard metadata protocol" this will create a general expectation. And then in some cases if total is requested (true) the server will throw an |
* Rename PaginatedEntityListTo to PaginatedListTo and removed the restrictive type binding, which also allows to use this To for transfer objects. * Add AbstractGenericDao#findPaginated for general jpa queries, but for now it just raises an unsupported operation exception. * Add query timeout support.
I updated the branch with the suggestions from @hohwille. One thing though: After removing the type limitation in PaginatedListTo, it is basically a general TO, not directly related to JPA, but it resides in oasp-jpa. When adding jackson annotations to prevent serializing the searchTimeout field, we get a strange dependency to jackson inside oasp-jpa (which funnily enough is fulfilled through oasp-test, it seems). An obvious solution would be to create corresponding TOs in the service layer, and add mapping between the different layer's TOs, but I am hesitant to do this for the added complexity, and because the rest of the sample doesn't do it neither. This leads to a general observation, in that sonar is complaining about the usage of search TOs in the data layer, because those TOs are defined in the logic layer of the sample application. Has there been any discussion about this earlier? If so, could someone give me a link to it in order to understand it better? If not, I will create a separate ticket for it, so as to not derail this PR. |
You can do the jackson mapping configuration with code even outside the TO class. E.g. this can be done as a Mixin (see jackson docs). This is also far better as it allows to toggle the feature as the user actually likes. Maybe someone has a use-case to set that on the client - who knows. |
The PR now looks great. The only picky and tiny thing I could find is a pointless statement: |
My opinion is still that these TOs should simply go to common as they are not restricted to a layer. Raise your voice in #67 if you agree. |
I would vote for merging this PR. If there are no vetos in the next hours I will proceed. @henning-cg thanks for all your effort 👍 |
Updated to remove pointless statement, hehe 😄 |
I also agree in general that it's fine to have the TOs in common. For the concrete case of the pagination TOs, there is one problem, though: We use them in the AbstractGenericDao, which is part of oasp-dao, so just putting them into the sample app is not possible. A possible solution would be to move the pagination support in AbstractGenericDao into the sample app, as well, or to create an interface for the TOs, and use that in AbstractGenericDao. Both options do not convince me completely, as I think that pagination is generic enough for it to be in an oasp module. |
Basic implementation of a page-based pagination.
This is a basic implementation of pagination support for REST services and DAOs. It is based on input by @hohwille in #193 and also takes into consideration the discussion in #217.
It offers TOs for requesting pagination inside of general search parameters, and convenience methods in the base DAOs to realize paginated queries.
There are no tests yet, as I mainly see this PR as a place for a first discussion on the general concepts employed.
I converted UcFindOrder#findOrderEtos to use this new pagination support, so we are able to see it in action, although for now no changes have been made to the JS clients.