getByFilter pagination fixed
This commit is contained in:
parent
e3439cacc2
commit
c9075bacf8
1 changed files with 7 additions and 5 deletions
|
|
@ -96,8 +96,8 @@ public class RegistryController extends AbstractQueueController {
|
|||
@ResponseBody
|
||||
public CommonGetAllResponse getByFilter(@RequestParam(name = "designation", required = false) Optional<List<String>> designations,
|
||||
@RequestParam(name = "status", required = false) Optional<String> status,
|
||||
@RequestParam(name = "pageSize") Integer pageSize,
|
||||
@RequestParam(name = "pageIndex") Integer pageIndex) {
|
||||
@RequestParam(name = "pageSize", required = false) Optional<Integer> pageSize,
|
||||
@RequestParam(name = "pageIndex", required = false) Optional<Integer> pageIndex) {
|
||||
if (designations.isEmpty() && status.isEmpty()) {
|
||||
throw new ResponseStatusException(HttpStatus.NOT_ACCEPTABLE, "Request should have at least one of the parameters: designation, status");
|
||||
}
|
||||
|
|
@ -115,11 +115,13 @@ public class RegistryController extends AbstractQueueController {
|
|||
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_ACCEPTABLE, "Unknown registry status: " + s))
|
||||
.getKey())));
|
||||
|
||||
Collection<Map<String, Object>> all = stateLoader.getAllMetaTransformWithPagination(IMDGDistributedNames.Map_Registry,
|
||||
Collection<Map<String, Object>> all = pageSize.isPresent() ?
|
||||
stateLoader.getAllMetaTransformWithPagination(IMDGDistributedNames.Map_Registry,
|
||||
Registry.class,
|
||||
predicateBuilder.and(filters.toArray(ImdgPredicate[]::new)),
|
||||
pageSize,
|
||||
pageIndex);
|
||||
pageSize.get(),
|
||||
pageIndex.orElse(1)) :
|
||||
stateLoader.getAllMetaTransform(IMDGDistributedNames.Map_Registry, Registry.class, predicateBuilder.and(filters.toArray(ImdgPredicate[]::new)));
|
||||
|
||||
sw.stop();
|
||||
log.info("Info select and format {} data took {} ms", all.size(), sw.getLastTaskTimeMillis());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue