org.springframework.data.domain.Pageable

Here are the examples of the java api org.springframework.data.domain.Pageable taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3291 Examples 7

19 View Source File : ViewController.java
License : Apache License 2.0
Project Creator : zeebe-io

@GetMapping("/views/groups")
public String groupList(Map<String, Object> model, @PageableDefault(size = 10) Pageable pageable) {
    final long count = groupRepository.count();
    final List<GroupEnreplacedy> groups = new ArrayList<>();
    for (GroupEnreplacedy user : groupRepository.findAll(pageable)) {
        groups.add(user);
    }
    model.put("groups", groups);
    model.put("count", count);
    addPaginationToModel(model, pageable, count);
    addCommonsToModel(model);
    return "group-view";
}

19 View Source File : ViewController.java
License : Apache License 2.0
Project Creator : zeebe-io

private void addPaginationToModel(Map<String, Object> model, Pageable pageable, final long count) {
    final int currentPage = pageable.getPageNumber();
    model.put("currentPage", currentPage);
    model.put("page", currentPage + 1);
    if (currentPage > 0) {
        model.put("prevPage", currentPage - 1);
    }
    if (count > (1 + currentPage) * pageable.getPageSize()) {
        model.put("nextPage", currentPage + 1);
    }
}

19 View Source File : ViewController.java
License : Apache License 2.0
Project Creator : zeebe-io

@GetMapping("/views/messages")
public String messageList(Map<String, Object> model, Pageable pageable) {
    final long count = messageRepository.count();
    final List<MessageDto> dtos = new ArrayList<>();
    for (MessageEnreplacedy messageEnreplacedy : messageRepository.findAll(pageable)) {
        final MessageDto dto = toDto(messageEnreplacedy);
        dtos.add(dto);
    }
    model.put("messages", dtos);
    model.put("count", count);
    addContextPathToModel(model);
    addPaginationToModel(model, pageable, count);
    return "message-list-view";
}

19 View Source File : ViewController.java
License : Apache License 2.0
Project Creator : zeebe-io

@GetMapping("/views/incidents")
@Transactional
public String incidentList(Map<String, Object> model, Pageable pageable) {
    final long count = incidentRepository.countByResolvedIsNull();
    final List<IncidentListDto> incidents = new ArrayList<>();
    for (IncidentEnreplacedy incidentEnreplacedy : incidentRepository.findByResolvedIsNull(pageable)) {
        final IncidentListDto dto = toDto(incidentEnreplacedy);
        incidents.add(dto);
    }
    model.put("incidents", incidents);
    model.put("count", count);
    addContextPathToModel(model);
    addPaginationToModel(model, pageable, count);
    return "incident-list-view";
}

19 View Source File : ViewController.java
License : Apache License 2.0
Project Creator : zeebe-io

private void addPaginationToModel(Map<String, Object> model, Pageable pageable, final long count) {
    final int currentPage = pageable.getPageNumber();
    model.put("page", currentPage + 1);
    if (currentPage > 0) {
        model.put("prevPage", currentPage - 1);
    }
    if (count > (1 + currentPage) * pageable.getPageSize()) {
        model.put("nextPage", currentPage + 1);
    }
}

19 View Source File : UserController.java
License : Apache License 2.0
Project Creator : yugabyte

@GetMapping("/users")
public Page<User> getUsers(Pageable pageable) {
    return userRepository.findAll(pageable);
}

19 View Source File : OrderController.java
License : Apache License 2.0
Project Creator : yugabyte

@GetMapping("/orders")
public Page<Order> getOrders(Pageable pageable) {
    return orderRepository.findAll(pageable);
}

19 View Source File : UserService.java
License : Apache License 2.0
Project Creator : yodamad

@Transactional(readOnly = true)
public Page<UserDTO> getAllManagedUsers(Pageable pageable) {
    return userRepository.findAllByLoginNot(pageable, Constants.ANONYMOUS_USER).map(UserDTO::new);
}

19 View Source File : AuditEventService.java
License : Apache License 2.0
Project Creator : yodamad

public Page<AuditEvent> findAll(Pageable pageable) {
    return persistenceAuditEventRepository.findAll(pageable).map(auditEventConverter::convertToAuditEvent);
}

19 View Source File : MethodService.java
License : MIT License
Project Creator : Yirendai

