@Override protected List<SoftwareModuleMetadata> getMetadataList() { return Collections.unmodifiableList(softwareModuleManagement .findMetaDataBySoftwareModuleId(PageRequest.of(0, MAX_METADATA_QUERY), getSelectedEntity().getId()) .getContent()); }
@Override protected List<SoftwareModuleMetadata> getMetadataList() { return Collections.unmodifiableList(softwareModuleManagement .findMetaDataBySoftwareModuleId(new PageRequest(0, MAX_METADATA_QUERY), getSelectedEntity().getId()) .getContent()); }
/** * Populate software module metadata table. * * @param swModule */ public void populateSMMetadata(final SoftwareModule swModule) { removeAllItems(); if (null == swModule) { return; } selectedSWModuleId = swModule.getId(); final List<SoftwareModuleMetadata> swMetadataList = softwareModuleManagement .findMetaDataBySoftwareModuleId(PageRequest.of(0, MAX_METADATA_QUERY), selectedSWModuleId).getContent(); if (!CollectionUtils.isEmpty(swMetadataList)) { swMetadataList.forEach(this::setMetadataProperties); } }
/** * Populate software module metadata table. * * @param swModule */ public void populateSMMetadata(final SoftwareModule swModule) { removeAllItems(); if (null == swModule) { return; } selectedSWModuleId = swModule.getId(); final List<SoftwareModuleMetadata> swMetadataList = softwareModuleManagement .findMetaDataBySoftwareModuleId(new PageRequest(0, MAX_METADATA_QUERY), selectedSWModuleId) .getContent(); if (!CollectionUtils.isEmpty(swMetadataList)) { swMetadataList.forEach(this::setMetadataProperties); } }
@Override public ResponseEntity<PagedList<MgmtSoftwareModuleMetadata>> getMetadata( @PathVariable("softwareModuleId") final Long softwareModuleId, @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) { // check if software module exists otherwise throw exception immediately findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); final int sanitizedOffsetParam = PagingUtility.sanitizeOffsetParam(pagingOffsetParam); final int sanitizedLimitParam = PagingUtility.sanitizePageLimitParam(pagingLimitParam); final Sort sorting = PagingUtility.sanitizeSoftwareModuleMetadataSortParam(sortParam); final Pageable pageable = new OffsetBasedPageRequest(sanitizedOffsetParam, sanitizedLimitParam, sorting); final Page<SoftwareModuleMetadata> metaDataPage; if (rsqlParam != null) { metaDataPage = softwareModuleManagement.findMetaDataByRsql(pageable, softwareModuleId, rsqlParam); } else { metaDataPage = softwareModuleManagement.findMetaDataBySoftwareModuleId(pageable, softwareModuleId); } return ResponseEntity .ok(new PagedList<>(MgmtSoftwareModuleMapper.toResponseSwMetadata(metaDataPage.getContent()), metaDataPage.getTotalElements())); }