Example usage for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS

List of usage examples for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS.

Prototype

String CLOSE_PARENTHESIS

To view the source code for com.liferay.portal.kernel.util StringPool CLOSE_PARENTHESIS.

Click Source Link

Usage

From source file:com.liferay.journal.service.persistence.impl.JournalArticleResourcePersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, JournalArticleResource> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }//from www  .j  a va2  s  .  co  m

    Map<Serializable, JournalArticleResource> map = new HashMap<Serializable, JournalArticleResource>();

    if (primaryKeys.size() == 1) {
        Iterator<Serializable> iterator = primaryKeys.iterator();

        Serializable primaryKey = iterator.next();

        JournalArticleResource journalArticleResource = fetchByPrimaryKey(primaryKey);

        if (journalArticleResource != null) {
            map.put(primaryKey, journalArticleResource);
        }

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        Serializable serializable = entityCache.getResult(JournalArticleResourceModelImpl.ENTITY_CACHE_ENABLED,
                JournalArticleResourceImpl.class, primaryKey);

        if (serializable != nullModel) {
            if (serializable == null) {
                if (uncachedPrimaryKeys == null) {
                    uncachedPrimaryKeys = new HashSet<Serializable>();
                }

                uncachedPrimaryKeys.add(primaryKey);
            } else {
                map.put(primaryKey, (JournalArticleResource) serializable);
            }
        }
    }

    if (uncachedPrimaryKeys == null) {
        return map;
    }

    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1);

    query.append(_SQL_SELECT_JOURNALARTICLERESOURCE_WHERE_PKS_IN);

    for (Serializable primaryKey : uncachedPrimaryKeys) {
        query.append((long) primaryKey);

        query.append(StringPool.COMMA);
    }

    query.setIndex(query.index() - 1);

    query.append(StringPool.CLOSE_PARENTHESIS);

    String sql = query.toString();

    Session session = null;

    try {
        session = openSession();

        Query q = session.createQuery(sql);

        for (JournalArticleResource journalArticleResource : (List<JournalArticleResource>) q.list()) {
            map.put(journalArticleResource.getPrimaryKeyObj(), journalArticleResource);

            cacheResult(journalArticleResource);

            uncachedPrimaryKeys.remove(journalArticleResource.getPrimaryKeyObj());
        }

        for (Serializable primaryKey : uncachedPrimaryKeys) {
            entityCache.putResult(JournalArticleResourceModelImpl.ENTITY_CACHE_ENABLED,
                    JournalArticleResourceImpl.class, primaryKey, nullModel);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }

    return map;
}

From source file:com.liferay.journal.service.persistence.impl.JournalContentSearchPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, JournalContentSearch> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }/*from   ww w. j  a v  a  2  s  .com*/

    Map<Serializable, JournalContentSearch> map = new HashMap<Serializable, JournalContentSearch>();

    if (primaryKeys.size() == 1) {
        Iterator<Serializable> iterator = primaryKeys.iterator();

        Serializable primaryKey = iterator.next();

        JournalContentSearch journalContentSearch = fetchByPrimaryKey(primaryKey);

        if (journalContentSearch != null) {
            map.put(primaryKey, journalContentSearch);
        }

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        Serializable serializable = entityCache.getResult(JournalContentSearchModelImpl.ENTITY_CACHE_ENABLED,
                JournalContentSearchImpl.class, primaryKey);

        if (serializable != nullModel) {
            if (serializable == null) {
                if (uncachedPrimaryKeys == null) {
                    uncachedPrimaryKeys = new HashSet<Serializable>();
                }

                uncachedPrimaryKeys.add(primaryKey);
            } else {
                map.put(primaryKey, (JournalContentSearch) serializable);
            }
        }
    }

    if (uncachedPrimaryKeys == null) {
        return map;
    }

    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1);

    query.append(_SQL_SELECT_JOURNALCONTENTSEARCH_WHERE_PKS_IN);

    for (Serializable primaryKey : uncachedPrimaryKeys) {
        query.append((long) primaryKey);

        query.append(StringPool.COMMA);
    }

    query.setIndex(query.index() - 1);

    query.append(StringPool.CLOSE_PARENTHESIS);

    String sql = query.toString();

    Session session = null;

    try {
        session = openSession();

        Query q = session.createQuery(sql);

        for (JournalContentSearch journalContentSearch : (List<JournalContentSearch>) q.list()) {
            map.put(journalContentSearch.getPrimaryKeyObj(), journalContentSearch);

            cacheResult(journalContentSearch);

            uncachedPrimaryKeys.remove(journalContentSearch.getPrimaryKeyObj());
        }

        for (Serializable primaryKey : uncachedPrimaryKeys) {
            entityCache.putResult(JournalContentSearchModelImpl.ENTITY_CACHE_ENABLED,
                    JournalContentSearchImpl.class, primaryKey, nullModel);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }

    return map;
}

