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


Java QueryRanges类代码示例

本文整理汇总了Java中org.restexpress.query.QueryRanges的典型用法代码示例。如果您正苦于以下问题:Java QueryRanges类的具体用法?Java QueryRanges怎么用?Java QueryRanges使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: readAll

import org.restexpress.query.QueryRanges; //导入依赖的package包/类
public List<User> readAll(Request request, Response response) {
    QueryFilter filter = QueryFilters.parseFrom(request);
    QueryOrder order = QueryOrders.parseFrom(request);
    QueryRange range = QueryRanges.parseFrom(request, 20);
    Page<User> entities = userBo.readAll(filter, range, order);
    response.setCollectionResponse(range, entities.getList().size(), entities.getRowCount());
    HyperExpressBindHelper.bindPaginationTokens(range, entities.getRowCount());
    addTokenBinder();

    return entities.getList();
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:12,代码来源:UserController.java

示例2: readAll

import org.restexpress.query.QueryRanges; //导入依赖的package包/类
@Transactional
public List<UserAuthorization> readAll(Request request, Response response) {
    String uuid = request.getHeader(Constants.Url.USER_UUID, "No User UUID supplied");
    QueryFilter filter = QueryFilters.parseFrom(request);
    QueryOrder order = QueryOrders.parseFrom(request);
    QueryRange range = QueryRanges.parseFrom(request, Constants.DEFAULT_RANGE_LIMIT);
    Page<UserAuthorization> entities
            = userAuthorizationBo.readAllByUserAndService(uuid, filter, range, order);
    response.setCollectionResponse(range, entities.getList().size(), entities.getRowCount());
    HyperExpressBindHelper.bindPaginationTokens(range, entities.getRowCount());
    addTokenBinder();

    return entities.getList();
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:15,代码来源:UserAuthorizationController.java

示例3: readAll

import org.restexpress.query.QueryRanges; //导入依赖的package包/类
public List<Blog> readAll(Request request, Response response)
{
	QueryFilter filter = QueryFilters.parseFrom(request);
	QueryOrder order = QueryOrders.parseFrom(request);
	QueryRange range = QueryRanges.parseFrom(request, 20);
	List<Blog> entities = blogs.readAll(filter, range, order);
	response.setCollectionResponse(range, entities.size(), blogs.count(filter));

	return entities;
}
 
开发者ID:RestExpress,项目名称:RestExpress-Examples,代码行数:11,代码来源:BlogController.java

示例4: readAll

import org.restexpress.query.QueryRanges; //导入依赖的package包/类
public List<Comment> readAll(Request request, Response response)
{
	String blogId = request.getHeader(Constants.Url.BLOG_ID_PARAMETER, "No Blog ID supplied");
	String blogEntryId = request.getHeader(Constants.Url.BLOG_ENTRY_ID_PARAMETER, "No Blog Entry ID supplied");
	final Blog blog = blogs.read(UUID.parse(blogId));
	entries.read(UUID.parse(blogEntryId));

	QueryFilter filter = QueryFilters.parseFrom(request);
	QueryOrder order = QueryOrders.parseFrom(request);
	QueryRange range = QueryRanges.parseFrom(request, 20);
	
	filter.addCriteria("blogEntryId", FilterOperator.EQUALS, UuidConverter.parse(blogEntryId));
	List<Comment> entities = comments.readAll(filter, range, order);
	response.setCollectionResponse(range, entities.size(), comments.count(filter));

	// Bind the resources in the collection with link URL tokens, etc. here...
	HyperExpress.tokenBinder(new TokenBinder<Comment>()
	{
		@Override
		public void bind(Comment entity, TokenResolver resolver)
		{
			resolver.bind(Constants.Url.BLOG_ID_PARAMETER, UUID.format(blog.getUuid()));
		}
	});

	return entities;
}
 
开发者ID:RestExpress,项目名称:RestExpress-Examples,代码行数:28,代码来源:CommentController.java

示例5: readAll

import org.restexpress.query.QueryRanges; //导入依赖的package包/类
public List<BlogEntry> readAll(Request request, Response response)
{
	String blogId = request.getHeader(Constants.Url.BLOG_ID_PARAMETER, "Blog ID not provided");
	QueryFilter filter = QueryFilters.parseFrom(request);
	QueryOrder order = QueryOrders.parseFrom(request);
	QueryRange range = QueryRanges.parseFrom(request, 20);

	filter.addCriteria("blogId", FilterOperator.EQUALS, UuidConverter.parse(blogId));
	List<BlogEntry> results = blogEntries.readAll(filter, range, order);
	response.setCollectionResponse(range, results.size(), blogEntries.count(filter));

	return results;
}
 
开发者ID:RestExpress,项目名称:RestExpress-Examples,代码行数:14,代码来源:BlogEntryController.java


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