Skip to content

Commit

Permalink
RANGER-4606: /assets/assets/count API does not return the proper coun…
Browse files Browse the repository at this point in the history
…t if the number of services is greater than 200

Signed-off-by: Madhan Neethiraj <[email protected]>
  • Loading branch information
princeap173 authored and mneethiraj committed Jan 4, 2024
1 parent c2b83f5 commit 8159115
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,26 @@ public VXLong countXAssets(@Context HttpServletRequest request) {
logger.debug("==> AssetREST.countXAssets()");
}

SearchFilter filter = searchUtil.getSearchFilterFromLegacyRequest(request, xResourceService.sortFields);

filter.setMaxRows(Integer.MAX_VALUE);

List<RangerService> services = serviceREST.getServices(filter);
int servicesCount = 0;

if (services != null) {
for (RangerService service : services) {
VXAsset asset = serviceUtil.toVXAsset(service);

if (asset != null) {
servicesCount++;
}
}
}

VXLong ret = new VXLong();

ret.setValue(searchXAssets(request).getListSize());
ret.setValue(servicesCount);

if(logger.isDebugEnabled()) {
logger.debug("<== AssetREST.countXAssets(): " + ret);
Expand Down

0 comments on commit 8159115

Please sign in to comment.