Example usage for org.springframework.data.domain Page getContent

List of usage examples for org.springframework.data.domain Page getContent

Introduction

In this page you can find the example usage for org.springframework.data.domain Page getContent.

Prototype

List<T> getContent();

Source Link

Document

Returns the page content as List .

Usage

From source file:curly.commons.web.hateoas.PageProcessor.java

public static <T> List<T> fromPage(Page<T> page) {
    Assert.notNull(page, "Page element must be not null");
    return page.getContent();
}

From source file:com.pamarin.income.model.SelectionModel.java

public static <T> Page<SelectionModel<T>> toSelection(Page<T> page, Pageable pageable) {
    return new PageImpl(toSelection(page.getContent()), pageable, page.getTotalElements());
}

From source file:curly.artifact.PagedArtifact.java

public PagedArtifact(Page<Artifact> artifacts) {
    super(artifacts.getContent(), new PageMetadata(artifacts.getSize(), artifacts.getNumber(),
            artifacts.getTotalElements(), artifacts.getTotalPages()));
}

From source file:id.ac.ipb.ilkom.training.service.jpa.ProductServiceJpa.java

@Override
public List<Product> getProducts(Integer indexStart, Integer numOfRows) {
    int page = indexStart / numOfRows;
    PageRequest pageRequest = new PageRequest(page, numOfRows);
    Page<Product> products = productRepository.findAll(pageRequest);
    return products.getContent();

}

From source file:co.id.ipb.ilkom.training.service.jpa.CustomerServiceJpa.java

@Override
public List<Customer> getCustomers(Integer indexStart, Integer numOfRows) {
    int page = indexStart / numOfRows;
    PageRequest pageRequest = new PageRequest(page, numOfRows);
    Page<Customer> customers = customerRepository.findAll(pageRequest);
    return customers.getContent();
}

From source file:de.appsolve.padelcampus.api.controllers.ApiBaseController.java

@RequestMapping(method = GET, value = "options", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseBody// w  ww .  ja v  a2s.  c  o  m
public List<Option> getOptions(HttpServletRequest request, @RequestParam("q") String q) {
    Player user = sessionUtil.getUser(request);
    if (user == null) {
        return null;
    }
    List<Option> options = new ArrayList<>();
    if (!StringUtils.isEmpty(q)) {
        Page<T> page = dao.findAllByFuzzySearch(q);
        for (T model : page.getContent()) {
            options.add(getOption(model));
        }
    }
    return options;
}

From source file:cn.aozhi.songify.repository.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 source file:com.pamarin.income.repo.IncomeItemRepoT.java

@Test
public void findMaxItemByOwner() {
    User owner = new User();
    owner.setId(1);/*www .  ja  va 2s . co  m*/
    PageRequest request = new PageRequest(0, 1, Sort.Direction.DESC, "incomeValue");
    Page<Statistic> result = repo.findItemByOwner(owner, request);
    Assert.assertEquals("yyy", result.getContent().get(0).getKey());
}

From source file:com.trenako.web.infrastructure.PageLinksBuilder.java

public PageLinksBuilder(Page<T> page) {
    this(page.getContent(), page.getNumberOfElements(), page.getTotalPages());
}

From source file:org.neo4j.hubway.core.StationRepositoryIntegrationTest.java

@Test
@SuppressWarnings("unchecked")
public void lookupStationsByDescription() {

    Pageable pageable = new PageRequest(0, 1, Direction.DESC, "station.name");
    Page<Station> page = repository.findByNameLike("Square", pageable);

    assertThat(page.getContent().size(), is(1));
    Station station = page.getContent().get(0);
    assertThat(station.getId(), is(end.getId()));
    assertThat(station.getTerminalName(), is(end.getTerminalName()));
    assertThat(page.isFirstPage(), is(true));
}