List of usage examples for com.liferay.portal.kernel.util StringPool OPEN_PARENTHESIS
String OPEN_PARENTHESIS
To view the source code for com.liferay.portal.kernel.util StringPool OPEN_PARENTHESIS.
Click Source Link
From source file:com.liferay.document.library.repository.cmis.search.CMISFullTextConjunction.java
License:Open Source License
@Override public String toQueryFragment() { if (isEmpty()) { return StringPool.BLANK; }/*from ww w. java 2 s. c o m*/ List<CMISCriterion> cmisCriterions = list(); StringBundler sb = new StringBundler(cmisCriterions.size() * 2 + 1); if (cmisCriterions.size() > 1) { sb.append(StringPool.OPEN_PARENTHESIS); } for (int i = 0; i < cmisCriterions.size(); i++) { CMISCriterion cmisCriterion = cmisCriterions.get(i); if (i != 0) { sb.append(" "); } sb.append(cmisCriterion.toQueryFragment()); } if (cmisCriterions.size() > 1) { sb.append(StringPool.CLOSE_PARENTHESIS); } return sb.toString(); }
From source file:com.liferay.dynamic.data.lists.service.persistence.impl.DDLRecordSetPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the ddl record sets that the user has permission to view where groupId = any ?. * * <p>/*from w ww . ja v a2 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 DDLRecordSetModelImpl}. 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 groupIds the group IDs * @param start the lower bound of the range of ddl record sets * @param end the upper bound of the range of ddl record sets (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @return the ordered range of matching ddl record sets that the user has permission to view */ @Override public List<DDLRecordSet> filterFindByGroupId(long[] groupIds, int start, int end, OrderByComparator<DDLRecordSet> orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupIds)) { return findByGroupId(groupIds, start, end, orderByComparator); } if (groupIds == null) { groupIds = new long[0]; } else if (groupIds.length > 1) { groupIds = ArrayUtil.unique(groupIds); Arrays.sort(groupIds); } StringBundler query = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_DDLRECORDSET_WHERE); } else { query.append(_FILTER_SQL_SELECT_DDLRECORDSET_NO_INLINE_DISTINCT_WHERE_1); } if (groupIds.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); query.append(_FINDER_COLUMN_GROUPID_GROUPID_7); query.append(StringUtil.merge(groupIds)); query.append(StringPool.CLOSE_PARENTHESIS); query.append(StringPool.CLOSE_PARENTHESIS); } query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); if (!getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_DDLRECORDSET_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(DDLRecordSetModelImpl.ORDER_BY_JPQL); } else { query.append(DDLRecordSetModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), DDLRecordSet.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupIds); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, DDLRecordSetImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, DDLRecordSetImpl.class); } return (List<DDLRecordSet>) QueryUtil.list(q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.dynamic.data.lists.service.persistence.impl.DDLRecordSetPersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the ddl record sets where groupId = ?, optionally using the finder cache. * * <p>// w w w . j av 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 DDLRecordSetModelImpl}. 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 groupId the group ID * @param start the lower bound of the range of ddl record sets * @param end the upper bound of the range of ddl record sets (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching ddl record sets */ @Override public List<DDLRecordSet> findByGroupId(long[] groupIds, int start, int end, OrderByComparator<DDLRecordSet> orderByComparator, boolean retrieveFromCache) { if (groupIds == null) { groupIds = new long[0]; } else if (groupIds.length > 1) { groupIds = ArrayUtil.unique(groupIds); Arrays.sort(groupIds); } if (groupIds.length == 1) { return findByGroupId(groupIds[0], start, end, orderByComparator); } boolean pagination = true; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderArgs = new Object[] { StringUtil.merge(groupIds) }; } else { finderArgs = new Object[] { StringUtil.merge(groupIds), start, end, orderByComparator }; } List<DDLRecordSet> list = null; if (retrieveFromCache) { list = (List<DDLRecordSet>) finderCache.getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (DDLRecordSet ddlRecordSet : list) { if (!ArrayUtil.contains(groupIds, ddlRecordSet.getGroupId())) { list = null; break; } } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_DDLRECORDSET_WHERE); if (groupIds.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); query.append(_FINDER_COLUMN_GROUPID_GROUPID_7); query.append(StringUtil.merge(groupIds)); query.append(StringPool.CLOSE_PARENTHESIS); query.append(StringPool.CLOSE_PARENTHESIS); } query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(DDLRecordSetModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); if (!pagination) { list = (List<DDLRecordSet>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List<DDLRecordSet>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID, finderArgs, list); } catch (Exception e) { finderCache.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:com.liferay.dynamic.data.lists.service.persistence.impl.DDLRecordSetPersistenceImpl.java
License:Open Source License
/** * Returns the number of ddl record sets where groupId = any ?. * * @param groupIds the group IDs/*from w ww . j a v a 2 s . com*/ * @return the number of matching ddl record sets */ @Override public int countByGroupId(long[] groupIds) { if (groupIds == null) { groupIds = new long[0]; } else if (groupIds.length > 1) { groupIds = ArrayUtil.unique(groupIds); Arrays.sort(groupIds); } Object[] finderArgs = new Object[] { StringUtil.merge(groupIds) }; Long count = (Long) finderCache.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_GROUPID, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_DDLRECORDSET_WHERE); if (groupIds.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); query.append(_FINDER_COLUMN_GROUPID_GROUPID_7); query.append(StringUtil.merge(groupIds)); query.append(StringPool.CLOSE_PARENTHESIS); query.append(StringPool.CLOSE_PARENTHESIS); } query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); count = (Long) q.uniqueResult(); finderCache.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_GROUPID, finderArgs, count); } catch (Exception e) { finderCache.removeResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_GROUPID, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:com.liferay.dynamic.data.lists.service.persistence.impl.DDLRecordSetPersistenceImpl.java
License:Open Source License
/** * Returns the number of ddl record sets that the user has permission to view where groupId = any ?. * * @param groupIds the group IDs//from w w w . j a v a 2 s .c o m * @return the number of matching ddl record sets that the user has permission to view */ @Override public int filterCountByGroupId(long[] groupIds) { if (!InlineSQLHelperUtil.isEnabled(groupIds)) { return countByGroupId(groupIds); } if (groupIds == null) { groupIds = new long[0]; } else if (groupIds.length > 1) { groupIds = ArrayUtil.unique(groupIds); Arrays.sort(groupIds); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_DDLRECORDSET_WHERE); if (groupIds.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); query.append(_FINDER_COLUMN_GROUPID_GROUPID_7); query.append(StringUtil.merge(groupIds)); query.append(StringPool.CLOSE_PARENTHESIS); query.append(StringPool.CLOSE_PARENTHESIS); } query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), DDLRecordSet.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupIds); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar(COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); Long count = (Long) q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } }
From source file:com.liferay.journal.service.persistence.impl.JournalArticleFinderImpl.java
License:Open Source License
protected String getDDMStructureKeys(String[] ddmStructureKeys, String tableName) { if (ArrayUtil.isEmpty(ddmStructureKeys)) { return StringPool.BLANK; }//from w w w . j a v a 2 s .co m StringBundler sb = new StringBundler(ddmStructureKeys.length * 3 + 1); sb.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < ddmStructureKeys.length; i++) { sb.append(tableName); sb.append(".DDMStructureKey = ? "); sb.append(WHERE_OR); } sb.setIndex(sb.index() - 1); sb.append(StringPool.CLOSE_PARENTHESIS); return sb.toString(); }
From source file:com.liferay.journal.service.persistence.impl.JournalArticleFinderImpl.java
License:Open Source License
protected String getFolderIds(List<Long> folderIds, String tableName) { if (folderIds.isEmpty()) { return StringPool.BLANK; }/* ww w . j ava 2 s. c om*/ StringBundler sb = new StringBundler(folderIds.size() * 3 + 1); sb.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < folderIds.size(); i++) { sb.append(tableName); sb.append(".folderId = ? "); if ((i + 1) != folderIds.size()) { sb.append(WHERE_OR); } } sb.append(StringPool.CLOSE_PARENTHESIS); return sb.toString(); }
From source file:com.liferay.journal.service.persistence.impl.JournalArticlePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the journal articles where DDMStructureKey = ?, optionally using the finder cache. * * <p>/*from w w w . j av 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 JournalArticleModelImpl}. 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 DDMStructureKey the ddm structure key * @param start the lower bound of the range of journal articles * @param end the upper bound of the range of journal articles (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching journal articles */ @Override public List<JournalArticle> findByDDMStructureKey(String[] DDMStructureKeies, int start, int end, OrderByComparator<JournalArticle> orderByComparator, boolean retrieveFromCache) { if (DDMStructureKeies == null) { DDMStructureKeies = new String[0]; } else if (DDMStructureKeies.length > 1) { DDMStructureKeies = ArrayUtil.distinct(DDMStructureKeies, NULL_SAFE_STRING_COMPARATOR); Arrays.sort(DDMStructureKeies, NULL_SAFE_STRING_COMPARATOR); } if (DDMStructureKeies.length == 1) { return findByDDMStructureKey(DDMStructureKeies[0], start, end, orderByComparator); } boolean pagination = true; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderArgs = new Object[] { StringUtil.merge(DDMStructureKeies) }; } else { finderArgs = new Object[] { StringUtil.merge(DDMStructureKeies), start, end, orderByComparator }; } List<JournalArticle> list = null; if (retrieveFromCache) { list = (List<JournalArticle>) finderCache.getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_DDMSTRUCTUREKEY, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (JournalArticle journalArticle : list) { if (!ArrayUtil.contains(DDMStructureKeies, journalArticle.getDDMStructureKey())) { list = null; break; } } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_JOURNALARTICLE_WHERE); if (DDMStructureKeies.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < DDMStructureKeies.length; i++) { String DDMStructureKey = DDMStructureKeies[i]; if (DDMStructureKey == null) { query.append(_FINDER_COLUMN_DDMSTRUCTUREKEY_DDMSTRUCTUREKEY_1); } else if (DDMStructureKey.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_DDMSTRUCTUREKEY_DDMSTRUCTUREKEY_3); } else { query.append(_FINDER_COLUMN_DDMSTRUCTUREKEY_DDMSTRUCTUREKEY_2); } if ((i + 1) < DDMStructureKeies.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); } query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(JournalArticleModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); for (String DDMStructureKey : DDMStructureKeies) { if ((DDMStructureKey != null) && !DDMStructureKey.isEmpty()) { qPos.add(DDMStructureKey); } } if (!pagination) { list = (List<JournalArticle>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List<JournalArticle>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_DDMSTRUCTUREKEY, finderArgs, list); } catch (Exception e) { finderCache.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_DDMSTRUCTUREKEY, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }
From source file:com.liferay.journal.service.persistence.impl.JournalArticlePersistenceImpl.java
License:Open Source License
/** * Returns the number of journal articles where DDMStructureKey = any ?. * * @param DDMStructureKeies the ddm structure keies * @return the number of matching journal articles */// www.j a va2 s. c o m @Override public int countByDDMStructureKey(String[] DDMStructureKeies) { if (DDMStructureKeies == null) { DDMStructureKeies = new String[0]; } else if (DDMStructureKeies.length > 1) { DDMStructureKeies = ArrayUtil.distinct(DDMStructureKeies, NULL_SAFE_STRING_COMPARATOR); Arrays.sort(DDMStructureKeies, NULL_SAFE_STRING_COMPARATOR); } Object[] finderArgs = new Object[] { StringUtil.merge(DDMStructureKeies) }; Long count = (Long) finderCache.getResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_DDMSTRUCTUREKEY, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_JOURNALARTICLE_WHERE); if (DDMStructureKeies.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); for (int i = 0; i < DDMStructureKeies.length; i++) { String DDMStructureKey = DDMStructureKeies[i]; if (DDMStructureKey == null) { query.append(_FINDER_COLUMN_DDMSTRUCTUREKEY_DDMSTRUCTUREKEY_1); } else if (DDMStructureKey.equals(StringPool.BLANK)) { query.append(_FINDER_COLUMN_DDMSTRUCTUREKEY_DDMSTRUCTUREKEY_3); } else { query.append(_FINDER_COLUMN_DDMSTRUCTUREKEY_DDMSTRUCTUREKEY_2); } if ((i + 1) < DDMStructureKeies.length) { query.append(WHERE_OR); } } query.append(StringPool.CLOSE_PARENTHESIS); } query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); for (String DDMStructureKey : DDMStructureKeies) { if ((DDMStructureKey != null) && !DDMStructureKey.isEmpty()) { qPos.add(DDMStructureKey); } } count = (Long) q.uniqueResult(); finderCache.putResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_DDMSTRUCTUREKEY, finderArgs, count); } catch (Exception e) { finderCache.removeResult(FINDER_PATH_WITH_PAGINATION_COUNT_BY_DDMSTRUCTUREKEY, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
From source file:com.liferay.journal.service.persistence.impl.JournalArticlePersistenceImpl.java
License:Open Source License
/** * Returns an ordered range of all the journal articles where resourcePrimKey = ? and status = ?, optionally using the finder cache. * * <p>/* w w w. java 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 JournalArticleModelImpl}. 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 resourcePrimKey the resource prim key * @param status the status * @param start the lower bound of the range of journal articles * @param end the upper bound of the range of journal articles (not inclusive) * @param orderByComparator the comparator to order the results by (optionally <code>null</code>) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching journal articles */ @Override public List<JournalArticle> findByR_ST(long resourcePrimKey, int[] statuses, int start, int end, OrderByComparator<JournalArticle> orderByComparator, boolean retrieveFromCache) { if (statuses == null) { statuses = new int[0]; } else if (statuses.length > 1) { statuses = ArrayUtil.unique(statuses); Arrays.sort(statuses); } if (statuses.length == 1) { return findByR_ST(resourcePrimKey, statuses[0], start, end, orderByComparator); } boolean pagination = true; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderArgs = new Object[] { resourcePrimKey, StringUtil.merge(statuses) }; } else { finderArgs = new Object[] { resourcePrimKey, StringUtil.merge(statuses), start, end, orderByComparator }; } List<JournalArticle> list = null; if (retrieveFromCache) { list = (List<JournalArticle>) finderCache.getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_R_ST, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (JournalArticle journalArticle : list) { if ((resourcePrimKey != journalArticle.getResourcePrimKey()) || !ArrayUtil.contains(statuses, journalArticle.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_JOURNALARTICLE_WHERE); query.append(_FINDER_COLUMN_R_ST_RESOURCEPRIMKEY_2); if (statuses.length > 0) { query.append(StringPool.OPEN_PARENTHESIS); query.append(_FINDER_COLUMN_R_ST_STATUS_7); query.append(StringUtil.merge(statuses)); query.append(StringPool.CLOSE_PARENTHESIS); query.append(StringPool.CLOSE_PARENTHESIS); } query.setStringAt(removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); if (orderByComparator != null) { appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(JournalArticleModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(resourcePrimKey); if (!pagination) { list = (List<JournalArticle>) QueryUtil.list(q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List<JournalArticle>) QueryUtil.list(q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_R_ST, finderArgs, list); } catch (Exception e) { finderCache.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_R_ST, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; }