mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-03 04:12:31 +01:00
api: Fix pagination for list PublicIPAddresses (#5231)
* api: Fix pagination for list PublicIPAddresses * refactor based on comment
This commit is contained in:
parent
a436869212
commit
826e479cf5
@ -2111,7 +2111,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
}
|
||||
}
|
||||
|
||||
final Filter searchFilter = new Filter(IPAddressVO.class, "address", false, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
final Filter searchFilter = new Filter(IPAddressVO.class, "address", false, null, null);
|
||||
final SearchBuilder<IPAddressVO> sb = _publicIpAddressDao.createSearchBuilder();
|
||||
Long domainId = null;
|
||||
Boolean isRecursive = null;
|
||||
@ -2197,7 +2197,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
||||
sc2.setParameters("ids", freeAddrIds.toArray());
|
||||
addrs.addAll(_publicIpAddressDao.search(sc2, searchFilter)); // Allocated + Free
|
||||
}
|
||||
|
||||
List<? extends IpAddress> wPagination = com.cloud.utils.StringUtils.applyPagination(addrs, cmd.getStartIndex(), cmd.getPageSizeVal());
|
||||
if (wPagination != null) {
|
||||
return new Pair<List<? extends IpAddress>, Integer>(wPagination, addrs.size());
|
||||
}
|
||||
return new Pair<>(addrs, addrs.size());
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user