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