当前位置: 首页>>代码示例>>Java>>正文


Java Page.getContent方法代码示例

本文整理汇总了Java中org.springframework.data.domain.Page.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java Page.getContent方法的具体用法?Java Page.getContent怎么用?Java Page.getContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.data.domain.Page的用法示例。


在下文中一共展示了Page.getContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: searchCity

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
public List<City> searchCity(Integer pageNumber,
                             Integer pageSize,
                             String searchContent) {
    // 分页参数
    Pageable pageable = new PageRequest(pageNumber, pageSize);

    // Function Score Query
    FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery()
            .add(QueryBuilders.boolQuery().should(QueryBuilders.matchQuery("cityname", searchContent)),
                ScoreFunctionBuilders.weightFactorFunction(1000))
            .add(QueryBuilders.boolQuery().should(QueryBuilders.matchQuery("description", searchContent)),
                    ScoreFunctionBuilders.weightFactorFunction(100));

    // 创建搜索 DSL 查询
    SearchQuery searchQuery = new NativeSearchQueryBuilder()
            .withPageable(pageable)
            .withQuery(functionScoreQueryBuilder).build();

    LOGGER.info("\n searchCity(): searchContent [" + searchContent + "] \n DSL  = \n " + searchQuery.getQuery().toString());

    Page<City> searchPageResults = cityRepository.search(searchQuery);
    return searchPageResults.getContent();
}
 
开发者ID:nickleeguan,项目名称:springboot-learning-example-master,代码行数:25,代码来源:CityESServiceImpl.java

示例2: listFilesByPage

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@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;
}
 
开发者ID:waylau,项目名称:mongodb-file-server,代码行数:13,代码来源:FileServiceImpl.java

示例3: getAllEntries

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * GET  /entries : get all the entries.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of entries in body
 */