From source file:com.liferay.journal.service.persistence.impl.JournalFeedPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, JournalFeed> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }// w  w  w  .  j  a  v  a  2  s . c om

    Map<Serializable, JournalFeed> map = new HashMap<Serializable, JournalFeed>();

    if (primaryKeys.size() == 1) {
        Iterator<Serializable> iterator = primaryKeys.iterator();

        Serializable primaryKey = iterator.next();

        JournalFeed journalFeed = fetchByPrimaryKey(primaryKey);

        if (journalFeed != null) {
            map.put(primaryKey, journalFeed);
        }

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        Serializable serializable = entityCache.getResult(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
                JournalFeedImpl.class, primaryKey);

        if (serializable != nullModel) {
            if (serializable == null) {
                if (uncachedPrimaryKeys == null) {
                    uncachedPrimaryKeys = new HashSet<Serializable>();
                }

                uncachedPrimaryKeys.add(primaryKey);
            } else {
                map.put(primaryKey, (JournalFeed) serializable);
            }
        }
    }

    if (uncachedPrimaryKeys == null) {
        return map;
    }

    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1);

    query.append(_SQL_SELECT_JOURNALFEED_WHERE_PKS_IN);

    for (Serializable primaryKey : uncachedPrimaryKeys) {
        query.append((long) primaryKey);

        query.append(StringPool.COMMA);
    }

    query.setIndex(query.index() - 1);

    query.append(StringPool.CLOSE_PARENTHESIS);

    String sql = query.toString();

    Session session = null;

    try {
        session = openSession();

        Query q = session.createQuery(sql);

        for (JournalFeed journalFeed : (List<JournalFeed>) q.list()) {
            map.put(journalFeed.getPrimaryKeyObj(), journalFeed);

            cacheResult(journalFeed);

            uncachedPrimaryKeys.remove(journalFeed.getPrimaryKeyObj());
        }

        for (Serializable primaryKey : uncachedPrimaryKeys) {
            entityCache.putResult(JournalFeedModelImpl.ENTITY_CACHE_ENABLED, JournalFeedImpl.class, primaryKey,
                    nullModel);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }

    return map;
}

From source file:com.liferay.journal.service.persistence.impl.JournalFolderFinderImpl.java

License:Open Source License

