@Override public List<MBThread> filterFindByG_C(long groupId, long categoryId, int start, int end) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return MBThreadUtil.findByG_C(groupId, categoryId, start, end); } Session session = null; try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_G_C); sql = InlineSQLHelperUtil.replacePermissionCheck( sql, MBMessage.class.getName(), "MBThread.rootMessageId", groupId); SQLQuery q = session.createSQLQuery(sql); q.addEntity("MBThread", MBThreadImpl.class); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(categoryId); return (List<MBThread>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }
protected List<MBThread> doFindByG_C( long groupId, long categoryId, QueryDefinition queryDefinition, boolean inlineSQLHelper) throws SystemException { if (!inlineSQLHelper || !InlineSQLHelperUtil.isEnabled(groupId)) { if (queryDefinition.isExcludeStatus()) { return MBThreadUtil.findByG_C_NotS( groupId, categoryId, queryDefinition.getStatus(), queryDefinition.getStart(), queryDefinition.getEnd()); } else { if (queryDefinition.getStatus() != WorkflowConstants.STATUS_ANY) { return MBThreadUtil.findByG_C_S( groupId, categoryId, queryDefinition.getStatus(), queryDefinition.getStart(), queryDefinition.getEnd()); } else { return MBThreadUtil.findByG_C( groupId, categoryId, queryDefinition.getStart(), queryDefinition.getEnd()); } } } Session session = null; try { session = openSession(); String sql = CustomSQLUtil.get(FIND_BY_G_C); sql = updateSQL(sql, queryDefinition); sql = InlineSQLHelperUtil.replacePermissionCheck( sql, MBMessage.class.getName(), "MBThread.rootMessageId", groupId); SQLQuery q = session.createSQLQuery(sql); q.addEntity("MBThread", MBThreadImpl.class); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(categoryId); if (queryDefinition.getStatus() != WorkflowConstants.STATUS_ANY) { qPos.add(queryDefinition.getStatus()); } return (List<MBThread>) QueryUtil.list(q, getDialect(), queryDefinition.getStart(), queryDefinition.getEnd()); } catch (Exception e) { throw new SystemException(e); } finally { closeSession(session); } }