public // 
Page<MethodInfo> findByServiceIdAndMethodNameLike(// 
final int serviceId, // 
final String methodName, final Pageable pageable) {
    final Page<MethodInfo> pageResult;
    if (StringUtils.isEmpty(methodName)) {
        pageResult = methodRepo.findByServiceId(serviceId, pageable);
    } else {
        final String fuzzyMethodName = new StringBuilder().append("%").append(methodName).append("%").toString();
        pageResult = methodRepo.findByServiceIdAndMethodNameLike(serviceId, fuzzyMethodName, pageable);
    }
    return pageResult;
}

19 View Source File : MethodService.java
License : MIT License
Project Creator : Yirendai

public Page<MethodInfo> findByMethodNameLike(final String methodName, final Pageable pageable) {
    return methodRepo.findByMethodNameLike(methodName, pageable);
}

19 View Source File : AppService.java
License : MIT License
Project Creator : Yirendai

public Page<AppInfo> findByAppNameLike(final String appName, final Pageable pageable) {
    final Page<AppInfo> appInfoPage;
    if (StringUtils.isEmpty(appName)) {
        appInfoPage = repo.findAll(pageable);
    } else {
        final String fuzzyAppName = new StringBuilder().append("%").append(appName).append("%").toString();
        appInfoPage = repo.findByAppNameLike(fuzzyAppName, pageable);
    }
    return appInfoPage;
}

19 View Source File : SysMenuService.java
License : Apache License 2.0
Project Creator : yanghaiji

/**
 * 查询所有并分页
 * @return
 */
public Page<SysMenu> findAll(Pageable pageable) {
    return sysMenuRepository.findAll(pageable);
}

19 View Source File : SysMenuCtr.java
License : Apache License 2.0
Project Creator : yanghaiji

/**
 * 模糊查询所有
 * @return
 */
@GetMapping(value = "findPage")
public Result findPage() {
    Pageable pageable = new PageRequest(1, 4);
    return Result.javaYhQuerySuccess(sysMenuService.findPag(pageable));
}

19 View Source File : UserService.java
License : Apache License 2.0
Project Creator : xwjie

public PageResp<User> list(Pageable pageable, String keyword) {
    if (StringUtils.isEmpty(keyword)) {
        return new PageResp<User>(userDao.findAll(pageable));
    } else {
        // 也可以用springjpa 的 Specification 来实现查找
        return new PageResp<>(userDao.findAllByKeyword(keyword, pageable));
    }
}

19 View Source File : ConfigService.java
License : Apache License 2.0
Project Creator : xwjie

/**
 *  分页查找
 *
 * @param pageable
 * @param keyword
 * @return
 */
public PageResp<Config> listPage(Pageable pageable, String keyword) {
    if (StringUtils.isEmpty(keyword)) {
        return new PageResp<Config>(dao.findAll(pageable));
    } else {
        // 也可以用springjpa 的 Specification 来实现查找
        return new PageResp<>(dao.findAllByKeyword(keyword, pageable));
    }
}

19 View Source File : PageReq.java
License : Apache License 2.0
Project Creator : xwjie

public Pageable toPageable() {
    // pageable里面是从第0页开始的。
    Pageable pageable = null;
    if (StringUtils.isEmpty(sortfield)) {
        pageable = new PageRequest(page - 1, pagesize);
    } else {
        pageable = new PageRequest(page - 1, pagesize, sort.toLowerCase().startsWith("desc") ? Direction.DESC : Direction.ASC, sortfield);
    }
    return pageable;
}

19 View Source File : UploadFileService.java
License : Apache License 2.0
Project Creator : xwjie

/**
 * 分页查找
 *
 * @param pageable
 * @param keyword
 * @return
 */
public PageResp<UploadRecord> listPage(Pageable pageable, String keyword) {
    if (StringUtils.isEmpty(keyword)) {
        return new PageResp<UploadRecord>(uploadRecordDao.findAllByOrderByCreateTimeDesc(pageable));
    } else {
        // 也可以用springjpa 的 Specification 来实现查找
        return new PageResp<UploadRecord>(uploadRecordDao.findAllByKeyword(keyword, pageable));
    }
}

19 View Source File : BlogService.java
License : Apache License 2.0
Project Creator : xwjie

/**
 *  分页查找
 *
 * @param pageable
 * @param keyword
 * @return
 */