protected int doCountF_A_ByG_F(long groupId, long folderId, QueryDefinition<?> queryDefinition,
        boolean inlineSQLHelper) {

    Session session = null;/*  w  ww .j a  v  a2  s. c  o  m*/

    try {
        session = openSession();

        StringBundler sb = new StringBundler(5);

        sb.append(StringPool.OPEN_PARENTHESIS);
        sb.append(getFoldersSQL(COUNT_F_BY_G_F, groupId, queryDefinition, inlineSQLHelper));
        sb.append(") UNION ALL (");
        sb.append(getArticlesSQL(COUNT_A_BY_G_U_F, groupId, queryDefinition, inlineSQLHelper));
        sb.append(StringPool.CLOSE_PARENTHESIS);

        String sql = updateSQL(sb.toString(), folderId);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addScalar(COUNT_COLUMN_NAME, Type.LONG);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(groupId);
        qPos.add(queryDefinition.getStatus());

        if (folderId >= 0) {
            qPos.add(folderId);
        }

        qPos.add(groupId);

        if (queryDefinition.getOwnerUserId() > 0) {
            qPos.add(queryDefinition.getOwnerUserId());
            qPos.add(WorkflowConstants.STATUS_IN_TRASH);
        }

        qPos.add(queryDefinition.getStatus());

        if (folderId >= 0) {
            qPos.add(folderId);
        }

        int count = 0;

        Iterator<Long> itr = q.iterate();

        while (itr.hasNext()) {
            Long l = itr.next();

            if (l != null) {
                count += l.intValue();
            }
        }

        return count;
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.journal.service.persistence.impl.JournalFolderFinderImpl.java

License:Open Source License

protected List<Object> doFindF_A_ByG_F(long groupId, long folderId, QueryDefinition<?> queryDefinition,
        boolean inlineSQLHelper) {

    Session session = null;/*from   w ww .j a  v a  2s . co  m*/

    try {
        session = openSession();

        StringBundler sb = new StringBundler(5);

        sb.append(StringPool.OPEN_PARENTHESIS);
        sb.append(getFoldersSQL(FIND_F_BY_G_F, groupId, queryDefinition, inlineSQLHelper));
        sb.append(") UNION ALL (");
        sb.append(getArticlesSQL(FIND_A_BY_G_U_F, groupId, queryDefinition, inlineSQLHelper));
        sb.append(StringPool.CLOSE_PARENTHESIS);

        String sql = updateSQL(sb.toString(), folderId);

        sql = CustomSQLUtil.replaceOrderBy(sql, queryDefinition.getOrderByComparator());

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addScalar("modelFolderId", Type.LONG);
        q.addScalar("modelFolder", Type.LONG);
        q.addScalar("articleId", Type.STRING);
        q.addScalar("version", Type.DOUBLE);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(groupId);
        qPos.add(queryDefinition.getStatus());

        if (folderId >= 0) {
            qPos.add(folderId);
        }

        qPos.add(groupId);

        if (queryDefinition.getOwnerUserId() > 0) {
            qPos.add(queryDefinition.getOwnerUserId());
            qPos.add(WorkflowConstants.STATUS_IN_TRASH);
        }

        qPos.add(queryDefinition.getStatus());

        if (folderId >= 0) {
            qPos.add(folderId);
        }

        List<Object> models = new ArrayList<>();

        Iterator<Object[]> itr = (Iterator<Object[]>) QueryUtil.iterate(q, getDialect(),
                queryDefinition.getStart(), queryDefinition.getEnd());

        while (itr.hasNext()) {
            Object[] array = itr.next();

            long curFolderId = (Long) array[0];
            long modelFolder = (Long) array[1];

            Object obj = null;

            if (modelFolder == 1) {
                obj = JournalFolderUtil.findByPrimaryKey(curFolderId);
            } else {
                String articleId = (String) array[2];
                double version = (Double) array[3];

                obj = JournalArticleUtil.findByG_A_V(groupId, articleId, version);
            }

            models.add(obj);
        }

        return models;
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.journal.service.persistence.impl.JournalFolderFinderImpl.java

License:Open Source License

protected List<Object> doFindF_A_ByG_F_L(long groupId, long folderId, Locale locale,
        QueryDefinition<?> queryDefinition, boolean inlineSQLHelper) {

    Session session = null;//from w  w w  .  j a va2  s .  com

    try {
        session = openSession();

        StringBundler sb = new StringBundler(5);

        sb.append(StringPool.OPEN_PARENTHESIS);
        sb.append(getFoldersSQL(FIND_F_BY_G_F_L, groupId, queryDefinition, inlineSQLHelper));
        sb.append(") UNION ALL (");
        sb.append(getArticlesSQL(FIND_A_BY_G_U_F_L, groupId, queryDefinition, inlineSQLHelper));
        sb.append(StringPool.CLOSE_PARENTHESIS);

        String sql = updateSQL(sb.toString(), folderId);

        sql = CustomSQLUtil.replaceOrderBy(sql, queryDefinition.getOrderByComparator());

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addScalar("modelFolderId", Type.LONG);
        q.addScalar("modelFolder", Type.LONG);
        q.addScalar("articleId", Type.STRING);
        q.addScalar("version", Type.DOUBLE);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(groupId);
        qPos.add(queryDefinition.getStatus());

        if (folderId >= 0) {
            qPos.add(folderId);
        }

        qPos.add(groupId);

        if (queryDefinition.getOwnerUserId() > 0) {
            qPos.add(queryDefinition.getOwnerUserId());
            qPos.add(WorkflowConstants.STATUS_IN_TRASH);
        }

        qPos.add(queryDefinition.getStatus());

        if (folderId >= 0) {
            qPos.add(folderId);
        }

        qPos.add(LocaleUtil.toLanguageId(locale));

        List<Object> models = new ArrayList<>();

        Iterator<Object[]> itr = (Iterator<Object[]>) QueryUtil.iterate(q, getDialect(),
                queryDefinition.getStart(), queryDefinition.getEnd());

        while (itr.hasNext()) {
            Object[] array = itr.next();

            long curFolderId = (Long) array[0];
            long modelFolder = (Long) array[1];

            Object obj = null;

            if (modelFolder == 1) {
                obj = JournalFolderUtil.findByPrimaryKey(curFolderId);
            } else {
                String articleId = (String) array[2];
                double version = (Double) array[3];

                obj = JournalArticleUtil.findByG_A_V(groupId, articleId, version);
            }

            models.add(obj);
        }

        return models;
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.journal.service.persistence.impl.JournalFolderPersistenceImpl.java

License:Open Source License

@Override
public Map<Serializable, JournalFolder> fetchByPrimaryKeys(Set<Serializable> primaryKeys) {
    if (primaryKeys.isEmpty()) {
        return Collections.emptyMap();
    }/*from w  w  w. ja v a 2 s  .  c  o m*/

    Map<Serializable, JournalFolder> map = new HashMap<Serializable, JournalFolder>();

    if (primaryKeys.size() == 1) {
        Iterator<Serializable> iterator = primaryKeys.iterator();

        Serializable primaryKey = iterator.next();

        JournalFolder journalFolder = fetchByPrimaryKey(primaryKey);

        if (journalFolder != null) {
            map.put(primaryKey, journalFolder);
        }

        return map;
    }

    Set<Serializable> uncachedPrimaryKeys = null;

    for (Serializable primaryKey : primaryKeys) {
        Serializable serializable = entityCache.getResult(JournalFolderModelImpl.ENTITY_CACHE_ENABLED,
                JournalFolderImpl.class, primaryKey);

        if (serializable != nullModel) {
            if (serializable == null) {
                if (uncachedPrimaryKeys == null) {
                    uncachedPrimaryKeys = new HashSet<Serializable>();
                }

                uncachedPrimaryKeys.add(primaryKey);
            } else {
                map.put(primaryKey, (JournalFolder) serializable);
            }
        }
    }

    if (uncachedPrimaryKeys == null) {
        return map;
    }

    StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) + 1);

    query.append(_SQL_SELECT_JOURNALFOLDER_WHERE_PKS_IN);

    for (Serializable primaryKey : uncachedPrimaryKeys) {
        query.append((long) primaryKey);

        query.append(StringPool.COMMA);
    }

    query.setIndex(query.index() - 1);

    query.append(StringPool.CLOSE_PARENTHESIS);

    String sql = query.toString();

    Session session = null;

    try {
        session = openSession();

        Query q = session.createQuery(sql);

        for (JournalFolder journalFolder : (List<JournalFolder>) q.list()) {
            map.put(journalFolder.getPrimaryKeyObj(), journalFolder);

            cacheResult(journalFolder);

            uncachedPrimaryKeys.remove(journalFolder.getPrimaryKeyObj());
        }

        for (Serializable primaryKey : uncachedPrimaryKeys) {
            entityCache.putResult(JournalFolderModelImpl.ENTITY_CACHE_ENABLED, JournalFolderImpl.class,
                    primaryKey, nullModel);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }

    return map;
}

From source file:com.liferay.knowledgebase.admin.importer.util.KBArticleMarkdownConverter.java

License:Open Source License

protected String getUrlTitle(String heading) {
    String urlTitle = null;//from  w w w.j ava2s  .c  om

    int x = heading.indexOf("[](id=");
    int y = heading.indexOf(StringPool.CLOSE_PARENTHESIS, x);

    if (y > (x + 1)) {
        int equalsSign = heading.indexOf(StringPool.EQUAL, x);

        urlTitle = heading.substring(equalsSign + 1, y);

        urlTitle = StringUtil.replace(urlTitle, StringPool.SPACE, StringPool.DASH);

        urlTitle = StringUtil.toLowerCase(urlTitle);
    }

    if (!urlTitle.startsWith(StringPool.SLASH)) {
        urlTitle = StringPool.SLASH + urlTitle;
    }

    return urlTitle;
}

From source file:com.liferay.knowledgebase.admin.importer.util.KBArticleMarkdownConverter.java

License:Open Source License

protected String stripIds(String content) {
    int index = content.indexOf("[](id=");

    if (index == -1) {
        return content;
    }/*from  ww  w  .j  av a2s  . c o m*/

    StringBundler sb = new StringBundler();

    do {
        int x = content.indexOf(StringPool.EQUAL, index);
        int y = content.indexOf(StringPool.CLOSE_PARENTHESIS, x);

        if (y != -1) {
            sb.append(StringUtil.trimTrailing(content.substring(0, index)));

            content = content.substring(y + 1);
        } else {
            if (_log.isWarnEnabled()) {
                String msg = content.substring(index);

                // Get the invalid id text from the content

                int spaceIndex = content.indexOf(StringPool.SPACE);

                if (spaceIndex != -1) {
                    msg = content.substring(index, spaceIndex);
                }

                _log.warn("Missing ')' for web content containing header id " + msg);
            }

            // Since no close parenthesis remains in the content, stop
            // stripping out IDs and simply include all of the remaining
            // content

            break;
        }
    } while ((index = content.indexOf("[](id=")) != -1);

    sb.append(content);

    return sb.toString();
}

From source file:com.liferay.knowledgebase.service.persistence.impl.KBArticlePersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the k b articles where resourcePrimKey = any &#63; and latest = &#63;.
 *
 * <p>/*ww  w . jav a2  s .  c  om*/
 * 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. 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 com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link com.liferay.knowledgebase.model.impl.KBArticleModelImpl}. 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 resourcePrimKeies the resource prim keies
 * @param latest the latest
 * @param start the lower bound of the range of k b articles
 * @param end the upper bound of the range of k b articles (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of matching k b articles
 */
@Override
public List<KBArticle> findByR_L(long[] resourcePrimKeies, boolean latest, int start, int end,
        OrderByComparator<KBArticle> orderByComparator) {
    if (resourcePrimKeies == null) {
        resourcePrimKeies = new long[0];
    } else {
        resourcePrimKeies = ArrayUtil.unique(resourcePrimKeies);
    }

    if (resourcePrimKeies.length == 1) {
        return findByR_L(resourcePrimKeies[0], latest, 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(resourcePrimKeies), latest };
    } else {
        finderArgs = new Object[] { StringUtil.merge(resourcePrimKeies), latest,

                start, end, orderByComparator };
    }

    List<KBArticle> list = (List<KBArticle>) FinderCacheUtil.getResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_R_L,
            finderArgs, this);

    if ((list != null) && !list.isEmpty()) {
        for (KBArticle kbArticle : list) {
            if (!ArrayUtil.contains(resourcePrimKeies, kbArticle.getResourcePrimKey())
                    || (latest != kbArticle.getLatest())) {
                list = null;

                break;
            }
        }
    }

    if (list == null) {
        StringBundler query = new StringBundler();

        query.append(_SQL_SELECT_KBARTICLE_WHERE);

        if (resourcePrimKeies.length > 0) {
            query.append(StringPool.OPEN_PARENTHESIS);

            query.append(_FINDER_COLUMN_R_L_RESOURCEPRIMKEY_7);

            query.append(StringUtil.merge(resourcePrimKeies));

            query.append(StringPool.CLOSE_PARENTHESIS);

            query.append(StringPool.CLOSE_PARENTHESIS);

            query.append(WHERE_AND);
        }

        query.append(_FINDER_COLUMN_R_L_LATEST_2);

        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(KBArticleModelImpl.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(latest);

            if (!pagination) {
                list = (List<KBArticle>) QueryUtil.list(q, getDialect(), start, end, false);

                Collections.sort(list);

                list = Collections.unmodifiableList(list);
            } else {
                list = (List<KBArticle>) QueryUtil.list(q, getDialect(), start, end);
            }

            cacheResult(list);

            FinderCacheUtil.putResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_R_L, finderArgs, list);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(FINDER_PATH_WITH_PAGINATION_FIND_BY_R_L, finderArgs);

            throw processException(e);
        } finally {
            closeSession(session);
        }
    }

    return list;
}