Example usage for org.springframework.data.domain PageRequest of

List of usage examples for org.springframework.data.domain PageRequest of

Introduction

In this page you can find the example usage for org.springframework.data.domain PageRequest of.

Prototype

public static PageRequest of(int page, int size, Sort sort) 

Source Link

Document

Creates a new PageRequest with sort parameters applied.

Usage

From source file:org.eclipse.hawkbit.ui.artifacts.details.ArtifactBeanQuery.java

@Override
public int size() {
    long size = 0;
    if (baseSwModuleId != null) {
        firstPagetArtifacts = getArtifactManagement()
                .findBySoftwareModule(PageRequest.of(0, SPUIDefinitions.PAGE_SIZE, sort), baseSwModuleId);
        size = firstPagetArtifacts.getTotalElements();
    }/*from  w ww .  j av  a2s  .  c  o m*/
    if (size > Integer.MAX_VALUE) {
        size = Integer.MAX_VALUE;
    }

    return (int) size;
}

From source file:org.jbb.security.impl.lockout.DefaultMemberLockoutService.java

@Override
@Transactional(readOnly = true)//w ww  .j a va 2s. c o m
public Page<MemberLock> getLocksWithCriteria(LockSearchCriteria criteria) {
    Validate.notNull(criteria);
    PageRequest pageRequest = PageRequest.of(criteria.getPageRequest().getPageNumber(),
            criteria.getPageRequest().getPageSize(), new Sort(Direction.DESC, "createDateTime"));
    return lockRepository.findAll(specificationCreator.createSpecification(criteria), pageRequest)
            .map(memberLockDomainTranslator::toModel);
}