public PageResp<Blog> listPage(Pageable pageable, String keyword) {
    if (StringUtils.isEmpty(keyword)) {
        return new PageResp<Blog>(dao.findAll(pageable));
    } else {
        // 也可以用springjpa 的 Specification 来实现查找
        return new PageResp<>(dao.findAllByKeyword(keyword, pageable));
    }
}

19 View Source File : ExchangeCoinService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<ExchangeCoin> findAll(Predicate predicate, Pageable pageable) {
    return coinRepository.findAll(predicate, pageable);
}

19 View Source File : RedEnvelopeService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<RedEnvelope> findAll(Predicate predicate, Pageable pageable) {
    return redEnvelopeDao.findAll(predicate, pageable);
}

19 View Source File : MiningOrderDetailService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<MiningOrderDetail> findAll(Predicate predicate, Pageable pageable) {
    return miningOrderDetailDao.findAll(predicate, pageable);
}

19 View Source File : MemberService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<Member> findAll(Predicate predicate, Pageable pageable) {
    return memberDao.findAll(predicate, pageable);
}

19 View Source File : CtcOrderService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<CtcOrder> findAll(Predicate predicate, Pageable pageable) {
    return ctcOrderDao.findAll(predicate, pageable);
}

19 View Source File : CtcAcceptorService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<CtcAcceptor> findAll(Predicate predicate, Pageable pageable) {
    return ctcAcceptorDao.findAll(predicate, pageable);
}

19 View Source File : BusinessAuthApplyService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<BusinessAuthApply> page(Predicate predicate, Pageable pageable) {
    return businessAuthApplyDao.findAll(predicate, pageable);
}

19 View Source File : AppealService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<Appeal> findAll(com.querydsl.core.types.Predicate predicate, Pageable pageable) {
    return appealDao.findAll(predicate, pageable);
}

19 View Source File : AnnouncementService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<Announcement> findAll(Predicate predicate, Pageable pageable) {
    return announcementDao.findAll(predicate, pageable);
}

19 View Source File : AdminService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<Admin> findAll(com.querydsl.core.types.Predicate predicate, Pageable pageable) {
    return dao.findAll(predicate, pageable);
}

19 View Source File : ActivityOrderService.java
License : Apache License 2.0
Project Creator : xunibidev

public Page<ActivityOrder> findAll(Predicate predicate, Pageable pageable) {
    return activityOrderDao.findAll(predicate, pageable);
}

19 View Source File : CommonService.java
License : Apache License 2.0
Project Creator : xujeff

/**
 * 根据查询条件和分页信息获取某个结果的分页信息
 * @param spec
 * @param pageable
 * @return
 */
public Page<E> findAll(Specification<E> spec, Pageable pageable) {
    return commonDao.findAll(spec, pageable);
}

19 View Source File : CommonService.java
License : Apache License 2.0
Project Creator : xujeff

/**
 * 获取Enreplacedy的分页信息
 * @param pageable
 * @return
 */
public Page<E> findAll(Pageable pageable) {
    return commonDao.findAll(pageable);
}

19 View Source File : UserResource.java
License : Apache License 2.0
Project Creator : xm-online

/**
 * GET  /users : get all users.
 *
 * @param pageable the pagination information
 * @return the ResponseEnreplacedy with status 200 (OK) and with body all users
 */
@GetMapping("/users")
@Timed
public ResponseEnreplacedy<List<UserDTO>> getAllUsers(@ApiParam Pageable pageable, @RequestParam(required = false) String roleKey) {
    final Page<UserDTO> page = userService.getAllManagedUsers(pageable, roleKey, null);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users");
    return new ResponseEnreplacedy<>(page.getContent(), headers, HttpStatus.OK);
}

19 View Source File : UserResource.java
License : Apache License 2.0
Project Creator : xm-online

