private String initSort(String hql) { String order = SystemContext.getOrder(); String sort = SystemContext.getSort(); if (sort != null && !"".equals(sort.trim())) { hql += " order by " + sort; if (!"desc".equals(order)) hql += " asc"; else hql += " desc"; } return hql; }
@SuppressWarnings("rawtypes") private void setPagers(Query query, Pager pages) { Integer pageSize = SystemContext.getPageSize(); Integer pageOffset = SystemContext.getPageOffset(); if (pageOffset == null || pageOffset < 0) pageOffset = 0; if (pageSize == null || pageSize < 0) pageSize = 15; pages.setOffset(pageOffset); pages.setSize(pageSize); query.setFirstResult(pageOffset).setMaxResults(pageSize); }