List of usage examples for org.springframework.data.domain Page getContent
List<T> getContent();
From source file:$.TaskDaoTest.java
@Test public void findTasksByUserId() throws Exception { Page<Task> tasks = taskDao.findByUserId(2L, new PageRequest(0, 100, Direction.ASC, "id")); assertThat(tasks.getContent()).hasSize(5); assertThat(tasks.getContent().get(0).getId()).isEqualTo(1); tasks = taskDao.findByUserId(99999L, new PageRequest(0, 100, Direction.ASC, "id")); assertThat(tasks.getContent()).isEmpty(); assertThat(tasks.getContent()).isEmpty(); }/*from w ww . java 2 s . c o m*/
From source file:org.books.modules.book.service.BookRepositoryIntegrationTests.java
@Test public void findsFirstPageOfCities() { Page<Book> books = this.repository.findAll(new PageRequest(0, 10)); System.out.println("number is ======>" + books.getContent().size()); }
From source file:com.davidmogar.alsa.services.bus.internal.BusManagerServiceImpl.java
@Override public Page<BusDto> findAll(int pageIndex) { Pageable pageable = createPageable(pageIndex); Page<Bus> page = busDataService.findAll(pageable); List<BusDto> users = page.getContent().stream().map(BusDto::new).collect(Collectors.toList()); return new PageImpl<>(users, pageable, page.getTotalElements()); }
From source file:com.davidmogar.alsa.web.controllers.bus.BusController.java
private ModelAndView listBuses(int pageIndex) { ModelAndView modelAndView = new ModelAndView("admin.buses.list"); Page<BusDto> page = busManagerService.findAll(pageIndex); modelAndView.addObject("buses", page.getContent()); /* TODO: Paginate */ return modelAndView; }
From source file:com.pamarin.income.lazyload.SelectionLazyLoad.java
private void returnSelected(Page<SelectionModel<T>> result) { for (SelectionModel<T> item : result.getContent()) { if (selected.contains(item.getData())) { item.setSelected(true);//from w w w. j a va 2s.c o m } } backup = false; }
From source file:edu.chalmers.dat076.moviefinder.persistence.MovieRepositoryIntegrationTest.java
@Test @SuppressWarnings("unchecked") public void findByTitleContaining() { Pageable pageable = new PageRequest(0, 1); Page<Movie> page = repository.findByTitleContaining("testMovie", pageable); assertThat(page.getContent(), hasSize(1)); assertThat(page, Matchers.<Movie>hasItems(hasProperty("title", is("testMovie1")))); }
From source file:com.oreilly.springdata.mongodb.core.ProductRepositoryIntegrationTest.java
@Test @SuppressWarnings("unchecked") public void lookupProductsByDescription() { Pageable pageable = new PageRequest(0, 1, Direction.DESC, "name"); Page<Product> page = repository.findByDescriptionContaining("Apple", pageable); assertThat(page.getContent(), hasSize(1)); assertThat(page, Matchers.<Product>hasItems(named("iPad"))); assertThat(page.isFirstPage(), is(true)); assertThat(page.isLastPage(), is(false)); assertThat(page.hasNextPage(), is(true)); }
From source file:pl.com.softproject.diabetyk.web.services.ProductServiceImplTest.java
@Test public void test() { Page<Product> res = productDAO.findForUser("admin", new PageRequest(1, 10)); System.out.println(res.getContent()); }
From source file:com.aboutdata.web.controller.SearchController.java
/** * // w w w.j a v a2 s . c o m * * @param page * @param keywords * @param model * @return */ @ResponseBody //???? @RequestMapping("/next") public ModelAndView infinitescroll(int page, String keywords, ModelAndView model) { logger.info("page now {}", page); Pageable pageable = new PageRequest(page, 24); Page<PhotosModel> pages = searchService.search(keywords, pageable); logger.info("page size {}", pages.getContent().size()); model.setViewName("/portal/search/next"); model.addObject("pages", pages); model.addObject("page", page); return model; }
From source file:fr.treeptik.cloudunit.service.impl.MessageServiceImpl.java
@Override public List<Message> listByUser(User user, int nbRows) throws ServiceException { try {//www.j ava2 s . co m Pageable pageable = new PageRequest(0, nbRows, sortByLastNameAsc()); Page<Message> requestedPage = messageDAO.listByUser(user, pageable); return requestedPage.getContent(); } catch (PersistenceException e) { throw new ServiceException(e.getLocalizedMessage(), e); } }