@GetMapping("/users/filter")
@PostAuthorize("hasPermission({'returnObject': returnObject.body}, 'USER.GET_BY_FILTER.LIST')")
@Timed
public ResponseEnreplacedy<List<UserDTO>> getAllByFilters(@ApiParam Pageable pageable, UserFilterQuery userFilterQuery) {
    final Page<UserDTO> page = userQueryService.findAllUsers(userFilterQuery, pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users/filter");
    return new ResponseEnreplacedy<>(page.getContent(), headers, HttpStatus.OK);
}

19 View Source File : ClientResource.java
License : Apache License 2.0
Project Creator : xm-online

/**
 * GET  /clients/clientid-contains/:clientId : get the clients.
 *
 * @param clientId part of the clientId of the clients to find
 * @param pageable the pagination information
 * @return the ResponseEnreplacedy with status 200 (OK) and body with list of clients, or the empty list
 */
@GetMapping("/clients/clientid-contains")
@PostAuthorize("hasPermission({'returnObject': returnObject.body}, 'CLIENT.GET_LIST.ITEM')")
@Timed
@PrivilegeDescription("Privilege to get the clients")
public ResponseEnreplacedy<List<ClientDTO>> getAllClientsByClientIdContains(@RequestParam String clientId, Pageable pageable) {
    Page<ClientDTO> page = clientService.findAllByClientIdContains(clientId, pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/clients/clientid-contains");
    return new ResponseEnreplacedy<>(page.getContent(), headers, HttpStatus.OK);
}

19 View Source File : ClientResource.java
License : Apache License 2.0
Project Creator : xm-online

/**
 * GET  /clients : get all the clients.
 *
 * @return the ResponseEnreplacedy with status 200 (OK) and the list of clients in body
 */
@GetMapping("/clients")
@Timed
public ResponseEnreplacedy<List<ClientDTO>> getAllClients(@ApiParam Pageable pageable) {
    Page<ClientDTO> page = clientService.findAll(pageable, null);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/clients");
    return new ResponseEnreplacedy<>(page.getContent(), headers, HttpStatus.OK);
}

19 View Source File : UserService.java
License : Apache License 2.0
Project Creator : xm-online

public Page<User> findAll(Specification<User> specification, Pageable pageable) {
    return userRepository.findAll(specification, pageable);
}

19 View Source File : VoteResource.java
License : Apache License 2.0
Project Creator : xm-online

/**
 * GET  /votes : get all the votes.
 *
 * @param pageable the pagination information
 * @return the ResponseEnreplacedy with status 200 (OK) and the list of votes in body
 */
@GetMapping("/votes")
@Timed
public ResponseEnreplacedy<List<Vote>> getAllVotes(@ApiParam Pageable pageable) {
    Page<Vote> page = voteService.findAll(pageable, null);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/votes");
    return new ResponseEnreplacedy<>(page.getContent(), headers, HttpStatus.OK);
}

19 View Source File : LinkResource.java
License : Apache License 2.0
Project Creator : xm-online

/**
 * GET  /links : get all the links.
 *
 * @param pageable the pagination information
 * @return the ResponseEnreplacedy with status 200 (OK) and the list of links in body
 */
@GetMapping("/links")
@Timed
public ResponseEnreplacedy<List<Link>> getAllLinks(@ApiParam Pageable pageable) {
    Page<Link> page = linkService.findAll(pageable, null);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/links");
    return new ResponseEnreplacedy<>(page.getContent(), headers, HttpStatus.OK);
}

19 View Source File : CommentResource.java
License : Apache License 2.0
Project Creator : xm-online

/**
 * GET  /comments : get all the comments.
 *
 * @param pageable the pagination information
 * @return the ResponseEnreplacedy with status 200 (OK) and the list of comments in body
 */
@GetMapping("/comments")
@Timed
public ResponseEnreplacedy<List<Comment>> getAllComments(@ApiParam Pageable pageable) {
    Page<Comment> page = commentService.findAll(pageable, null);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/comments");
    return new ResponseEnreplacedy<>(page.getContent(), headers, HttpStatus.OK);
}

19 View Source File : CommentResource.java
License : Apache License 2.0
Project Creator : xm-online

@GetMapping("/xm-enreplacedies/{id}/comments")
@Timed
public ResponseEnreplacedy<List<Comment>> getCommentsByXmEnreplacedy(@PathVariable Long id, @ApiParam Pageable pageable) {
    Page<Comment> page = commentService.findByXmEnreplacedy(id, pageable, null);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/xm-enreplacedies/" + id + "/comments");
    return new ResponseEnreplacedy<>(page.getContent(), headers, HttpStatus.OK);
}

19 View Source File : LinkService.java
License : Apache License 2.0
Project Creator : xm-online

@Transactional(readOnly = true)
public Page<Link> findAll(Specification<Link> spec, Pageable pageable) {
    return linkRepository.findAll(spec, pageable);
}

19 View Source File : CalendarService.java
License : Apache License 2.0
Project Creator : xm-online

@Transactional(readOnly = true)
@LogicExtensionPoint("FindEvents")
public Page<Event> findEvents(Long calendarId, EventFilter filter, Pageable pageable) {
    return eventQueryService.findAllByCalendarId(calendarId, filter, pageable);
}

19 View Source File : XmEntityPermittedSearchRepository.java
License : Apache License 2.0
Project Creator : xm-online

public Page<XmEnreplacedy> searchWithIdNotIn(String query, Set<Long> ids, String targetEnreplacedyTypeKey, Pageable pageable, String privilegeKey) {
    String permittedQuery = buildPermittedQuery(query, privilegeKey);
    BoolQueryBuilder typeKeyQuery = typeKeyQuery(targetEnreplacedyTypeKey);
    BoolQueryBuilder idNotIn = boolQuery().mustNot(termsQuery("id", ids));
    var esQuery = isEmpty(permittedQuery) ? idNotIn.must(typeKeyQuery) : idNotIn.must(simpleQueryStringQuery(permittedQuery)).must(typeKeyQuery);
    log.info("Executing DSL '{}'", esQuery);
    NativeSearchQuery queryBuilder = new NativeSearchQueryBuilder().withQuery(esQuery).withPageable(pageable == null ? DEFAULT_PAGE : pageable).build();
    return getElasticsearchTemplate().queryForPage(queryBuilder, XmEnreplacedy.clreplaced);
}

19 View Source File : PermittedRepository.java
License : Apache License 2.0
Project Creator : xm-online

protected <T> Page<T> execute(TypedQuery<Long> countSql, Pageable pageable, TypedQuery<T> query) {
    return pageable == null ? new PageImpl<>(query.getResultList()) : readPage(countSql, query, pageable);
}

19 View Source File : PermittedRepository.java
License : Apache License 2.0
Project Creator : xm-online

/**
 * Find permitted enreplacedies by parameters.
 * @param whereCondition the parameters condition
 * @param conditionParams the parameters map
 * @param pageable the page info
 * @param enreplacedyClreplaced the enreplacedy clreplaced to get
 * @param privilegeKey the privilege key for permission lookup
 * @param <T> the type of enreplacedy
 * @return page of permitted enreplacedies
 */
public <T> Page<T> findByCondition(String whereCondition, Map<String, Object> conditionParams, Pageable pageable, Clreplaced<T> enreplacedyClreplaced, String privilegeKey) {
    return findByCondition(whereCondition, conditionParams, null, pageable, enreplacedyClreplaced, privilegeKey);
}

19 View Source File : CriteriaPermittedRepository.java
License : Apache License 2.0
Project Creator : xm-online

/**
 * Find enreplacedies with applied filtering and dynamic permissions written in SpEL (rresource condition).
 *
 * @param type         Enreplacedy clreplaced
 * @param criteria     Filtering criteria from request
 * @param page         page
 * @param privilegeKey privilege key
 * @param <T>          Enreplacedy type
 * @return Enreplacedy page.
 */
public <T> Page<T> findWithPermission(final Clreplaced<T> type, final Object criteria, final Pageable page, final String privilegeKey) {
    FilterConverter.QueryPart queryPart = FilterConverter.toJpql(criteria);
    Page<T> result;
    if (queryPart.isEmpty()) {
        result = permittedRepository.findAll(page, type, privilegeKey);
    } else {
        log.debug("find with condition: {}", queryPart);
        result = permittedRepository.findByCondition(queryPart.getQuery().toString(), queryPart.getParams(), page, type, privilegeKey);
    }
    return result;
}

19 View Source File : EntityController.java
License : Apache License 2.0
Project Creator : xiangxik

protected Page<T> doInternalPage(Predicate predicate, Pageable pageable) {
    return getService().findAll(predicate, pageable);
}

19 View Source File : EntityService.java
License : Apache License 2.0
Project Creator : xiangxik

public Page<T> findAll(Pageable pageable) {
    return getRepository().findAll(pageable);
}

19 View Source File : EntityService.java
License : Apache License 2.0
Project Creator : xiangxik

public <S extends T> Page<S> findAll(Example<S> example, Pageable pageable) {
    return getRepository().findAll(example, pageable);
}

See More Examples