本文整理汇总了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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}