@GetMapping("/entries")
@Timed
public ResponseEntity<List<Entry>> getAllEntries(@ApiParam Pageable pageable) {
    log.debug("REST request to get a page of Entries");
    Page<Entry> page = entryRepository.findByBlogUserLoginOrderByDateDesc(SecurityUtils.getCurrentUserLogin(), pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/entries");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
开发者ID:oktadeveloper,项目名称:jhipster-microservices-example,代码行数:15,代码来源:EntryResource.java

示例4: getByDates

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * 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.atStartOfDay(ZoneId.systemDefault()).toInstant(),
        toDate.atStartOfDay(ZoneId.systemDefault()).plusDays(1).toInstant(),
        pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/management/audits");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:22,代码来源:AuditResource.java

示例5: searchApplications

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * SEARCH  /_search/applications?query=:query : search for the application corresponding
 * to the query.
 *
 * @param query the query of the application search
 * @param pageable the pagination information
 * @return the result of the search
 */
@GetMapping("/_search/applications")
@Timed
public ResponseEntity<List<Application>> searchApplications(@RequestParam String query, Pageable pageable) {
    log.debug("REST request to search for a page of Applications for query {}", query);
    Page<Application> page = applicationService.search(query, pageable);
    HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/applications");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
开发者ID:pascalgrimaud,项目名称:qualitoast,代码行数:17,代码来源:ApplicationResource.java

示例6: getAllUsers

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:deepu105,项目名称:spring-io,代码行数:14,代码来源:UserResource.java

示例7: getAllLinks

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * GET  /links : get all the links.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of links in body
 */
@GetMapping("/links")
@Timed
public ResponseEntity<List<Link>> getAllLinks(@ApiParam Pageable pageable) {
    log.debug("REST request to get a page of Links");
    Page<Link> page = linkService.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/links");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:15,代码来源:LinkResource.java

示例8: findNodeByNotion

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public NotionNodeData findNodeByNotion(String searchText) {
    Page<NotionNodeData> result = nodeRepository.findNodeByNotion(searchText, new PageRequest(0, 1));
    List<NotionNodeData> content = result.getContent();
    if (content.size() > 0){
        return content.get(0);
    }
    return null;
}
 
开发者ID:Vapsel,项目名称:social-media-analytic-system,代码行数:13,代码来源:GraphServiceImpl.java

示例9: getAllLessons

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * GET  /lessons : get all the lessons.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of lessons in body
 */
@GetMapping("/lessons")
@Timed
public ResponseEntity<List<LessonDTO>> getAllLessons(@ApiParam Pageable pageable) {
    log.debug("REST request to get a page of Lessons");
    Page<LessonDTO> page = lessonService.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/lessons");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
开发者ID:ElectronicArmory,项目名称:Armory,代码行数:15,代码来源:LessonResource.java

示例10: listByUser

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
@Override
public List<Message> listByUser(User user, int nbRows)
        throws ServiceException {
    try {
        Pageable pageable = new PageRequest(0, nbRows, sortByLastNameAsc());
        Page<Message> requestedPage = messageDAO.listByUserAndCuInstance(user, cuInstanceName, pageable);
        return requestedPage.getContent();
    } catch (PersistenceException e) {
        throw new ServiceException(e.getLocalizedMessage(), e);
    }
}
 
开发者ID:oncecloud,项目名称:devops-cstack,代码行数:12,代码来源:MessageServiceImpl.java

示例11: getAllContents

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * GET  /contents -> get all the contents.
 */
@RequestMapping(value = "/contents",
    method = RequestMethod.GET,
    produces = MediaType.APPLICATION_JSON_VALUE)
@Timed
public ResponseEntity<List<Content>> getAllContents(Pageable pageable)
    throws URISyntaxException {
    Page<Content> page = contentRepository.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/contents");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
开发者ID:ugouku,项目名称:shoucang,代码行数:14,代码来源:ContentResource.java

示例12: getAllResultats

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * GET  /resultats : get all the resultats.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of resultats in body
 */
@GetMapping("/resultats")
@Timed
public ResponseEntity<List<Resultat>> getAllResultats(Pageable pageable) {
    log.debug("REST request to get a page of Resultats");
    Page<Resultat> page = resultatService.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/resultats");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
开发者ID:pascalgrimaud,项目名称:qualitoast,代码行数:15,代码来源:ResultatResource.java

示例13: getAll

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * 翻页获取管理员
 *
 * @param adminUser
 * @param draw:请求次数
 * @param start
 * @param length
 * @return
 */
@GetMapping
public PageResult getAll(AdminUser adminUser, String draw,
                         @RequestParam(required = false, defaultValue = "1") int start,
                         @RequestParam(required = false, defaultValue = "10") int length) {
    int pageNo = start / length;
    Page<AdminUser> page = adminUserService.findByPage(adminUser, pageNo, length);
    PageResult<List<AdminUser>> result = new PageResult<>(
            draw,
            page.getTotalElements(),
            page.getTotalElements(),
            page.getContent());
    return result;
}
 
开发者ID:ChinaLHR,项目名称:JavaQuarkBBS,代码行数:23,代码来源:AdminUserController.java

示例14: getAllPermissions

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * GET  /permissions : get all the permissions.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and the list of permissions in body
 * @throws URISyntaxException if there is an error to generate the pagination HTTP headers
 */
@GetMapping("/permissions")
@Timed
@Secured(AuthoritiesConstants.SUPPORT)
public ResponseEntity<List<Permission>> getAllPermissions(@ApiParam Pageable pageable)
    throws URISyntaxException {
    log.debug("REST request to get a page of Permissions");
    Page<Permission> page = permissionService.findAll(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/permissions");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
 
开发者ID:quanticc,项目名称:sentry,代码行数:18,代码来源:PermissionResource.java

示例15: getAllApplications

import org.springframework.data.domain.Page; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:pascalgrimaud,项目名称:qualitoast,代码行数:15,代码来源:ApplicationResource.java


注:本文中的org.springframework.data.domain.Page.getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。