Package org.beangle.commons.collection.page

Examples of org.beangle.commons.collection.page.PageLimit


        LimitQuery<T> limitQuery = (LimitQuery<T>) query;
        Query hibernateQuery = buildHibernateQuery(limitQuery, hibernateSession);
        if (null == limitQuery.getLimit()) {
          return hibernateQuery.list();
        } else {
          final PageLimit limit = limitQuery.getLimit();
          hibernateQuery.setFirstResult((limit.getPageNo() - 1) * limit.getPageSize())
              .setMaxResults(limit.getPageSize());
          return hibernateQuery.list();
        }
      } else {
        return buildHibernateQuery(query, hibernateSession).list();
      }
View Full Code Here


  public String activity() {
    OqlBuilder<SessioninfoLogBean> builder = OqlBuilder.from(SessioninfoLogBean.class,
        "sessioninfoLog");
    builder.where("sessioninfoLog.username=:name", getUsername());
    builder.orderBy(Order.parse("sessioninfoLog.loginAt desc"));
    PageLimit limit = getPageLimit();
    limit.setPageSize(10);
    builder.limit(limit);
    put("sessioninfoLogs", entityDao.search(builder));
    put("sessioninfos", sessionRegistry.getSessioninfos(SecurityUtils.getUsername(), true));
    return forward();
  }
View Full Code Here

  private void populateSessioninfoLogs(User user) {
    OqlBuilder<SessioninfoLogBean> onlineQuery = OqlBuilder.from(SessioninfoLogBean.class,
        "sessioninfoLog");
    onlineQuery.where("sessioninfoLog.username = :username", user.getName());
    PageLimit limit = QueryHelper.getPageLimit();
    limit.setPageSize(5);
    onlineQuery.orderBy("sessioninfoLog.loginAt desc").limit(limit);
    ContextHelper.put("sessioninfoLogs", entityDao.search(onlineQuery));
  }
View Full Code Here

   * 从的参数或者cookie中(参数优先)取得分页信息
   *
   * @return
   */
  public static PageLimit getPageLimit() {
    PageLimit limit = new PageLimit();
    limit.setPageNo(getPageNo());
    limit.setPageSize(getPageSize());
    return limit;
  }
View Full Code Here

  public AbstractQueryPage(LimitQuery<T> query) {
    this.query = query;
    if (null != query) {
      if (null == query.getLimit()) {
        query.limit(new PageLimit(pageNo, Page.DEFAULT_PAGE_SIZE));
      } else {
        pageNo = query.getLimit().getPageNo() - 1;
      }
    }
  }
View Full Code Here

  public Query<Object> build() {
    QueryBean<Object> queryBean = new QueryBean<Object>();
    queryBean.setStatement(toQueryString());
    queryBean.setParams(CollectUtils.newHashMap(getParams()));
    if (null != limit) {
      queryBean.setLimit(new PageLimit(limit.getPageNo(), limit.getPageSize()));
    }
    queryBean.setCountStatement(toCountString());
    queryBean.setCacheable(cacheable);
    queryBean.setLang(getLang());
    return queryBean;
View Full Code Here

  public Query<T> build() {
    QueryBean<T> queryBean = new QueryBean<T>();
    queryBean.setStatement(genStatement());
    queryBean.setParams(getParams());
    if (null != limit) {
      queryBean.setLimit(new PageLimit(limit.getPageNo(), limit.getPageSize()));
    }
    queryBean.setCountStatement(genCountStatement());
    queryBean.setCacheable(cacheable);
    queryBean.setLang(getLang());
    return queryBean;
View Full Code Here

@Test
public class TestQueryPage {

  public void testMove() throws Exception {
    OqlBuilder<String> query = OqlBuilder.from(String.class, "dd");
    query.limit(new PageLimit(1, 2));
    MockQueryPage page = new MockQueryPage((LimitQuery<String>) query.build());
    for (Iterator<String> iterator = page.iterator(); iterator.hasNext();) {
      String data = iterator.next();
      assertNotNull(data);
    }
View Full Code Here

    this.limit = limit;
    return this;
  }

  public SqlBuilder limit(final int pageNo, final int pageSize) {
    this.limit = new PageLimit(pageNo, pageSize);
    return this;
  }
View Full Code Here

    this.limit = limit;
    return this;
  }

  public OqlBuilder<T> limit(final int pageNo, final int pageSize) {
    this.limit = new PageLimit(pageNo, pageSize);
    return this;
  }
View Full Code Here

TOP

Related Classes of org.beangle.commons.collection.page.PageLimit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.