@Override public int size() { long size = 0; if (currentSelectedConrollerId != null) { size = getDeploymentManagement().countActionsByTarget(currentSelectedConrollerId); } if (size > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } return (int) size; }
@Override public int size() { long size = 0; if (currentSelectedConrollerId != null) { size = getDeploymentManagement().countActionsByTarget(currentSelectedConrollerId); } if (size > Integer.MAX_VALUE) { return Integer.MAX_VALUE; } return (int) size; }
@Override public ResponseEntity<PagedList<MgmtAction>> getActionHistory(@PathVariable("targetId") final String targetId, @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam, @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam, @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam, @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) final String rsqlParam) { findTargetWithExceptionIfNotFound(targetId); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); final Sort sorting = PagingUtility.sanitizeActionSortParam(sortParam); final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting); final Slice<Action> activeActions; final Long totalActionCount; if (rsqlParam != null) { activeActions = this.deploymentManagement.findActionsByTarget(rsqlParam, targetId, pageable); totalActionCount = this.deploymentManagement.countActionsByTarget(rsqlParam, targetId); } else { activeActions = this.deploymentManagement.findActionsByTarget(targetId, pageable); totalActionCount = this.deploymentManagement.countActionsByTarget(targetId); } return ResponseEntity.ok( new PagedList<>(MgmtTargetMapper.toResponse(targetId, activeActions.getContent()), totalActionCount)); }