List of usage examples for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS
String CLOSE_PARENTHESIS
To view the source code for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS.
Click Source Link
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the document library file entries that the user has permission to view where groupId = ? and folderId = any ? and fileEntryTypeId = ?. * * <p>/*from w ww.j ava2s . co 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param groupId the group ID * @param folderIds the folder IDs * @param fileEntryTypeId the file entry type ID * @param start the lower bound of the range of document library file entries * @param end the upper bound of the range of document library file entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching document library file entries that the user has permission to view * @throws SystemException if a system exception occurred */ public List<DLFileEntry> filterFindByG_F_F(long groupId, long[] folderIds, long fileEntryTypeId, int start, int end, OrderByComparator orderByComparator) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F_F(groupId, folderIds, fileEntryTypeId, start, end, orderByComparator); } StringBundler query = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_DLFILEENTRY_WHERE); } else { query.append(_FILTER_SQL_SELECT_DLFILEENTRY_NO_INLINE_DISTINCT_WHERE_1); } boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_F_F_GROUPID_5); conjunctionable = true; if ((folderIds == null) || (folderIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < folderIds.length; i++) { query.append(_FINDER_COLUMN_G_F_F_FOLDERID_5); if ((i + 1) < folderIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_F_F_FILEENTRYTYPEID_5); conjunctionable = true; if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_DLFILEENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(DLFileEntryModelImpl.ORDER_BY_JPQL); } else { query.append(DLFileEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), DLFileEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, DLFileEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, DLFileEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (folderIds != null) { qPos.add(folderIds); } qPos.add(fileEntryTypeId); return (List<DLFileEntry>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistenceImpl.java
License:Open Source License
/** * Returns the number of document library file entries where groupId = ? and folderId = any ?. * * @param groupId the group ID/* w w w .j a v a2 s .c o m*/ * @param folderIds the folder IDs * @return the number of matching document library file entries * @throws SystemException if a system exception occurred */ public int countByG_F(long groupId, long[] folderIds) throws SystemException { Object[] finderArgs = new Object[] { groupId, StringUtil.merge(folderIds) }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_DLFILEENTRY_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_F_GROUPID_5); conjunctionable = true; if ((folderIds == null) || (folderIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < folderIds.length; i++) { query.append(_FINDER_COLUMN_G_F_FOLDERID_5); if ((i + 1) < folderIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (folderIds != null) { qPos.add(folderIds); } count = (Long) q.uniqueResult(); } catch (Exception e) { throw processException(e); } finally { if (count == null) { count = Long.valueOf(0); } FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F, finderArgs, count); closeSession(session); } } return count.intValue(); }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistenceImpl.java
License:Open Source License
/** * Returns the number of document library file entries that the user has permission to view where groupId = ? and folderId = any ?. * * @param groupId the group ID// www . j a v a2s . co m * @param folderIds the folder IDs * @return the number of matching document library file entries that the user has permission to view * @throws SystemException if a system exception occurred */ public int filterCountByG_F(long groupId, long[] folderIds) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_F(groupId, folderIds); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_DLFILEENTRY_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_F_GROUPID_5); conjunctionable = true; if ((folderIds == null) || (folderIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < folderIds.length; i++) { query.append(_FINDER_COLUMN_G_F_FOLDERID_5); if ((i + 1) < folderIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), DLFileEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (folderIds != null) { qPos.add(folderIds); } Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistenceImpl.java
License:Open Source License
/** * Returns the number of document library file entries where groupId = ? and userId = ? and folderId = any ?. * * @param groupId the group ID// w w w .ja va2s.co m * @param userId the user ID * @param folderIds the folder IDs * @return the number of matching document library file entries * @throws SystemException if a system exception occurred */ public int countByG_U_F(long groupId, long userId, long[] folderIds) throws SystemException { Object[] finderArgs = new Object[] { groupId, userId, StringUtil.merge(folderIds) }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U_F, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_DLFILEENTRY_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_U_F_GROUPID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_U_F_USERID_5); conjunctionable = true; if ((folderIds == null) || (folderIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < folderIds.length; i++) { query.append(_FINDER_COLUMN_G_U_F_FOLDERID_5); if ((i + 1) < folderIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (folderIds != null) { qPos.add(folderIds); } count = (Long) q.uniqueResult(); } catch (Exception e) { throw processException(e); } finally { if (count == null) { count = Long.valueOf(0); } FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U_F, finderArgs, count); closeSession(session); } } return count.intValue(); }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistenceImpl.java
License:Open Source License
/** * Returns the number of document library file entries that the user has permission to view where groupId = ? and userId = ? and folderId = any ?. * * @param groupId the group ID//from w w w . j a va2 s . co m * @param userId the user ID * @param folderIds the folder IDs * @return the number of matching document library file entries that the user has permission to view * @throws SystemException if a system exception occurred */ public int filterCountByG_U_F(long groupId, long userId, long[] folderIds) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_F(groupId, userId, folderIds); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_DLFILEENTRY_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_U_F_GROUPID_5); conjunctionable = true; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_U_F_USERID_5); conjunctionable = true; if ((folderIds == null) || (folderIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < folderIds.length; i++) { query.append(_FINDER_COLUMN_G_U_F_FOLDERID_5); if ((i + 1) < folderIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), DLFileEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (folderIds != null) { qPos.add(folderIds); } Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistenceImpl.java
License:Open Source License
/** * Returns the number of document library file entries where groupId = ? and folderId = any ? and fileEntryTypeId = ?. * * @param groupId the group ID/* w w w .jav a 2s . c o m*/ * @param folderIds the folder IDs * @param fileEntryTypeId the file entry type ID * @return the number of matching document library file entries * @throws SystemException if a system exception occurred */ public int countByG_F_F(long groupId, long[] folderIds, long fileEntryTypeId) throws SystemException { Object[] finderArgs = new Object[] { groupId, StringUtil.merge(folderIds), fileEntryTypeId }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F_F, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_DLFILEENTRY_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_F_F_GROUPID_5); conjunctionable = true; if ((folderIds == null) || (folderIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < folderIds.length; i++) { query.append(_FINDER_COLUMN_G_F_F_FOLDERID_5); if ((i + 1) < folderIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_F_F_FILEENTRYTYPEID_5); conjunctionable = true; String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (folderIds != null) { qPos.add(folderIds); } qPos.add(fileEntryTypeId); count = (Long) q.uniqueResult(); } catch (Exception e) { throw processException(e); } finally { if (count == null) { count = Long.valueOf(0); } FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F_F, finderArgs, count); closeSession(session); } } return count.intValue(); }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryPersistenceImpl.java
License:Open Source License
/** * Returns the number of document library file entries that the user has permission to view where groupId = ? and folderId = any ? and fileEntryTypeId = ?. * * @param groupId the group ID/*from w w w. j av a2 s. com*/ * @param folderIds the folder IDs * @param fileEntryTypeId the file entry type ID * @return the number of matching document library file entries that the user has permission to view * @throws SystemException if a system exception occurred */ public int filterCountByG_F_F(long groupId, long[] folderIds, long fileEntryTypeId) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_F_F(groupId, folderIds, fileEntryTypeId); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_DLFILEENTRY_WHERE); boolean conjunctionable = false; if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_F_F_GROUPID_5); conjunctionable = true; if ((folderIds == null) || (folderIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < folderIds.length; i++) { query.append(_FINDER_COLUMN_G_F_F_FOLDERID_5); if ((i + 1) < folderIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (conjunctionable) { query.append(WHERE_AND); } query.append(_FINDER_COLUMN_G_F_F_FILEENTRYTYPEID_5); conjunctionable = true; String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), DLFileEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (folderIds != null) { qPos.add(folderIds); } qPos.add(fileEntryTypeId); Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryTypePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the document library file entry types where groupId = any ?. * * <p>//ww w . j a v 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param groupIds the group IDs * @param start the lower bound of the range of document library file entry types * @param end the upper bound of the range of document library file entry types (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching document library file entry types * @throws SystemException if a system exception occurred */ public List<DLFileEntryType> findByGroupId(long[] groupIds, int start, int end, OrderByComparator orderByComparator) throws SystemException { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID; finderArgs = new Object[] { StringUtil.merge(groupIds) }; } else { finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID; finderArgs = new Object[] { StringUtil.merge(groupIds), start, end, orderByComparator }; } List<DLFileEntryType> list = (List<DLFileEntryType>) FinderCacheUtil.getResult(finderPath, finderArgs, this); if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_DLFILEENTRYTYPE_WHERE); boolean conjunctionable = false; if ((groupIds == null) || (groupIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < groupIds.length; i++) { query.append(_FINDER_COLUMN_GROUPID_GROUPID_5); if ((i + 1) < groupIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (groupIds != null) { qPos.add(groupIds); } list = (List<DLFileEntryType>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { if (list == null) { FinderCacheUtil.removeResult(finderPath, finderArgs); } else { cacheResult(list); FinderCacheUtil.putResult(finderPath, finderArgs, list); } closeSession(session); } } return list; }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryTypePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the document library file entry types that the user has permission to view where groupId = any ?. * * <p>//from w ww . j a va2s.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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. * </p> * * @param groupIds the group IDs * @param start the lower bound of the range of document library file entry types * @param end the upper bound of the range of document library file entry types (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching document library file entry types that the user has permission to view * @throws SystemException if a system exception occurred */ public List<DLFileEntryType> filterFindByGroupId(long[] groupIds, int start, int end, OrderByComparator orderByComparator) throws SystemException { if (!InlineSQLHelperUtil.isEnabled(groupIds)) { return findByGroupId(groupIds, start, end, orderByComparator); } StringBundler query = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_WHERE); } else { query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_1); } boolean conjunctionable = false; if ((groupIds == null) || (groupIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < groupIds.length; i++) { query.append(_FINDER_COLUMN_GROUPID_GROUPID_5); if ((i + 1) < groupIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_DLFILEENTRYTYPE_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), DLFileEntryType.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupIds); Session session = null; try { session = openSession(); SQLQuery q = session.createSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, DLFileEntryTypeImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, DLFileEntryTypeImpl.class); } QueryPos qPos = QueryPos.getInstance(q); if (groupIds != null) { qPos.add(groupIds); } return (List<DLFileEntryType>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.portlet.documentlibrary.service.persistence.DLFileEntryTypePersistenceImpl.java
License:Open Source License
/** * Returns the number of document library file entry types where groupId = any ?. * * @param groupIds the group IDs//from w ww. j a v a2 s .co m * @return the number of matching document library file entry types * @throws SystemException if a system exception occurred */ public int countByGroupId(long[] groupIds) throws SystemException { Object[] finderArgs = new Object[] { StringUtil.merge(groupIds) }; Long count = (Long) FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_DLFILEENTRYTYPE_WHERE); boolean conjunctionable = false; if ((groupIds == null) || (groupIds.length > 0)) { if (conjunctionable) { query.append(WHERE_AND); } query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < groupIds.length; i++) { query.append(_FINDER_COLUMN_GROUPID_GROUPID_5); if ((i + 1) < groupIds.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); conjunctionable = true; } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (groupIds != null) { qPos.add(groupIds); } count = (Long) q.uniqueResult(); } catch (Exception e) { throw processException(e); } finally { if (count == null) { count = Long.valueOf(0); } FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID, finderArgs, count); closeSession(session); } } return count.intValue(); }