Search in sources :

Example 56 with FinderPath

use of com.liferay.portal.kernel.dao.orm.FinderPath in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method countByR_L.

/**
 * Returns the number of k b articles where resourcePrimKey = ? and latest = ?.
 *
 * @param resourcePrimKey the resource prim key
 * @param latest the latest
 * @return the number of matching k b articles
 * @throws SystemException if a system exception occurred
 */
@Override
public int countByR_L(long resourcePrimKey, boolean latest) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_R_L;
    Object[] finderArgs = new Object[] { resourcePrimKey, latest };
    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);
    if (count == null) {
        StringBundler query = new StringBundler(3);
        query.append(_SQL_COUNT_KBARTICLE_WHERE);
        query.append(_FINDER_COLUMN_R_L_RESOURCEPRIMKEY_2);
        query.append(_FINDER_COLUMN_R_L_LATEST_2);
        String sql = query.toString();
        Session session = null;
        try {
            session = openSession();
            Query q = session.createQuery(sql);
            QueryPos qPos = QueryPos.getInstance(q);
            qPos.add(resourcePrimKey);
            qPos.add(latest);
            count = (Long) q.uniqueResult();
            FinderCacheUtil.putResult(finderPath, finderArgs, count);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(finderPath, finderArgs);
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }
    return count.intValue();
}
Also used : SQLQuery(com.liferay.portal.kernel.dao.orm.SQLQuery) Query(com.liferay.portal.kernel.dao.orm.Query) FinderPath(com.liferay.portal.kernel.dao.orm.FinderPath) QueryPos(com.liferay.portal.kernel.dao.orm.QueryPos) StringBundler(com.liferay.portal.kernel.util.StringBundler) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 57 with FinderPath

use of com.liferay.portal.kernel.dao.orm.FinderPath in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method countByG_KBFI_UT.

/**
 * Returns the number of k b articles where groupId = ? and kbFolderId = ? and urlTitle = ?.
 *
 * @param groupId the group ID
 * @param kbFolderId the kb folder ID
 * @param urlTitle the url title
 * @return the number of matching k b articles
 * @throws SystemException if a system exception occurred
 */
@Override
public int countByG_KBFI_UT(long groupId, long kbFolderId, String urlTitle) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_G_KBFI_UT;
    Object[] finderArgs = new Object[] { groupId, kbFolderId, urlTitle };
    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);
    if (count == null) {
        StringBundler query = new StringBundler(4);
        query.append(_SQL_COUNT_KBARTICLE_WHERE);
        query.append(_FINDER_COLUMN_G_KBFI_UT_GROUPID_2);
        query.append(_FINDER_COLUMN_G_KBFI_UT_KBFOLDERID_2);
        boolean bindUrlTitle = false;
        if (urlTitle == null) {
            query.append(_FINDER_COLUMN_G_KBFI_UT_URLTITLE_1);
        } else if (urlTitle.equals(StringPool.BLANK)) {
            query.append(_FINDER_COLUMN_G_KBFI_UT_URLTITLE_3);
        } else {
            bindUrlTitle = true;
            query.append(_FINDER_COLUMN_G_KBFI_UT_URLTITLE_2);
        }
        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(kbFolderId);
            if (bindUrlTitle) {
                qPos.add(urlTitle);
            }
            count = (Long) q.uniqueResult();
            FinderCacheUtil.putResult(finderPath, finderArgs, count);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(finderPath, finderArgs);
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }
    return count.intValue();
}
Also used : SQLQuery(com.liferay.portal.kernel.dao.orm.SQLQuery) Query(com.liferay.portal.kernel.dao.orm.Query) FinderPath(com.liferay.portal.kernel.dao.orm.FinderPath) QueryPos(com.liferay.portal.kernel.dao.orm.QueryPos) StringBundler(com.liferay.portal.kernel.util.StringBundler) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 58 with FinderPath

use of com.liferay.portal.kernel.dao.orm.FinderPath in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method countByR_G_L.

/**
 * Returns the number of k b articles where resourcePrimKey = ? and groupId = ? and latest = ?.
 *
 * @param resourcePrimKey the resource prim key
 * @param groupId the group ID
 * @param latest the latest
 * @return the number of matching k b articles
 * @throws SystemException if a system exception occurred
 */
@Override
public int countByR_G_L(long resourcePrimKey, long groupId, boolean latest) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_R_G_L;
    Object[] finderArgs = new Object[] { resourcePrimKey, groupId, latest };
    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);
    if (count == null) {
        StringBundler query = new StringBundler(4);
        query.append(_SQL_COUNT_KBARTICLE_WHERE);
        query.append(_FINDER_COLUMN_R_G_L_RESOURCEPRIMKEY_2);
        query.append(_FINDER_COLUMN_R_G_L_GROUPID_2);
        query.append(_FINDER_COLUMN_R_G_L_LATEST_2);
        String sql = query.toString();
        Session session = null;
        try {
            session = openSession();
            Query q = session.createQuery(sql);
            QueryPos qPos = QueryPos.getInstance(q);
            qPos.add(resourcePrimKey);
            qPos.add(groupId);
            qPos.add(latest);
            count = (Long) q.uniqueResult();
            FinderCacheUtil.putResult(finderPath, finderArgs, count);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(finderPath, finderArgs);
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }
    return count.intValue();
}
Also used : SQLQuery(com.liferay.portal.kernel.dao.orm.SQLQuery) Query(com.liferay.portal.kernel.dao.orm.Query) FinderPath(com.liferay.portal.kernel.dao.orm.FinderPath) QueryPos(com.liferay.portal.kernel.dao.orm.QueryPos) StringBundler(com.liferay.portal.kernel.util.StringBundler) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 59 with FinderPath

