Package org.beangle.commons.collection.page

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


  public void setLimit(PageLimit limit) {
    this.limit = limit;
  }

  public LimitQuery<T> limit(PageLimit limit) {
    this.limit = new PageLimit(limit.getPageNo(), limit.getPageSize());
    return this;
  }
View Full Code Here


  public Query<Object> build() {
    QueryBean<Object> queryBean = new QueryBean<Object>();
    queryBean.setStatement(toQueryString());
    queryBean.setParams(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

    processSql();
    String newSql = sql;
    if (StringUtils.isEmpty(newSql)) { return Collections.emptyList(); }
    boolean thisPage = getBool("thisPage");
    if (thisPage) {
      PageLimit limit = getPageLimit();
      newSql = sqlService.getLimitString(sql, limit);
    }
    List<Map<String, Object>> datas = sqlService.queryForList(newSql);
    return datas;
  }
View Full Code Here

  private QueryResult query(String sqlString) {
    QueryResult result = new QueryResult(sqlString);
    try {
      if (sqlString.toLowerCase().startsWith("select")) {
        PageLimit limit = getPageLimit();
        String newSql = sqlService.getLimitString(sqlString, limit);
        List<Map<String, Object>> datas = sqlService.queryForList(newSql);
        Page<?> page = new SinglePage<Map<String, Object>>(limit.getPageNo(), limit.getPageSize(),
            sqlService.count(sqlString), datas);
        if (!datas.isEmpty()) {
          result.setColumns(new ArrayList<String>(datas.get(0).keySet()));
        }
        result.setDatas(page);
View Full Code Here

    processSql();
    String newSql = sql;
    if (StringUtils.isEmpty(newSql)) { return Collections.emptyList(); }
    boolean thisPage = getBool("thisPage");
    if (thisPage) {
      PageLimit limit = getPageLimit();
      newSql = sqlService.getLimitString(sql, limit);
    }
    List<Map<String, Object>> datas = sqlService.queryForList(newSql);
    return datas;
  }
View Full Code Here

  private QueryResult query(String sqlString) {
    QueryResult result = new QueryResult(sqlString);
    try {
      if (sqlString.toLowerCase().startsWith("select")) {
        PageLimit limit = getPageLimit();
        String newSql = sqlService.getLimitString(sqlString, limit);
        List<Map<String, Object>> datas = sqlService.queryForList(newSql);
        Page<?> page = new SinglePage<Map<String, Object>>(limit.getPageNo(), limit
            .getPageSize(), sqlService.count(sqlString), datas);
        if (!datas.isEmpty()) {
          result.setColumns(new ArrayList<String>(datas.get(0).keySet()));
        }
        result.setDatas(page);
View Full Code Here

        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

  private void populateSessionActivities(User user) {
    OqlBuilder<SessionActivity> onlineQuery = OqlBuilder.from(SessionActivity.class,
        "sessionActivity");
    onlineQuery.where("sessionActivity.name =:name", user.getName());
    PageLimit limit = QueryHelper.getPageLimit();
    limit.setPageSize(10);
    onlineQuery.orderBy("sessionActivity.loginAt desc").limit(limit);
    ContextHelper.put("sessionActivities", entityDao.search(onlineQuery));
  }
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

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.