@Override public int size() { long size; if (type == null && StringUtils.isEmpty(searchText)) { size = getSoftwareModuleManagement().count(); } else { size = getSoftwareModuleManagement().countByTextAndType(searchText, type); } if (size > Integer.MAX_VALUE) { size = Integer.MAX_VALUE; } return (int) size; }
@Override public ResponseEntity<PagedList<MgmtSoftwareModule>> getSoftwareModules( @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) { final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); final Sort sorting = PagingUtility.sanitizeSoftwareModuleSortParam(sortParam); final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting); final Slice<SoftwareModule> findModulesAll; long countModulesAll; if (rsqlParam != null) { findModulesAll = softwareModuleManagement.findByRsql(pageable, rsqlParam); countModulesAll = ((Page<SoftwareModule>) findModulesAll).getTotalElements(); } else { findModulesAll = softwareModuleManagement.findAll(pageable); countModulesAll = softwareModuleManagement.count(); } final List<MgmtSoftwareModule> rest = MgmtSoftwareModuleMapper.toResponse(findModulesAll.getContent()); return ResponseEntity.ok(new PagedList<>(rest, countModulesAll)); }
@Override public int size() { long size; if (type == null && StringUtils.isEmpty(searchText)) { size = getSoftwareManagementService().count(); } else { size = getSoftwareManagementService().countByTextAndType(searchText, type); } if (size > Integer.MAX_VALUE) { size = Integer.MAX_VALUE; } return (int) size; }
@Override public int size() { long size; if (type == null && StringUtils.isEmpty(searchText)) { size = getSoftwareModuleManagement().count(); } else { size = getSoftwareModuleManagement().countByTextAndType(searchText, type); } if (size > Integer.MAX_VALUE) { size = Integer.MAX_VALUE; } return (int) size; }
@Override public int size() { long size; if (type == null && StringUtils.isEmpty(searchText)) { size = getSoftwareManagementService().count(); } else { size = getSoftwareManagementService().countByTextAndType(searchText, type); } if (size > Integer.MAX_VALUE) { size = Integer.MAX_VALUE; } return (int) size; }