use of com.liferay.portal.kernel.dao.orm.FinderPath in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method countByG_P_M.

/**
 * Returns the number of k b articles where groupId = ? and parentResourcePrimKey = ? and main = ?.
 *
 * @param groupId the group ID
 * @param parentResourcePrimKey the parent resource prim key
 * @param main the main
 * @return the number of matching k b articles
 * @throws SystemException if a system exception occurred
 */
@Override
public int countByG_P_M(long groupId, long parentResourcePrimKey, boolean main) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_G_P_M;
    Object[] finderArgs = new Object[] { groupId, parentResourcePrimKey, main };
    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);
    if (count == null) {
        StringBundler query = new StringBundler(4);
        query.append(_SQL_COUNT_KBARTICLE_WHERE);
        query.append(_FINDER_COLUMN_G_P_M_GROUPID_2);
        query.append(_FINDER_COLUMN_G_P_M_PARENTRESOURCEPRIMKEY_2);
        query.append(_FINDER_COLUMN_G_P_M_MAIN_2);
        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(parentResourcePrimKey);
            qPos.add(main);
            count = (Long) q.uniqueResult();
            FinderCacheUtil.putResult(finderPath, finderArgs, count);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(finderPath, finderArgs);
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }
    return count.intValue();
}
Also used : SQLQuery(com.liferay.portal.kernel.dao.orm.SQLQuery) Query(com.liferay.portal.kernel.dao.orm.Query) FinderPath(com.liferay.portal.kernel.dao.orm.FinderPath) QueryPos(com.liferay.portal.kernel.dao.orm.QueryPos) StringBundler(com.liferay.portal.kernel.util.StringBundler) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 60 with FinderPath

use of com.liferay.portal.kernel.dao.orm.FinderPath in project liferay-ide by liferay.

the class KBArticlePersistenceImpl method countByR_V.

/**
 * Returns the number of k b articles where resourcePrimKey = ? and version = ?.
 *
 * @param resourcePrimKey the resource prim key
 * @param version the version
 * @return the number of matching k b articles
 * @throws SystemException if a system exception occurred
 */
@Override
public int countByR_V(long resourcePrimKey, int version) throws SystemException {
    FinderPath finderPath = FINDER_PATH_COUNT_BY_R_V;
    Object[] finderArgs = new Object[] { resourcePrimKey, version };
    Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);
    if (count == null) {
        StringBundler query = new StringBundler(3);
        query.append(_SQL_COUNT_KBARTICLE_WHERE);
        query.append(_FINDER_COLUMN_R_V_RESOURCEPRIMKEY_2);
        query.append(_FINDER_COLUMN_R_V_VERSION_2);
        String sql = query.toString();
        Session session = null;
        try {
            session = openSession();
            Query q = session.createQuery(sql);
            QueryPos qPos = QueryPos.getInstance(q);
            qPos.add(resourcePrimKey);
            qPos.add(version);
            count = (Long) q.uniqueResult();
            FinderCacheUtil.putResult(finderPath, finderArgs, count);
        } catch (Exception e) {
            FinderCacheUtil.removeResult(finderPath, finderArgs);
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }
    return count.intValue();
}
Also used : SQLQuery(com.liferay.portal.kernel.dao.orm.SQLQuery) Query(com.liferay.portal.kernel.dao.orm.Query) FinderPath(com.liferay.portal.kernel.dao.orm.FinderPath) QueryPos(com.liferay.portal.kernel.dao.orm.QueryPos) StringBundler(com.liferay.portal.kernel.util.StringBundler) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArticleException(com.liferay.knowledgebase.NoSuchArticleException) Session(com.liferay.portal.kernel.dao.orm.Session)

Aggregations

FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)214 Query (com.liferay.portal.kernel.dao.orm.Query)214 Session (com.liferay.portal.kernel.dao.orm.Session)214 StringBundler (com.liferay.portal.kernel.util.StringBundler)214 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)197 SystemException (com.liferay.portal.kernel.exception.SystemException)191 SQLQuery (com.liferay.portal.kernel.dao.orm.SQLQuery)165 UnmodifiableList (com.liferay.portal.kernel.util.UnmodifiableList)93 ArrayList (java.util.ArrayList)93 List (java.util.List)93 NoSuchArticleException (com.liferay.knowledgebase.NoSuchArticleException)59 KBArticle (com.liferay.knowledgebase.model.KBArticle)29 NoSuchSongException (org.liferay.jukebox.NoSuchSongException)25 NoSuchAlbumException (org.liferay.jukebox.NoSuchAlbumException)22 NoSuchCommentException (com.liferay.knowledgebase.NoSuchCommentException)18 NoSuchArtistException (org.liferay.jukebox.NoSuchArtistException)18 NoSuchNodeException (com.liferay.portlet.wiki.NoSuchNodeException)15 Song (org.liferay.jukebox.model.Song)12 Album (org.liferay.jukebox.model.Album)11 NoSuchFolderException (com.liferay.knowledgebase.NoSuchFolderException)10