List of usage examples for com.liferay.portal.kernel.security.permission InlineSQLHelperUtil isEnabled
public static boolean isEnabled(long[] groupIds)
From source file:com.bemis.portal.report.service.persistence.impl.ReportDefinitionPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the report definitions that the user has permissions to view where companyId = ? and groupId = ?. * * <p>/*from ww w . j a va 2 s. c o m*/ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link ReportDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param companyId the company ID * @param groupId the group ID * @param start the lower bound of the range of report definitions * @param end the upper bound of the range of report definitions (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching report definitions that the user has permission to view */ @Override public List<ReportDefinition> filterFindByC_G(long companyId, long groupId, int start, int end, OrderByComparator<ReportDefinition> orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByC_G(companyId, groupId, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_WHERE); } else { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_C_G_COMPANYID_2); query.append(_FINDER_COLUMN_C_G_GROUPID_2); if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(ReportDefinitionModelImpl.ORDER_BY_JPQL); } else { query.append(ReportDefinitionModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), ReportDefinition.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, ReportDefinitionImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, ReportDefinitionImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(groupId); return (List<ReportDefinition>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportDefinitionPersistenceImpl.java
License:Open Source License
/** * Returns the report definitions before and after the current report definition in the ordered set of report definitions that the user has permission to view where companyId = ? and groupId = ?. * * @param reportDefinitionId the primary key of the current report definition * @param companyId the company ID/*from w ww.java2 s . c o m*/ * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the previous, current, and next report definition * @throws NoSuchReportDefinitionException if a report definition with the primary key could not be found */ @Override public ReportDefinition[] filterFindByC_G_PrevAndNext(long reportDefinitionId, long companyId, long groupId, OrderByComparator<ReportDefinition> orderByComparator) throws NoSuchReportDefinitionException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByC_G_PrevAndNext(reportDefinitionId, companyId, groupId, orderByComparator); } ReportDefinition reportDefinition = findByPrimaryKey(reportDefinitionId); Session session = null; try { session = openSession(); ReportDefinition[] array = new ReportDefinitionImpl[3]; array[0] = filterGetByC_G_PrevAndNext(session, reportDefinition, companyId, groupId, orderByComparator, true); array[1] = reportDefinition; array[2] = filterGetByC_G_PrevAndNext(session, reportDefinition, companyId, groupId, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportDefinitionPersistenceImpl.java
License:Open Source License
/** * Returns the number of report definitions that the user has permission to view where companyId = ? and groupId = ?. * * @param companyId the company ID//from w w w. j av a2 s .c o m * @param groupId the group ID * @return the number of matching report definitions that the user has permission to view */ @Override public int filterCountByC_G(long companyId, long groupId) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByC_G(companyId, groupId); } StringBundler query = new StringBundler(3); query.append(_FILTER_SQL_COUNT_REPORTDEFINITION_WHERE); query.append(_FINDER_COLUMN_C_G_COMPANYID_2); query.append(_FINDER_COLUMN_C_G_GROUPID_2); String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), ReportDefinition.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(groupId); Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportDefinitionPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the report definitions that the user has permissions to view where category = ? and companyId = ? and groupId = ?. * * <p>//from w w w . jav a 2 s .c o m * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link ReportDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param category the category * @param companyId the company ID * @param groupId the group ID * @param start the lower bound of the range of report definitions * @param end the upper bound of the range of report definitions (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching report definitions that the user has permission to view */ @Override public List<ReportDefinition> filterFindByC_C_G(String category, long companyId, long groupId, int start, int end, OrderByComparator<ReportDefinition> orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByC_C_G(category, companyId, groupId, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_WHERE); } else { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_NO_INLINE_DISTINCT_WHERE_1); } boolean bindCategory = false; if (category == null) { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_1); } else if (category.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_3); } else { bindCategory = true; query.append(_FINDER_COLUMN_C_C_G_CATEGORY_2); } query.append(_FINDER_COLUMN_C_C_G_COMPANYID_2); query.append(_FINDER_COLUMN_C_C_G_GROUPID_2); if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(ReportDefinitionModelImpl.ORDER_BY_JPQL); } else { query.append(ReportDefinitionModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), ReportDefinition.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, ReportDefinitionImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, ReportDefinitionImpl.class); } QueryPos qPos = QueryPos.getInstance(q); if (bindCategory) { qPos.add(category); } qPos.add(companyId); qPos.add(groupId); return (List<ReportDefinition>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportDefinitionPersistenceImpl.java
License:Open Source License
/** * Returns the report definitions before and after the current report definition in the ordered set of report definitions that the user has permission to view where category = ? and companyId = ? and groupId = ?. * * @param reportDefinitionId the primary key of the current report definition * @param category the category// w w w . ja va 2s . co m * @param companyId the company ID * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the previous, current, and next report definition * @throws NoSuchReportDefinitionException if a report definition with the primary key could not be found */ @Override public ReportDefinition[] filterFindByC_C_G_PrevAndNext(long reportDefinitionId, String category, long companyId, long groupId, OrderByComparator<ReportDefinition> orderByComparator) throws NoSuchReportDefinitionException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByC_C_G_PrevAndNext(reportDefinitionId, category, companyId, groupId, orderByComparator); } ReportDefinition reportDefinition = findByPrimaryKey(reportDefinitionId); Session session = null; try { session = openSession(); ReportDefinition[] array = new ReportDefinitionImpl[3]; array[0] = filterGetByC_C_G_PrevAndNext(session, reportDefinition, category, companyId, groupId, orderByComparator, true); array[1] = reportDefinition; array[2] = filterGetByC_C_G_PrevAndNext(session, reportDefinition, category, companyId, groupId, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportDefinitionPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the report definitions that the user has permission to view where category = any ? and companyId = ? and groupId = ?. * * <p>// w w w . j a v a 2s . com * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link ReportDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param categories the categories * @param companyId the company ID * @param groupId the group ID * @param start the lower bound of the range of report definitions * @param end the upper bound of the range of report definitions (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching report definitions that the user has permission to view */ @Override public List<ReportDefinition> filterFindByC_C_G(String[] categories, long companyId, long groupId, int start, int end, OrderByComparator<ReportDefinition> orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByC_C_G(categories, companyId, groupId, start, end, orderByComparator); } if (categories == null) { categories = new String[0]; } else if (categories.length > 1) { categories = ArrayUtil.distinct(categories, NULL_SAFE_STRING_COMPARATOR); Arrays.sort(categories, NULL_SAFE_STRING_COMPARATOR); } StringBundler query = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_WHERE); } else { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_NO_INLINE_DISTINCT_WHERE_1); } if (categories.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categories.length; i++) { String category = categories[i]; if (category == null) { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_4); } else if (category.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_6); } else { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_5); } if ((i + 1) < categories.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); query.append(WHERE_AND); } query.append(_FINDER_COLUMN_C_C_G_COMPANYID_2); query.append(_FINDER_COLUMN_C_C_G_GROUPID_2); query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_REPORTDEFINITION_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(ReportDefinitionModelImpl.ORDER_BY_JPQL); } else { query.append(ReportDefinitionModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), ReportDefinition.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, ReportDefinitionImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, ReportDefinitionImpl.class); } QueryPos qPos = QueryPos.getInstance(q); for (String category : categories) { if ((category != null) && !category.isEmpty()) { qPos.add(category); } } qPos.add(companyId); qPos.add(groupId); return (List<ReportDefinition>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportDefinitionPersistenceImpl.java
License:Open Source License
/** * Returns the number of report definitions that the user has permission to view where category = ? and companyId = ? and groupId = ?. * * @param category the category/* w w w . j av a 2 s . c om*/ * @param companyId the company ID * @param groupId the group ID * @return the number of matching report definitions that the user has permission to view */ @Override public int filterCountByC_C_G(String category, long companyId, long groupId) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByC_C_G(category, companyId, groupId); } StringBundler query = new StringBundler(4); query.append(_FILTER_SQL_COUNT_REPORTDEFINITION_WHERE); boolean bindCategory = false; if (category == null) { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_1); } else if (category.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_3); } else { bindCategory = true; query.append(_FINDER_COLUMN_C_C_G_CATEGORY_2); } query.append(_FINDER_COLUMN_C_C_G_COMPANYID_2); query.append(_FINDER_COLUMN_C_C_G_GROUPID_2); String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), ReportDefinition.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); if (bindCategory) { qPos.add(category); } qPos.add(companyId); qPos.add(groupId); Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportDefinitionPersistenceImpl.java
License:Open Source License
/** * Returns the number of report definitions that the user has permission to view where category = any ? and companyId = ? and groupId = ?. * * @param categories the categories/*from w w w . j a v a2s .c o m*/ * @param companyId the company ID * @param groupId the group ID * @return the number of matching report definitions that the user has permission to view */ @Override public int filterCountByC_C_G(String[] categories, long companyId, long groupId) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByC_C_G(categories, companyId, groupId); } if (categories == null) { categories = new String[0]; } else if (categories.length > 1) { categories = ArrayUtil.distinct(categories, NULL_SAFE_STRING_COMPARATOR); Arrays.sort(categories, NULL_SAFE_STRING_COMPARATOR); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_REPORTDEFINITION_WHERE); if (categories.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < categories.length; i++) { String category = categories[i]; if (category == null) { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_4); } else if (category.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_6); } else { query.append(_FINDER_COLUMN_C_C_G_CATEGORY_5); } if ((i + 1) < categories.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); query.append(WHERE_AND); } query.append(_FINDER_COLUMN_C_C_G_COMPANYID_2); query.append(_FINDER_COLUMN_C_C_G_GROUPID_2); query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), ReportDefinition.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); for (String category : categories) { if ((category != null) && !category.isEmpty()) { qPos.add(category); } } qPos.add(companyId); qPos.add(groupId); Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportRequestPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the report requests that the user has permissions to view where companyId = ? and groupId = ?. * * <p>/*from w ww . j a v a 2s.c o m*/ * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link ReportRequestModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. * </p> * * @param companyId the company ID * @param groupId the group ID * @param start the lower bound of the range of report requests * @param end the upper bound of the range of report requests (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching report requests that the user has permission to view */ @Override public List<ReportRequest> filterFindByC_G(long companyId, long groupId, int start, int end, OrderByComparator<ReportRequest> orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByC_G(companyId, groupId, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler(4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_REPORTREQUEST_WHERE); } else { query.append(_FILTER_SQL_SELECT_REPORTREQUEST_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_C_G_COMPANYID_2); query.append(_FINDER_COLUMN_C_G_GROUPID_2); if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_REPORTREQUEST_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(ReportRequestModelImpl.ORDER_BY_JPQL); } else { query.append(ReportRequestModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), ReportRequest.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, ReportRequestImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, ReportRequestImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(groupId); return (List<ReportRequest>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.bemis.portal.report.service.persistence.impl.ReportRequestPersistenceImpl.java
License:Open Source License
/** * Returns the report requests before and after the current report request in the ordered set of report requests that the user has permission to view where companyId = ? and groupId = ?. * * @param reportRequestId the primary key of the current report request * @param companyId the company ID/* w ww . j a v a 2 s . com*/ * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally <code>null</code>) * @return the previous, current, and next report request * @throws NoSuchReportRequestException if a report request with the primary key could not be found */ @Override public ReportRequest[] filterFindByC_G_PrevAndNext(long reportRequestId, long companyId, long groupId, OrderByComparator<ReportRequest> orderByComparator) throws NoSuchReportRequestException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByC_G_PrevAndNext(reportRequestId, companyId, groupId, orderByComparator); } ReportRequest reportRequest = findByPrimaryKey(reportRequestId); Session session = null; try { session = openSession(); ReportRequest[] array = new ReportRequestImpl[3]; array[0] = filterGetByC_G_PrevAndNext(session, reportRequest, companyId, groupId, orderByComparator, true); array[1] = reportRequest; array[2] = filterGetByC_G_PrevAndNext(session, reportRequest, companyId, groupId, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }