Search in sources :

Example 36 with PageHandler

use of com.publiccms.common.handler.PageHandler in project PublicCMS-preview by sanluan.

the class BaseDao method getPage.

/**
 * @param fullTextQuery
 * @param pageIndex
 * @param pageSize
 * @param maxResults
 * @return results page
 */
protected PageHandler getPage(FullTextQuery fullTextQuery, Integer pageIndex, Integer pageSize, Integer maxResults) {
    PageHandler page = new PageHandler(pageIndex, pageSize, fullTextQuery.getResultSize(), maxResults);
    if (CommonUtils.notEmpty(pageSize)) {
        fullTextQuery.setFirstResult(page.getFirstResult()).setMaxResults(page.getPageSize());
    }
    page.setList(fullTextQuery.list());
    return page;
}
Also used : FacetPageHandler(com.publiccms.common.handler.FacetPageHandler) PageHandler(com.publiccms.common.handler.PageHandler)

Example 37 with PageHandler

use of com.publiccms.common.handler.PageHandler in project PublicCMS-preview by sanluan.

the class BaseDao method getPage.

/**
 * @param queryHandler
 * @param pageIndex
 * @param pageSize
 * @param maxResults
 * @return results page
 */
protected PageHandler getPage(QueryHandler queryHandler, Integer pageIndex, Integer pageSize, Integer maxResults) {
    PageHandler page;
    if (CommonUtils.notEmpty(pageSize)) {
        page = new PageHandler(pageIndex, pageSize, countResult(queryHandler), maxResults);
        queryHandler.setFirstResult(page.getFirstResult()).setMaxResults(page.getPageSize());
        if (0 != pageSize) {
            page.setList(getList(queryHandler));
        }
    } else {
        page = new PageHandler(pageIndex, pageSize, 0, maxResults);
        page.setList(getList(queryHandler));
    }
    return page;
}
Also used : FacetPageHandler(com.publiccms.common.handler.FacetPageHandler) PageHandler(com.publiccms.common.handler.PageHandler)

Example 38 with PageHandler

use of com.publiccms.common.handler.PageHandler in project PublicCMS-preview by sanluan.

the class CmsWordListDirective method execute.

@Override
public void execute(RenderHandler handler) throws IOException, Exception {
    Boolean hidden = false;
    String orderField = "searchCount";
    if (handler.getBoolean("advanced", false)) {
        hidden = handler.getBoolean("hidden");
        orderField = handler.getString("orderField");
    }
    PageHandler page;
    Integer pageIndex = handler.getInteger("pageIndex", 1);
    Integer count = handler.getInteger("count", 30);
    try {
        page = service.getPage(getSite(handler).getId(), hidden, handler.getDate("startCreateDate"), handler.getDate("endCreateDate"), handler.getString("name"), orderField, handler.getString("orderType"), pageIndex, count);
    } catch (Exception e) {
        page = new PageHandler(pageIndex, count, 0, null);
    }
    handler.put("page", page).render();
}
Also used : PageHandler(com.publiccms.common.handler.PageHandler) IOException(java.io.IOException)

Example 39 with PageHandler

use of com.publiccms.common.handler.PageHandler in project PublicCMS-preview by sanluan.

the class HomeActiveListDirective method execute.

@Override
public void execute(RenderHandler handler) throws IOException, Exception {
    Long userId = handler.getLong("userId");
    Long[] userIds = handler.getLongArray("userIds");
    PageHandler page;
    if (CommonUtils.notEmpty(userId) || CommonUtils.notEmpty(userIds)) {
        page = service.getPage(handler.getString("itemType"), userId, userIds, handler.getInteger("pageIndex", 1), handler.getInteger("count", 30));
    } else {
        page = new PageHandler(0, 0, 0, 0);
    }
    handler.put("page", page).render();
}
Also used : PageHandler(com.publiccms.common.handler.PageHandler)

Example 40 with PageHandler

use of com.publiccms.common.handler.PageHandler in project PublicCMS-preview by sanluan.

the class HomeAttentionListDirective method execute.

@Override
public void execute(RenderHandler handler) throws IOException, Exception {
    PageHandler page = service.getPage(handler.getLong("userId"), handler.getLong("attentionId"), handler.getInteger("pageIndex", 1), handler.getInteger("count", 30));
    handler.put("page", page).render();
}
Also used : PageHandler(com.publiccms.common.handler.PageHandler)

Aggregations

PageHandler (com.publiccms.common.handler.PageHandler)65 FacetPageHandler (com.publiccms.common.handler.FacetPageHandler)3 SysSite (com.publiccms.entities.sys.SysSite)3 IOException (java.io.IOException)3 Date (java.util.Date)3 HashMap (java.util.HashMap)3 CmsContentQuery (com.publiccms.views.pojo.query.CmsContentQuery)2 CmsContentAttribute (com.publiccms.entities.cms.CmsContentAttribute)1 CmsLottery (com.publiccms.entities.cms.CmsLottery)1 LogUpload (com.publiccms.entities.log.LogUpload)1 SysCluster (com.publiccms.entities.sys.SysCluster)1 CmsCategoryQuery (com.publiccms.views.pojo.query.CmsCategoryQuery)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Scheduled (org.springframework.scheduling.annotation.Scheduled)1 ModelMap (org.springframework.ui.ModelMap)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1