Package org.springframework.data.domain

Examples of org.springframework.data.domain.Sort


        ISODate beginDateIso = new ISODate(beginDate);
        ISODate endDateIso = new ISODate(endDate);
        Set<Integer> groupList = ReportUtils.groupsForFilter(context, params);

        // Retrieve metadata file downloads
        final Sort sort = new Sort(Sort.Direction.ASC, SortUtils.createPath(MetadataFileDownload_.downloadDate));
        final List<MetadataFileDownload> records = context.getBean(MetadataFileDownloadRepository.class).findAll(
                MetadataFileDownloadSpecs.downloadDateBetweenAndByGroups(beginDateIso, endDateIso, groupList), sort);

        // Process metadata results for the report
        Element response = new Element(Jeeves.Elem.RESPONSE);
View Full Code Here


        assertEquals(md1.getId(), found.get(1).one().intValue());
        assertEquals(editUser, found.get(0).two());
        assertEquals(reviewerUser, found.get(1).two());

        found = _userRepo.findAllByGroupOwnerNameAndProfile(Arrays.asList(md1.getId()), null,
                new Sort(new Sort.Order(Sort.Direction.DESC, User_.name.getName())));

        assertEquals(2, found.size());
        assertEquals(md1.getId(), found.get(0).one().intValue());
        assertEquals(md1.getId(), found.get(1).one().intValue());
        assertEquals(editUser, found.get(1).two());
View Full Code Here

        if (Log.isDebugEnabled(Geonet.DATA_MANAGER))
            Log.debug(Geonet.DATA_MANAGER, "INDEX CONTENT:");


        Sort sortByMetadataChangeDate = SortUtils.createSort(Metadata_.dataInfo, MetadataDataInfo_.changeDate);
        int currentPage=0;
        Page<Pair<Integer, ISODate>> results = _metadataRepository.findAllIdsAndChangeDates(new PageRequest(currentPage,
                METADATA_BATCH_PAGE_SIZE, sortByMetadataChangeDate));

View Full Code Here

            }

            final MetadataStatusRepository statusRepository = _applicationContext.getBean(MetadataStatusRepository.class);

            // get status
            Sort statusSort = new Sort(Sort.Direction.DESC, MetadataStatus_.id.getName() + "." + MetadataStatusId_.changeDate.getName());
            List<MetadataStatus> statuses = statusRepository.findAllById_MetadataId(id$, statusSort);
            if (!statuses.isEmpty()) {
                MetadataStatus stat = statuses.get(0);
                String status = String.valueOf(stat.getId().getStatusId());
                moreFields.add(SearchManager.makeField("_status", status, true, true));
View Full Code Here

     *
     */
    public MetadataStatus getStatus(int metadataId) throws Exception {
        String sortField = SortUtils.createPath(MetadataStatus_.id,MetadataStatusId_.changeDate);
        final MetadataStatusRepository statusRepository = _applicationContext.getBean(MetadataStatusRepository.class);
        List<MetadataStatus> status = statusRepository.findAllById_MetadataId(metadataId, new Sort(Sort.Direction.DESC, sortField));
        if (status.isEmpty()) {
            return null;
        } else {
            return status.get(0);
        }
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

    return this;
  }

  public QueryBuilder with(Pageable pageable) {
    Sort sort = pageable.getSort();
    if(sort != null) {
      with(sort);
    }

    if(pageable.getPageSize() > 0) {
View Full Code Here

   * @param pageable can be {@literal null}.
   * @return
   */
  protected TypedQuery<T> getQuery(Specification<T> spec, Pageable pageable) {

    Sort sort = pageable == null ? null : pageable.getSort();
    return getQuery(spec, sort);
  }
View Full Code Here

  @Test
  public void returnsAllSortedCorrectly() throws Exception {

    flushTestUsers();
    List<User> result = repository.findAll(new Sort(ASC, "lastname"));
    assertThat(result, is(notNullValue()));
    assertThat(result.size(), is(4));
    assertThat(result.get(0), is(secondUser));
    assertThat(result.get(1), is(firstUser));
    assertThat(result.get(2), is(thirdUser));
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.