Package org.springframework.data.domain

Examples of org.springframework.data.domain.Sort


  @Test
  public void discoversQualifiedSortFromRequest() {

    MethodParameter parameter = getParameterOfMethod("qualifiedSort");
    Sort reference = new Sort("bar", "foo");

    assertSupportedAndResolvedTo(getRequestWithSort(reference, "qual"), parameter, reference);
  }
View Full Code Here


    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("sort", (String) null);

    SortHandlerMethodArgumentResolver resolver = new SortHandlerMethodArgumentResolver();
    Sort result = resolver.resolveArgument(parameter, null, new ServletWebRequest(request), null);
    assertThat(result, is(nullValue()));
  }
View Full Code Here

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("sort", SORT_3);

    SortHandlerMethodArgumentResolver resolver = new SortHandlerMethodArgumentResolver();
    Sort result = resolver.resolveArgument(parameter, null, new ServletWebRequest(request), null);
    assertThat(result, is(new Sort(Direction.ASC, "firstname", "lastname")));
  }
View Full Code Here

  public void sortParamIsInvalidPropertyWhenMultiProperty() throws Exception {

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("sort", "property1,,DESC");

    assertThat(resolveSort(request, PARAMETER), is(new Sort(DESC, "property1")));
  }
View Full Code Here

    MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("sort", "property,DESC");
    request.addParameter("sort", "");

    assertThat(resolveSort(request, PARAMETER), is(new Sort(DESC, "property")));
  }
View Full Code Here

    Assert.assertEquals(userList.size(), 8);
   
    userList = userRepository.findAll(Specifications.get(PropertyFilters.get("GTI_state", "0")));
    Assert.assertEquals(userList.size(), 8);
   
    userList = userRepository.findAll(Specifications.get(PropertyFilters.get("INS_loginName", "admin,maurice")),new Sort(Direction.DESC, "loginName","realName"));
    Assert.assertEquals(userList.size(), 2);
   
    userList = userRepository.findAll(Specifications.get(PropertyFilters.get("NINS_loginName", "admin,maurice")));
    Assert.assertEquals(userList.size(), 6);
   
View Full Code Here

    Assert.assertEquals(userList.size(), 5);
   
    userList = userRepository.findAll(Specifications.get(Lists.newArrayList(
        PropertyFilters.get("LIKES_loginName", "m"),
        PropertyFilters.get("EQI_state", "1")
    )),new Sort(Direction.DESC, "loginName","realName"));
    Assert.assertEquals(userList.size(), 5);
   
   
    Pageable pageable = new PageRequest(1, 2);
    Page<User> page = userRepository.findAll(Specifications.get(Lists.newArrayList(PropertyFilters.get("EQI_state", "1"))),pageable);
View Full Code Here

    /**
     * Creates default sort.
     */
    private Sort createDefaultSort() {
        return new Sort("lastName", "firstName");
    }
View Full Code Here

{
    @Override
    public Sort buildSort(String field, boolean descending)
    {
        Sort.Direction direction = descending ? Sort.Direction.DESC : Sort.Direction.ASC;
        return new Sort(direction,field);
    }
View Full Code Here

    @Override
    public Sort buildSort(String field, boolean descending)
    {
        Sort.Direction direction = descending ? Sort.Direction.DESC : Sort.Direction.ASC;
        return new Sort(direction,persistentProperty);
    }
View Full Code Here

TOP

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

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.