當前位置: 首頁>>代碼示例>>Java>>正文


Java Page.nextPageable方法代碼示例

本文整理匯總了Java中org.springframework.data.domain.Page.nextPageable方法的典型用法代碼示例。如果您正苦於以下問題:Java Page.nextPageable方法的具體用法?Java Page.nextPageable怎麽用?Java Page.nextPageable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.data.domain.Page的用法示例。


在下文中一共展示了Page.nextPageable方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doSubjectMigration

import org.springframework.data.domain.Page; //導入方法依賴的package包/類
public void doSubjectMigration(final SubjectRepository subjectRepository,
        final GraphSubjectRepository subjectHierarchicalRepository, final int pageSize) {
    int numOfSubjectsSaved = 0;
    Pageable pageRequest = new PageRequest(0, pageSize, new Sort("id"));
    long numOfSubjectEntitiesToMigrate = subjectRepository.count();
    Page<SubjectEntity> pageOfSubjects;

    do {
        pageOfSubjects = subjectRepository.findAll(pageRequest);
        List<SubjectEntity> subjectListToSave = pageOfSubjects.getContent();
        numOfSubjectsSaved += pageOfSubjects.getNumberOfElements();
        subjectListToSave.forEach(item -> {
            item.setId(0);
            LOGGER.trace("doSubjectMigration Subject-Id: {} Zone-name: {} Zone-id: {}", item.getSubjectIdentifier(),
                    item.getZone().getName(), item.getZone().getId());
        });

        subjectHierarchicalRepository.save(subjectListToSave);
        LOGGER.info("Total subjects migrated so far: {}/{}", numOfSubjectsSaved, numOfSubjectEntitiesToMigrate);
        pageRequest = pageOfSubjects.nextPageable();
    } while (pageOfSubjects.hasNext());

    LOGGER.info("Number of subject entities migrated: {}", numOfSubjectsSaved);
    LOGGER.info("Subject migration to Titan completed.");
}
 
開發者ID:eclipse,項目名稱:keti,代碼行數:26,代碼來源:SubjectMigrationManager.java

示例2: doResourceMigration

import org.springframework.data.domain.Page; //導入方法依賴的package包/類
public void doResourceMigration(final ResourceRepository resourceRepository,
        final GraphResourceRepository resourceHierarchicalRepository, final int pageSize) {
    int numOfResourcesSaved = 0;
    Pageable pageRequest = new PageRequest(0, pageSize, new Sort("id"));
    long numOfResourceEntitiesToMigrate = resourceRepository.count();
    Page<ResourceEntity> pageOfResources;

    do {
        pageOfResources = resourceRepository.findAll(pageRequest);
        List<ResourceEntity> resourceListToSave = pageOfResources.getContent();
        numOfResourcesSaved += pageOfResources.getNumberOfElements();

        resourceListToSave.forEach(item -> {
            // Clear the auto-generated id field prior to migrating to graphDB
            item.setId((long) 0);
            LOGGER.trace("doResourceMigration Resource-Id: {} Zone-name: {} Zone-id: {}",
                    item.getResourceIdentifier(), item.getZone().getName(), item.getZone().getId());
        });

        resourceHierarchicalRepository.save(resourceListToSave);

        LOGGER.info("Total resources migrated so far: {}/{}", numOfResourcesSaved, numOfResourceEntitiesToMigrate);
        pageRequest = pageOfResources.nextPageable();
    } while (pageOfResources.hasNext());

    LOGGER.info("Number of resource entities migrated: {}", numOfResourcesSaved);
    LOGGER.info("Resource migration to Titan completed.");
}
 
開發者ID:eclipse,項目名稱:keti,代碼行數:29,代碼來源:ResourceMigrationManager.java

示例3: findAll

import org.springframework.data.domain.Page; //導入方法依賴的package包/類
@Override
public Page<ProbeVo> findAll(int page, int size) {
    Page<ProbeEntity> probeEntities = probeDao.findAll(page, size);
    return new PageImpl<>(probeEntities.getContent().stream().map(ProbeVo::new).collect(Collectors.toList()),
            probeEntities.nextPageable(),probeEntities.getTotalElements());
}
 
開發者ID:cuiods,項目名稱:WIFIProbe,代碼行數:7,代碼來源:ProbeServiceImpl.java


注:本文中的org.springframework.data.domain.Page.nextPageable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。