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


Java QueryRange类代码示例

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


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

示例1: readAllByUserAndService

import org.restexpress.common.query.QueryRange; //导入依赖的package包/类
@Transactional
public Page<UserAuthorization> readAllByUserAndService(String userUuid, QueryFilter filter, QueryRange range, QueryOrder order) {
    Page<UserAuthorization> result = null;
    DetachedCriteria crit = DetachedCriteria.forClass(UserAuthorization.class, "ua");
    crit.createAlias("ua.user", "user");
    crit.add(Restrictions.eq("user.uuid", userUuid));
    crit.createAlias("ua.authorization", "authorization");
    
    CriteriaFilterHelper.addQueryFilter(crit, filter);
    CriteriaFilterHelper.addQueryOrder(crit, order);
    ((HibernateGenericDao)userAuthorizationDao).setFilterNames(Constants.NOT_DELETED_FILTER_NAME);
    if (range != null && range.isInitialized()) {
        result = ((HibernateGenericDao)userAuthorizationDao).searchPaginatedByCriteria(crit, (int) range.getOffset(), range.getLimit());
    } else {
        result = ((HibernateGenericDao)userAuthorizationDao).searchPaginatedByCriteria(crit, 0, 0);
    }
    ((HibernateGenericDao)userAuthorizationDao).setFilterNames();
    return result;
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:20,代码来源:UserAuthorizationBo.java

示例2: readAll

import org.restexpress.common.query.QueryRange; //导入依赖的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

示例3: readAll

import org.restexpress.common.query.QueryRange; //导入依赖的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

示例4: bindPaginationTokens

import org.restexpress.common.query.QueryRange; //导入依赖的package包/类
public static void bindPaginationTokens(final QueryRange range, final long rows) {
    if (range.hasLimit()) {
        if (range.getOffset() + range.getLimit() <= rows) {
            HyperExpress.bind("nextOffset", Long.toString(range.getOffset() + range.getLimit()));
        }
        if (range.getOffset() - range.getLimit() >= 0) {
            HyperExpress.bind("prevOffset", Long.toString(range.getOffset() - range.getLimit()));
        }
    }
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:11,代码来源:HyperExpressBindHelper.java

示例5: readAll

import org.restexpress.common.query.QueryRange; //导入依赖的package包/类
@Transactional
public Page<User> readAll(QueryFilter filter, QueryRange range, QueryOrder order) {
    Page<User> result = null;
    DetachedCriteria crit = DetachedCriteria.forClass(User.class);
    CriteriaFilterHelper.addQueryFilter(crit, filter);
    CriteriaFilterHelper.addQueryOrder(crit, order);
    ((HibernateGenericDao)userDao).setFilterNames(Constants.NOT_DELETED_FILTER_NAME);
    if (range != null && range.isInitialized()) {
        result = ((HibernateGenericDao)userDao).searchPaginatedByCriteria(crit, (int) range.getOffset(), range.getLimit());
    } else {
        result = ((HibernateGenericDao)userDao).searchPaginatedByCriteria(crit, 0, 0);
    }
    ((HibernateGenericDao)userDao).setFilterNames();
    return result;
}
 
开发者ID:caratarse,项目名称:caratarse-auth,代码行数:16,代码来源:UserBo.java

示例6: readAll

import org.restexpress.common.query.QueryRange; //导入依赖的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

示例7: readAll

import org.restexpress.common.query.QueryRange; //导入依赖的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

示例8: readAll

import org.restexpress.common.query.QueryRange; //导入依赖的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.common.query.QueryRange类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。