本文整理汇总了Java中io.ebean.PagedList类的典型用法代码示例。如果您正苦于以下问题:Java PagedList类的具体用法?Java PagedList怎么用?Java PagedList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PagedList类属于io.ebean包,在下文中一共展示了PagedList类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findPagedList
import io.ebean.PagedList; //导入依赖的package包/类
/**
* Execute the query returning a PagedList of hits.
*/
public <T> PagedList<T> findPagedList(DocQueryRequest<T> request) {
SpiQuery<T> query = request.getQuery();
int firstRow = query.getFirstRow();
int maxRows = query.getMaxRows();
BeanSearchParser<T> parser = findHits(query, request.createJsonReadOptions());
try {
List<T> list = parser.read();
request.executeSecondaryQueries(false);
return new HitsPagedList<>(firstRow, maxRows, list, parser.getTotal());
} catch (IOException e) {
throw new PersistenceIOException(e);
}
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:21,代码来源:EQueryService.java
示例2: doExecute
import io.ebean.PagedList; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
protected Object doExecute(final AbstractEbeanQuery repositoryQuery, final Object[] values) {
ParameterAccessor accessor = new ParametersParameterAccessor(parameters, values);
Object createQuery = repositoryQuery.createQuery(values);
if (createQuery instanceof Query) {
Query ormQuery = (Query) createQuery;
PagedList pagedList = ormQuery.findPagedList();
return PageableExecutionUtils.getPage(pagedList.getList(), accessor.getPageable(), () -> pagedList.getTotalCount());
} else if (createQuery instanceof SqlQuery) {
SqlQuery sqlQuery = (SqlQuery) createQuery;
// TODO page
return sqlQuery.findList();
} else {
throw new InvalidEbeanQueryMethodException("query must be Query or SqlQuery");
}
}
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:19,代码来源:AbstractEbeanQueryExecution.java
示例3: findPagedList
import io.ebean.PagedList; //导入依赖的package包/类
@Test
public void findPagedList() throws InterruptedException {
Query<Order> query = Ebean.find(Order.class)
.setUseDocStore(true)
.where().in("customer.id", 1, 2)
.setMaxRows(2)
.orderBy().asc("customer.name");
PagedList<Order> list = query.findPagedList();
assertThat(list.getTotalCount()).isEqualTo(5);
assertThat(list.getList()).hasSize(2);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:15,代码来源:ElasticDocumentStoreTest.java
示例4: pagination
import io.ebean.PagedList; //导入依赖的package包/类
@Test
public void pagination() {
final ComputerRepository computerRepository = app.injector().instanceOf(ComputerRepository.class);
CompletionStage<PagedList<Computer>> stage = computerRepository.page(1, 20, "name", "ASC", "");
// Test the completed result
await().atMost(1, SECONDS).until(() ->
assertThat(stage.toCompletableFuture()).isCompletedWithValueMatching(computers ->
computers.getTotalCount() == 574 &&
computers.getTotalPageCount() == 29 &&
computers.getList().size() == 20
)
);
}
开发者ID:play2-maven-plugin,项目名称:play2-maven-test-projects,代码行数:15,代码来源:ModelTest.java
示例5: PostsPager
import io.ebean.PagedList; //导入依赖的package包/类
public PostsPager(PagedList<Post> postPagedList) {
this.postPagedList = postPagedList;
}
开发者ID:reljicd,项目名称:play-framework-blog,代码行数:4,代码来源:PostsPager.java
示例6: findPagedList
import io.ebean.PagedList; //导入依赖的package包/类
@Override
public <T> PagedList<T> findPagedList(DocQueryRequest<T> request) {
return queryService.findPagedList(request);
}
开发者ID:ebean-orm,项目名称:ebean-elastic,代码行数:5,代码来源:ElasticDocumentStore.java
示例7: findPagedList
import io.ebean.PagedList; //导入依赖的package包/类
@Override
public <T> PagedList<T> findPagedList(Query<T> query, Transaction transaction) {
return delegate.findPagedList(query, transaction);
}
开发者ID:ebean-orm,项目名称:ebean-mocker,代码行数:5,代码来源:DelegateFind.java
示例8: convertToSpringDataPage
import io.ebean.PagedList; //导入依赖的package包/类
/**
* Convert Ebean pagedList Sort to Spring data Page.
*
* @param pagedList
* @param sort
* @param <T>
* @return
*/
public static <T> Page<T> convertToSpringDataPage(PagedList<T> pagedList, Sort sort) {
return new PageImpl<T>(pagedList.getList(),
PageRequest.of(pagedList.getPageIndex(), pagedList.getPageSize(), sort),
pagedList.getTotalCount());
}
开发者ID:hexagonframework,项目名称:spring-data-ebean,代码行数:14,代码来源:Converters.java
示例9: findPagedList
import io.ebean.PagedList; //导入依赖的package包/类
/**
* Return a PagedList for this query using firstRow and maxRows.
* <p>
* The benefit of using this over findList() is that it provides functionality to get the
* total row count etc.
* </p>
* <p>
* If maxRows is not set on the query prior to calling findPagedList() then a
* PersistenceException is thrown.
* </p>
* <p>
* <pre>{@code
*
* PagedList<Order> pagedList = Ebean.find(Order.class)
* .setFirstRow(50)
* .setMaxRows(20)
* .findPagedList();
*
* // fetch the total row count in the background
* pagedList.loadRowCount();
*
* List<Order> orders = pagedList.getList();
* int totalRowCount = pagedList.getTotalRowCount();
*
* }</pre>
*
* @return The PagedList
*/
@Nonnull
public PagedList<T> findPagedList() {
return query.findPagedList();
}
开发者ID:ebean-orm,项目名称:ebean-querybean,代码行数:33,代码来源:TQRootBean.java
示例10: findPagedList
import io.ebean.PagedList; //导入依赖的package包/类
<T> PagedList<T> findPagedList(Query<T> query, Transaction transaction);
开发者ID:ebean-orm,项目名称:ebean-mocker,代码行数:2,代码来源:InterceptFind.java
注:本文中的io.ebean.PagedList类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论