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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations