Java Code Examples for org.springframework.data.domain.Pageable

The following are top voted examples for showing how to use org.springframework.data.domain.Pageable. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: iotplatform   File: UserRepository.java   Source Code and License 9 votes vote down vote up
@Query("SELECT u FROM UserEntity u WHERE u.tenantId = :tenantId " +
        "AND u.customerId = :customerId AND u.authority = :authority " +
        "AND LOWER(u.searchText) LIKE LOWER(CONCAT(:searchText, '%'))" +
        "AND u.id > :idOffset ORDER BY u.id")
List<UserEntity> findUsersByAuthority(@Param("tenantId") String tenantId,
                                      @Param("customerId") String customerId,
                                      @Param("idOffset") String idOffset,
                                      @Param("searchText") String searchText,
                                      @Param("authority") Authority authority,
                                      Pageable pageable);
 
Example 2
Project: nixmash-blog   File: CustomProductRepository.java   Source Code and License 6 votes vote down vote up
@Query(value = "*:*", filters = { "doctype:product" })
@Facet(fields = IProduct.CATEGORY_FIELD, limit = 6)
public FacetPage<Product> findProductCategoryFacets(Pageable page);
 
Example 3
Project: spring-data-snowdrop   File: SnowdropTemplate.java   Source Code and License 6 votes vote down vote up
@Override
public <T> Slice<T> findSlice(Query<T> query) {
    List<T> list = findAllInternal(query);
    Pageable pageable = query.getPageable();
    if (pageable != null) {
        boolean hasNext = ((pageable.getPageNumber() + 1) * pageable.getPageSize() < total(query));
        return new SliceImpl<T>(list, query.getPageable(), hasNext);
    } else {
        return new SliceImpl<T>(list);
    }
}
 
Example 4
Project: codemotion-2017-taller-de-jhipster   File: TaskResource.java   Source Code and License 5 votes vote down vote up
/**
 * GET  /tasks : get all the tasks.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of tasks in body
 */
@GetMapping("/tasks")
@Timed
public ResponseEntity<List<Task>> getAllTasks(@ApiParam Pageable pageable) {
    log.debug("REST request to get a page of Tasks");
    final Page<Task> page;
    if (SecurityUtils.isCurrentUserInRole(AuthoritiesConstants.ADMIN)) {
    	page = this.taskRepository.findAll(pageable);
    } else {
    	page = this.taskRepository.findAllByUser(SecurityUtils.getCurrentUserLogin(), pageable);
    }
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/tasks");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 5
Project: xm-commons   File: PermittedRepository.java   Source Code and License 5 votes vote down vote up
/**
 * Find all pageable permitted entities.
 * @param pageable the page info
 * @param entityClass the entity class to get
 * @param privilegeKey the privilege key for permission lookup
 * @param <T> the type of entity
 * @return page of permitted entities
 */
public <T> Page<T> findAll(Pageable pageable, Class<T> entityClass, String privilegeKey) {
    String selectSql = String.format(SELECT_ALL_SQL, entityClass.getSimpleName());
    String countSql = String.format(COUNT_ALL_SQL, entityClass.getSimpleName());

    String permittedCondition = createPermissionCondition(privilegeKey);
    if (StringUtils.isNotBlank(permittedCondition)) {
        selectSql += WHERE_SQL + permittedCondition;
        countSql += WHERE_SQL + permittedCondition;
    }

    log.debug("Executing SQL '{}'", selectSql);

    return execute(createCountQuery(countSql), pageable, createSelectQuery(selectSql, pageable, entityClass));
}
 
Example 6
Project: iotplatform   File: JpaRelationDao.java   Source Code and License 5 votes vote down vote up
@Override
public ListenableFuture<List<EntityRelation>> findRelations(EntityId from, String relationType,
    RelationTypeGroup typeGroup, ThingType childType, TimePageLink pageLink) {
  Specification<RelationEntity> timeSearchSpec = JpaAbstractSearchTimeDao
      .<RelationEntity>getTimeSearchPageSpec(pageLink, "toId");
  Specification<RelationEntity> fieldsSpec = getEntityFieldsSpec(from, relationType, typeGroup, childType);
  Pageable pageable = new PageRequest(0, pageLink.getLimit(),
      new Sort(new Order(ASC, "relationTypeGroup"), new Order(ASC, "relationType"), new Order(ASC, "toType")));
  return service.submit(() -> DaoUtil
      .convertDataList(relationRepository.findAll(where(timeSearchSpec).and(fieldsSpec), pageable).getContent()));
}
 
Example 7
Project: sentry   File: PrivilegeResource.java   Source Code and License 5 votes vote down vote up
/**
 * GET  /privileges : get all the privileges.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of privileges in body
 * @throws URISyntaxException if there is an error to generate the pagination HTTP headers
 */
@GetMapping("/privileges")
@Timed
@Secured(AuthoritiesConstants.SUPPORT)
public ResponseEntity<List<Privilege>> getAllPrivileges(@ApiParam Pageable pageable)
    throws URISyntaxException {
    log.debug("REST request to get a page of Privileges");
    Page<Privilege> page = privilegeRepository.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/privileges");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 8
Project: jhipster-microservices-example   File: EntryResource.java   Source Code and License 5 votes vote down vote up
/**
 * SEARCH  /_search/entries?query=:query : search for the entry corresponding
 * to the query.
 *
 * @param query the query of the entry search
 * @param pageable the pagination information
 * @return the result of the search
 */
@GetMapping("/_search/entries")
@Timed
public ResponseEntity<List<Entry>> searchEntries(@RequestParam String query, @ApiParam Pageable pageable) {
    log.debug("REST request to search for a page of Entries for query {}", query);
    Page<Entry> page = entrySearchRepository.search(queryStringQuery(query), pageable);
    HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/entries");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 9
Project: filter-sort-jooq-api   File: TransferTimingPageRepositoryImplPureJooq.java   Source Code and License 5 votes vote down vote up
/**
 * Build full select query with filter without paging
 *
 * @param pageable      the pagination information
 * @param requestParams the queries of the search
 * @return list of dtos
 */
private List<TransferTimingListingDTO> basicSelectFilterWithoutPaging(Pageable pageable, Map<String, String> requestParams) {
    return buildQuery(basicSelectQuery())
        .and(buildConditions(requestParams))
        .orderBy(buildSort(pageable.getSort()))
        .fetch()
        .map(TransferTimingPageRepositoryImpl::recordToDto);
}
 
Example 10
Project: document-management-store-app   File: StoredDocumentSearchControllerTests.java   Source Code and License 5 votes vote down vote up
@Test
public void testValidCommandAndSearchReturn3Documents() throws Exception {
    MetadataSearchCommand searchCommand = new MetadataSearchCommand("name", "thename");

    List<StoredDocument> documents = Arrays.asList(
        new StoredDocument(),
        new StoredDocument(),
        new StoredDocument());

    PageRequest pageRequest = new PageRequest(0, 2);

    when(
        this.searchService
            .findStoredDocumentsByMetadata(eq(searchCommand), any(Pageable.class)))
        .thenReturn(new PageImpl<>(documents, pageRequest, 3));

    restActions
        .withAuthorizedUser("userId")
        .withAuthorizedService("divorce")
        .post("/documents/filter", searchCommand)
        .andExpect(status().isOk())
        .andExpect(jsonPath("$.page.size", is(2)))
        .andExpect(jsonPath("$.page.totalElements", is(3)))
        .andExpect(jsonPath("$.page.totalPages", is(2)))
        .andExpect(jsonPath("$.page.number", is(0)))
        .andExpect(jsonPath("$._links.first.href", is("http://localhost/documents/filter?page=0&size=2")))
        .andExpect(jsonPath("$._links.self.href", is("http://localhost/documents/filter?page=0&size=2")))
        .andExpect(jsonPath("$._links.next.href", is("http://localhost/documents/filter?page=1&size=2")))
        .andExpect(jsonPath("$._links.last.href", is("http://localhost/documents/filter?page=1&size=2")));
}
 
Example 11
Project: MTC_Labrat   File: AuditResource.java   Source Code and License 5 votes vote down vote up
/**
 * GET  /audits : get a page of AuditEvents between the fromDate and toDate.
 *
 * @param fromDate the start of the time period of AuditEvents to get
 * @param toDate the end of the time period of AuditEvents to get
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of AuditEvents in body
 */

@GetMapping(params = {"fromDate", "toDate"})
public ResponseEntity<List<AuditEvent>> getByDates(
    @RequestParam(value = "fromDate") LocalDate fromDate,
    @RequestParam(value = "toDate") LocalDate toDate,
    @ApiParam Pageable pageable) {

    Page<AuditEvent> page = auditEventService.findByDates(fromDate.atTime(0, 0), toDate.atTime(23, 59), pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/management/audits");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 12
Project: spring-io   File: ProductResource.java   Source Code and License 5 votes vote down vote up
/**
 * GET  /products : get all the products.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of products in body
 */
@GetMapping("/products")
@Timed
public ResponseEntity<List<Product>> getAllProducts(@ApiParam Pageable pageable) {
    log.debug("REST request to get a page of Products");
    Page<Product> page = productService.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/products");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 13
Project: spring-data-examples   File: StoresController.java   Source Code and License 5 votes vote down vote up
/**
 * Looks up the stores in the given distance around the given location.
 * 
 * @param model the {@link Model} to populate.
 * @param location the optional location, if none is given, no search results will be returned.
 * @param distance the distance to use, if none is given the {@link #DEFAULT_DISTANCE} is used.
 * @param pageable the pagination information
 * @return
 */
@RequestMapping(value = "/", method = RequestMethod.GET)
String index(Model model, @RequestParam Optional<Point> location, @RequestParam Optional<Distance> distance,
		Pageable pageable) {

	Point point = location.orElse(KNOWN_LOCATIONS.get("Timesquare NY"));

	Page<Store> stores = repository.findByAddressLocationNear(point, distance.orElse(DEFAULT_DISTANCE), pageable);

	model.addAttribute("stores", stores);
	model.addAttribute("distances", DISTANCES);
	model.addAttribute("selectedDistance", distance.orElse(DEFAULT_DISTANCE));
	model.addAttribute("location", point);
	model.addAttribute("locations", KNOWN_LOCATIONS);
	model.addAttribute("api", entityLinks.linkToSearchResource(Store.class, "by-location", pageable).getHref());

	return "index";
}
 
Example 14
Project: mongodb-file-server   File: FileServiceImpl.java   Source Code and License 5 votes vote down vote up
@Override
public List<File> listFilesByPage(int pageIndex, int pageSize) {
	Page<File> page = null;
	List<File> list = null;
	
	Sort sort = new Sort(Direction.DESC,"uploadDate"); 
	Pageable pageable = new PageRequest(pageIndex, pageSize, sort);
	
	page = fileRepository.findAll(pageable);
	list = page.getContent();
	return list;
}
 
Example 15
Project: spring-data-snowdrop   File: AbstractQueryAdapter.java   Source Code and License 5 votes vote down vote up
protected void addPagingToQuery(me.snowdrop.data.core.spi.Query<T> query) {
    Pageable pageable = query.getPageable();
    if (pageable != null && pageable.isPaged()) {
        org.springframework.data.domain.Sort sort = pageable.getSort();
        if (query.getSort() == null && sort.isSorted()) {
            addSortToQuery(sort);
        }
        setFirstResult(pageable.getOffset());
        setMaxResults(pageable.getPageSize());
    }
}
 
Example 16
Project: yadaframework   File: YadaSql.java   Source Code and License 5 votes vote down vote up
/**
 * Add sorting from a Spring Data Pageable
 * @param pageable
 * @return
 */
public YadaSql orderBy(Pageable pageable) {
	Iterator<Sort.Order> orders = pageable.getSort().iterator();
	while (orders.hasNext()) {
		Sort.Order order = orders.next();
		orderBy(order.getProperty() + " " + order.getDirection());
	}
	return this;
}
 
Example 17
Project: qualitoast   File: ApplicationResource.java   Source Code and License 5 votes vote down vote up
/**
 * GET  /applications : get all the applications.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of applications in body
 */
@GetMapping("/applications")
@Timed
public ResponseEntity<List<Application>> getAllApplications(Pageable pageable) {
    log.debug("REST request to get a page of Applications");
    Page<Application> page = applicationService.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/applications");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 18
Project: filter-sort-jooq-api   File: TransferTimingPageRepositoryImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Build full select query
 *
 * @param pageable the pagination information
 * @return list of dtos
 */
private List<TransferTimingListingDTO> basicSelect(Pageable pageable) {
    return buildQuery(basicSelectQuery())
        .orderBy(buildOrderBy(pageable.getSort()))
        .limit(pageable.getOffset(), pageable.getPageSize())
        .fetch()
        .map(TransferTimingPageRepositoryImpl::recordToDto);
}
 
Example 19
Project: qualitoast   File: UserResource.java   Source Code and License 5 votes vote down vote up
/**
 * GET /users : get all users.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and with body all users
 */
@GetMapping("/users")
@Timed
@Secured(AuthoritiesConstants.ADMIN)
public ResponseEntity<List<UserDTO>> getAllUsers(Pageable pageable) {
    final Page<UserDTO> page = userService.getAllManagedUsers(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 20
Project: Code4Health-Platform   File: OperinoServiceImpl.java   Source Code and License 5 votes vote down vote up
/**
 * Search for the operino corresponding to the query.
 *
 *  @param query the query of the search
 *  @return the list of entities
 */
@Override
@Transactional(readOnly = true)
public Page<Operino> search(String query, Pageable pageable) {
    log.debug("Request to search for a page of Operinos for query {}", query);
    Page<Operino> result = operinoSearchRepository.search(queryStringQuery(query), pageable);
    return result;
}
 
Example 21
Project: spring-boot-oauth2-demo   File: ExampleController.java   Source Code and License 5 votes vote down vote up
@ApiOperation(value = "queryCompanys", notes = "获取 公司分页")
@GetMapping("/all_company/page")
public ModelResult<List<Company>> queryCompanys(Pageable pageable,
                                                HttpServletRequest request,
                                                HttpServletResponse response) throws URISyntaxException {
    
    ModelResult<List<Company>> result = new ModelResult<>();
    Page<Company> companies = companyMapper.selectAllPageable(pageable);
    result.setData(companies.getContent());
    
    PaginationUtil.setPaginationHttpHeaders(companies, request,response);
    return result;
}
 
Example 22
Project: spring-rest-commons-options   File: ReflectionUtils.java   Source Code and License 5 votes vote down vote up
public static List<Parameter> getParametersBody(Method m) {
	return Arrays.asList(m.getParameters()).stream().filter(p -> {
		boolean ok = p.getAnnotation(PathVariable.class) == null;
		ok = ok && p.getAnnotation(RequestParam.class) == null;
		ok = ok && !Pageable.class.isAssignableFrom(p.getType());
		return ok;
	}).collect(Collectors.toList());
}
 
Example 23
Project: ingest-core   File: SubmissionController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(path = "/submissionEnvelopes/{sub_id}/assays", method = RequestMethod.GET)
ResponseEntity<?> getAssays(@PathVariable("sub_id") SubmissionEnvelope submissionEnvelope,
                            Pageable pageable,
                            final PersistentEntityResourceAssembler resourceAssembler) {
    Page<Assay> assays = getAssayRepository().findBySubmissionEnvelopesContaining(submissionEnvelope, pageable);
    return ResponseEntity.ok(getPagedResourcesAssembler().toResource(assays, resourceAssembler));
}
 
Example 24
Project: Microservices-with-JHipster-and-Spring-Boot   File: TagResource.java   Source Code and License 5 votes vote down vote up
/**
 * SEARCH  /_search/tags?query=:query : search for the tag corresponding
 * to the query.
 *
 * @param query the query of the tag search 
 * @param pageable the pagination information
 * @return the result of the search
 */
@GetMapping("/_search/tags")
@Timed
public ResponseEntity<List<Tag>> searchTags(@RequestParam String query, @ApiParam Pageable pageable) {
    log.debug("REST request to search for a page of Tags for query {}", query);
    Page<Tag> page = tagSearchRepository.search(queryStringQuery(query), pageable);
    HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/tags");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 25
Project: OperatieBRP   File: EnumReadonlyRepository.java   Source Code and License 5 votes vote down vote up
@Override
public final Page<T> findAll(final Specification<T> spec, final Pageable pageable) {
    final int fromIndex = pageable.getPageNumber() * pageable.getPageSize();
    if (fromIndex >= values.size()) {
        return new PageImpl<>(Collections.<T>emptyList(), pageable, values.size());
    }
    int toIndex = pageable.getPageNumber() * pageable.getPageSize() + pageable.getPageSize();
    if (toIndex > values.size()) {
        toIndex = values.size();
    }

    return new PageImpl<>(values.subList(fromIndex, toIndex), pageable, values.size());
}
 
Example 26
Project: apollo-custom   File: InstanceServiceTest.java   Source Code and License 5 votes vote down vote up
@Test
@Rollback
public void testFindActiveInstanceConfigs() throws Exception {
  long someInstanceId = 1;
  long anotherInstanceId = 2;
  String someConfigAppId = "someConfigAppId";
  String someConfigClusterName = "someConfigClusterName";
  String someConfigNamespaceName = "someConfigNamespaceName";
  Date someValidDate = new Date();
  Pageable pageable = new PageRequest(0, 10);
  String someReleaseKey = "someReleaseKey";

  Calendar calendar = Calendar.getInstance();
  calendar.add(Calendar.DATE, -2);
  Date someInvalidDate = calendar.getTime();

  prepareInstanceConfigForInstance(someInstanceId, someConfigAppId, someConfigClusterName,
      someConfigNamespaceName, someReleaseKey, someValidDate);
  prepareInstanceConfigForInstance(anotherInstanceId, someConfigAppId, someConfigClusterName,
      someConfigNamespaceName, someReleaseKey, someInvalidDate);

  Page<InstanceConfig> validInstanceConfigs = instanceService
      .findActiveInstanceConfigsByReleaseKey(someReleaseKey, pageable);

  assertEquals(1, validInstanceConfigs.getContent().size());
  assertEquals(someInstanceId, validInstanceConfigs.getContent().get(0).getInstanceId());
}
 
Example 27
Project: saluki   File: UserAdminController.java   Source Code and License 5 votes vote down vote up
@RequestMapping(method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                         MediaType.APPLICATION_XHTML_XML_VALUE })
public String listAllUsers(@RequestParam(name = "type", required = false) String editType,
                           @RequestParam(name = "edit", required = false) String editUsername, Model model,
                           Pageable pageable) {
    model.addAttribute("roles", roleRepository.findAll());
    if (!StringUtils.isEmpty(editType)) {
        if (!StringUtils.isEmpty(editUsername)) {
            model.addAttribute("editUser", userRepository.findOneByUsername(editUsername).map(userEntity -> {
                Map<String, Object> editUserMap = new HashMap<>();
                editUserMap.put("username", userEntity.getUsername());
                editUserMap.put("roles",
                                userEntity.getRoles().stream().map(xref -> xref.getRole().getName()).collect(Collectors.toList()));
                return editUserMap;
            }).orElse(null));
        }
        return "userrole/user";
    }
    model.addAttribute("users", userRepository.findAll(pageable));
    return "userrole/users";
}
 
Example 28
Project: jkes   File: AbstractIndexer.java   Source Code and License 5 votes vote down vote up
protected void init() {
    Set<Class<?>> documentClasses = metadata.getAnnotatedDocuments();
    documentClasses.forEach(clazz -> {
        PagingAndSortingRepository repository = getRepositoryBean(clazz);
        addTask(new IndexTask() {
            @Override
            public Class<?> getDomainClass() {
                return clazz;
            }

            @Override
            public long count() {
                return repository.count();
            }

            @Override
            public Page<?> getData(Pageable pageable) {
                return repository.findAll(pageable);
            }
        });

        this.progress.put(clazz.getCanonicalName(), new IndexProgress(clazz, repository.count(), (long) 0));
    });
}
 
Example 29
Project: speakTogether   File: UserResource.java   Source Code and License 5 votes vote down vote up
/**
 * GET  /users : get all users.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and with body all users
 */
@GetMapping("/users")
@Timed
public ResponseEntity<List<UserDTO>> getAllUsers(@ApiParam Pageable pageable) {
    final Page<UserDTO> page = userService.getAllManagedUsers(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 30
Project: sentry   File: GameServerResource.java   Source Code and License 4 votes vote down vote up
/**
 * GET  /game-servers : get all the gameServers.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of gameServers in body
 * @throws URISyntaxException if there is an error to generate the pagination HTTP headers
 */
@GetMapping("/game-servers")
@Timed
@Secured(AuthoritiesConstants.SUPPORT)
public ResponseEntity<List<GameServerDTO>> getAllGameServers(@ApiParam Pageable pageable)
    throws URISyntaxException {
    log.debug("REST request to get a page of GameServers");
    Page<GameServerDTO> page = gameServerService.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/game-servers");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
Example 31
Project: mall   File: AdminOrderController.java   Source Code and License 4 votes vote down vote up
/**
 * 获取所有订单
 * @param pageindex
 * @param pageSize
 * @return
 */
@ResponseBody
@RequestMapping("/list.do")
public ResultBean<List<Order>> listData(int pageindex,
                                        @RequestParam(value = "pageSize", defaultValue = "15") int pageSize) {
    Pageable pageable = new PageRequest(pageindex, pageSize, null);
    List<Order> list = orderService.findAll(pageable).getContent();
    return new ResultBean<>(list);
}
 
Example 32
Project: Spring-OAuth2-Custom   File: MahasiswaController.java   Source Code and License 4 votes vote down vote up
@GetMapping(value = "/mahasiswas")
@CrossOrigin
public HttpEntity<Page<Mahasiswa>> getMahasiswas(Pageable pageable) {
    return new ResponseEntity<>(mahasiswaService.getMahasiswas(pageable), HttpStatus.OK);
}
 
Example 33
Project: jkes   File: PageRequest.java   Source Code and License 4 votes vote down vote up
@Override
public Pageable next() {
    return null;
}
 
Example 34
Project: unibave-backend   File: AlunoResourceImpl.java   Source Code and License 4 votes vote down vote up
@Override
public Response lista(String nome, int page, int limit, String sort, String direction) {
    Pageable pageagle = new PageRequest(page, limit, 
            Sort.Direction.fromString(direction), sort);
    return Response.ok(service.lista(pageagle, nome)).build();
}
 
Example 35
Project: xm-uaa   File: AuditEventService.java   Source Code and License 4 votes vote down vote up
public Page<AuditEvent> findAll(Pageable pageable) {
    return persistenceAuditEventRepository.findAll(pageable)
        .map(auditEventConverter::convertToAuditEvent);
}
 
Example 36
Project: saluki   File: RoleAdminController.java   Source Code and License 4 votes vote down vote up
@RequestMapping(method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE,
                                                         MediaType.APPLICATION_XHTML_XML_VALUE })
public String listAllRoles(Model model, Pageable pageable) {

    model.addAttribute("roles", roleRepository.findAll(pageable));
    return "userrole/roles";
}
 
Example 37
Project: Armory   File: ProgramServiceImpl.java   Source Code and License 4 votes vote down vote up
/**
 *  Get all the programs.
 *  
 *  @param pageable the pagination information
 *  @return the list of entities
 */
@Override
@Transactional(readOnly = true)
public Page<ProgramDTO> findAll(Pageable pageable) {
    log.debug("Request to get all Programs");
    Page<Program> result = programRepository.findAll(pageable);
    return result.map(program -> programMapper.programToProgramDTO(program));
}
 
Example 38
Project: spring-data-snowdrop   File: BaseQuery.java   Source Code and License 4 votes vote down vote up
public void setPageable(Pageable pageable) {
    this.pageable = pageable;
}
 
Example 39
Project: web-framework-for-java   File: ArticleController.java   Source Code and License 4 votes vote down vote up
@ApiOperation(value = "Search title and content by bo or keywords") 
@RequestMapping(value="/search", method = RequestMethod.GET)
public Page<Article> get(
		@RequestParam(name = "bo", required = false) Integer boTypeId,
		@RequestParam(name = "keywords", required = false) String keywords,
		@PageableDefault(value = 10, sort = { "lastUpdate" }, direction = Sort.Direction.DESC) Pageable pageable) {
	if (boTypeId != null && boTypeId > 0 && keywords != null && keywords.length() > 0) {
		return this.articleService.findByBoAndKeywords(boTypeId, keywords, pageable);
	} else if (keywords != null && keywords.length() > 0) {
		return this.articleService.findByKeywords(keywords, pageable);
	} else if (boTypeId != null && boTypeId > 0) {
		return this.articleService.findByBoTypeId(boTypeId, pageable);
	}
	return this.articleService.findAll(pageable);
}
 
Example 40
Project: spring-data-jdbc   File: SQL2008SqlGenerator.java   Source Code and License 4 votes vote down vote up
@Override
public String selectAll(TableDescription table, String whereClause, Pageable page) {
    Sort sort = page.getSort() != null ? page.getSort() : sortById(table);

    return format("%s OFFSET %d ROWS FETCH NEXT %d ROW ONLY",
                  selectAll(table, whereClause, sort), page.getOffset(), page.getPageSize());
}