Java Code Examples for

The following are Jave code examples for showing how to use nextPageable() of the class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: keti   File:   Source Code and License Vote up 6 votes
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 -> {
            LOGGER.trace("doSubjectMigration Subject-Id: {} Zone-name: {} Zone-id: {}", item.getSubjectIdentifier(),
                    item.getZone().getName(), item.getZone().getId());
        });;"Total subjects migrated so far: {}/{}", numOfSubjectsSaved, numOfSubjectEntitiesToMigrate);
        pageRequest = pageOfSubjects.nextPageable();
    } while (pageOfSubjects.hasNext());"Number of subject entities migrated: {}", numOfSubjectsSaved);"Subject migration to Titan completed.");
Example 2
Project: keti   File:   Source Code and License Vote up 5 votes
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());
        });;"Total resources migrated so far: {}/{}", numOfResourcesSaved, numOfResourceEntitiesToMigrate);
        pageRequest = pageOfResources.nextPageable();
    } while (pageOfResources.hasNext());"Number of resource entities migrated: {}", numOfResourcesSaved);"Resource migration to Titan completed.");
Example 3
Project: WIFIProbe   File:   Source Code and License Vote up 4 votes
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()),