當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。