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;
}
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;
}
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();
}
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();
}
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();
}
Aggregations