Examples of PageRequest


Examples of org.jboss.errai.common.client.PageRequest

  @Inject
  private Caller<AuthenticationService> authenticationService;

  public void observer(@Observes NavigationEvent event) {
    final PageRequest pageRequest = event.getPageRequest();
    try {
      authenticationService.call(new RemoteCallback<Boolean>() {
        @Override
        public void callback(Boolean response) {
          if (!response) {
View Full Code Here

Examples of org.jtalks.jcommune.model.dto.PageRequest

        return dto;
    }


    private void prepareViewTopicMocks(Topic topic, String page) throws NotFoundException {
        PageRequest pageable = new PageRequest(page, 15);
        Page<Post> postsPage = new PageImpl<>(topic.getPosts(), pageable, 30L);
        when(userService.getCurrentUser()).thenReturn(topic.getTopicStarter());
        when(topicFetchService.get(TOPIC_ID)).thenReturn(topic);
        when(breadcrumbBuilder.getForumBreadcrumb(topic)).thenReturn(new ArrayList<Breadcrumb>());
        when(postService.getPosts(topic, page)).thenReturn(postsPage);
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

  public void createsPagedResourcesForOneIndexedArgumentResolver() {

    resolver.setOneIndexedParameters(true);
    PagedResourcesAssembler<Person> assembler = new PagedResourcesAssembler<Person>(resolver, null);

    AbstractPageRequest request = new PageRequest(0, 1);
    Page<Person> page = new PageImpl<Person>(Collections.<Person> emptyList(), request, 0);

    assembler.toResource(page);
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

    assertThat(result.getVariableNames(), hasItems("projection", "size", "sort"));
  }

  private static Page<Person> createPage(int index) {

    AbstractPageRequest request = new PageRequest(index, 1);

    Person person = new Person();
    person.name = "Dave";

    return new PageImpl<Person>(Arrays.asList(person), request, 3);
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

    StringWriter writer = new StringWriter();
    Wrapper wrapper = new Wrapper();
    wrapper.pageable = pageable;
    wrapper.sort = sort;
    wrapper.pageableWithoutSort = new PageRequest(10, 20);
    marshaller.marshal(wrapper, writer);

    assertThat(new Diff(reference, writer.toString()).similar(), is(true));
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

    CrudWithFindAllWithSort repository = mock(CrudWithFindAllWithSort.class);

    Method findAllWithSort = CrudWithFindAllWithSort.class.getMethod("findAll", Sort.class);

    getInvokerFor(repository, expectInvocationOf(findAllWithSort)).invokeFindAll((Pageable) null);
    getInvokerFor(repository, expectInvocationOf(findAllWithSort)).invokeFindAll(new PageRequest(0, 10));
    getInvokerFor(repository, expectInvocationOf(findAllWithSort)).invokeFindAll((Sort) null);
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

    CrudWithFindAllWithPageable repository = mock(CrudWithFindAllWithPageable.class);

    Method findAllWithPageable = CrudWithFindAllWithPageable.class.getMethod("findAll", Pageable.class);

    getInvokerFor(repository, expectInvocationOf(findAllWithPageable)).invokeFindAll((Pageable) null);
    getInvokerFor(repository, expectInvocationOf(findAllWithPageable)).invokeFindAll(new PageRequest(0, 10));
  }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

    PostRepository posts;

    @GET
    @ApiOperation(value = "list", notes = "get all posts paged", response = Post.class)
    public Iterable<Post> get(@QueryParam("page") @DefaultValue("0") int page) {
        return posts.findAll(new PageRequest(page, 2));
    }
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

   */
  @Test
  public void exposesPageableParameter() throws Exception {

    this.method = SampleRepo.class.getMethod("findByFirstname", String.class, Pageable.class);
    PageRequest pageable = new PageRequest(2, 3, new Sort(Direction.DESC, "lastname"));

    assertThat(evaluateExpression("#pageable.offset", new Object[] { "test", pageable }), is((Object) 6));
    assertThat(evaluateExpression("#pageable.pageSize", new Object[] { "test", pageable }), is((Object) 3));
    assertThat(evaluateExpression("#pageable.sort.toString()", new Object[] { "test", pageable }),
        is((Object) "lastname: DESC"));
View Full Code Here

Examples of org.springframework.data.domain.PageRequest

    pageSize = pageSize < 1 ? defaultOrFallback.getPageSize() : pageSize;
    // Limit upper bound
    pageSize = pageSize > maxPageSize ? maxPageSize : pageSize;

    Sort sort = sortResolver.resolveArgument(methodParameter, mavContainer, webRequest, binderFactory);
    return new PageRequest(page, pageSize, sort == null ? defaultOrFallback.getSort() : sort);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.