Package org.springframework.data.domain

Examples of org.springframework.data.domain.Pageable


     * @see ${package}.services.base.IService${symbol_pound}list(${package}.jsf.datatable.PaginationConfiguration)
     */
    @Override
    public List<T> list(final PaginationConfiguration config) {
        Predicate predicate = getPredicate(config);
        Pageable pageable = new PageRequest(config.getFirstRow() / config.getNumberOfRows(), config.getNumberOfRows(),
                config.getSortField() != null ? new Sort(new Sort.Order(config.getSortDirection(), config.getSortField())) : null);
        return ((GenericRepository<T, Long>) getRepository()).findAll(predicate, pageable, config.getFetchFields()).getContent();
    }
View Full Code Here


     * @see org.happyfaces.services.base.IService#list(org.happyfaces.jsf.datatable.PaginationConfiguration)
     */
    @Override
    public List<T> list(final PaginationConfiguration config) {
        Predicate predicate = getPredicate(config);
        Pageable pageable = new PageRequest(config.getFirstRow() / config.getNumberOfRows(), config.getNumberOfRows(),
                config.getSortField() != null ? new Sort(new Sort.Order(config.getSortDirection(), config.getSortField())) : null);
        return ((GenericRepository<T, Long>) getRepository()).findAll(predicate, pageable, config.getFetchFields()).getContent();
    }
View Full Code Here

    return roles;
  }
 
  @RequestMapping
  public String getUsersPage(ModelMap model) {
    Pageable pageRequest = new PageRequest(0, 10);
    Page<User> users = repository.findAll(pageRequest);
    model.addAttribute("users", UserMapper.map(users));
    model.addAttribute("commanduser", new UserDto());
    model.addAttribute("usertype", "new");
    return "users";
View Full Code Here

    return "redirect:/users";
  }
 
  @RequestMapping(value="/edit")
  public String edit(Long id, ModelMap model) {
    Pageable pageRequest = new PageRequest(0, 10);
    Page<User> users = repository.findAll(pageRequest);
    model.addAttribute("users", UserMapper.map(users));
    model.addAttribute("commanduser", UserMapper.map(repository.findOne(id)));
    model.addAttribute("usertype", "update");
    return "users";
View Full Code Here

    protected PersonRepository personRepository;

    @Override
    @Transactional(readOnly = true)
    public Page<Person> findAll(int page, int size) {
        Pageable pageable = new PageRequest(page, size, new Sort(
                Direction.DESC, "id"));
        Page<Person> persons = personRepository.findAll(pageable);
        return persons;
    }
View Full Code Here

    }

    @Override
    @Transactional(readOnly = true)
    public Page<Person> findByNameLike(String name, int page, int size) {
        Pageable pageable = new PageRequest(page, size, new Sort(
                Direction.DESC, "id"));
        String q = "%" + name + "%";
        Page<Person> persons = personRepository.findByNameLike(q, pageable);
        return persons;
    }
View Full Code Here

    @Override
    @SuppressWarnings("unchecked")
    protected Object doExecute(AbstractJpaQuery query, Object[] values) {

      ParametersParameterAccessor accessor = new ParametersParameterAccessor(parameters, values);
      Pageable pageable = accessor.getPageable();

      Query createQuery = query.createQuery(values);
      int pageSize = pageable.getPageSize();
      createQuery.setMaxResults(pageSize + 1);

      List<Object> resultList = createQuery.getResultList();
      boolean hasNext = resultList.size() > pageSize;
View Full Code Here

      List<Long> totals = projection.getResultList();
      Long total = totals.size() == 1 ? totals.get(0) : totals.size();

      Query query = repositoryQuery.createQuery(values);
      ParameterAccessor accessor = new ParametersParameterAccessor(parameters, values);
      Pageable pageable = accessor.getPageable();

      List<Object> content = pageable == null || total > pageable.getOffset() ? query.getResultList() : Collections
          .emptyList();

      return new PageImpl<Object>(content, pageable, total);
    }
View Full Code Here

  }

  @Test
  public void returnsSamePageIfNoSpecGiven() throws Exception {

    Pageable pageable = new PageRequest(0, 1);

    flushTestUsers();
    assertThat(repository.findAll(null, pageable), is(repository.findAll(pageable)));
  }
View Full Code Here

                        .transform(FILE_ITEM_TRANSFORMER)
                        .toImmutableSet());
    }

    private Page<RawFile> getPagedFiles(long experimentId, PaginationItems.PagedItemInfo pageInfo) {
        Pageable request = toPageRequest(RawFile.class, pageInfo);
        return rawFilesRepository.findByExperiment(experimentId, request, toFilterQuery(pageInfo));
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.domain.Pageable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.