use of com.liferay.portal.kernel.exception.SystemException in project liferay-ide by liferay.
the class AlbumPersistenceImpl method filterCountByG_A_S.
/**
* Returns the number of albums that the user has permission to view where groupId = ? and artistId = ? and status = ?.
*
* @param groupId the group ID
* @param artistId the artist ID
* @param status the status
* @return the number of matching albums that the user has permission to view
* @throws SystemException if a system exception occurred
*/
@Override
public int filterCountByG_A_S(long groupId, long artistId, int status) throws SystemException {
if (!InlineSQLHelperUtil.isEnabled(groupId)) {
return countByG_A_S(groupId, artistId, status);
}
StringBundler query = new StringBundler(4);
query.append(_FILTER_SQL_COUNT_ALBUM_WHERE);
query.append(_FINDER_COLUMN_G_A_S_GROUPID_2);
query.append(_FINDER_COLUMN_G_A_S_ARTISTID_2);
query.append(_FINDER_COLUMN_G_A_S_STATUS_2);
String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), Album.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(artistId);
qPos.add(status);
Long count = (Long) q.uniqueResult();
return count.intValue();
} catch (Exception e) {
throw processException(e);
} finally {
closeSession(session);
}
}
use of com.liferay.portal.kernel.exception.SystemException in project liferay-ide by liferay.
the class AlbumPersistenceImpl method findByUuid_C_PrevAndNext.
/**
* Returns the albums before and after the current album in the ordered set where uuid = ? and companyId = ?.
*
* @param albumId the primary key of the current album
* @param uuid the uuid
* @param companyId the company ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next album
* @throws org.liferay.jukebox.NoSuchAlbumException if a album with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
@Override
public Album[] findByUuid_C_PrevAndNext(long albumId, String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchAlbumException, SystemException {
Album album = findByPrimaryKey(albumId);
Session session = null;
try {
session = openSession();
Album[] array = new AlbumImpl[3];
array[0] = getByUuid_C_PrevAndNext(session, album, uuid, companyId, orderByComparator, true);
array[1] = album;
array[2] = getByUuid_C_PrevAndNext(session, album, uuid, companyId, orderByComparator, false);
return array;
} catch (Exception e) {
throw processException(e);
} finally {
closeSession(session);
}
}
use of com.liferay.portal.kernel.exception.SystemException in project liferay-ide by liferay.
the class AlbumPersistenceImpl method countByG_S.
/**
* Returns the number of albums where groupId = ? and status = ?.
*
* @param groupId the group ID
* @param status the status
* @return the number of matching albums
* @throws SystemException if a system exception occurred
*/
@Override
public int countByG_S(long groupId, int status) throws SystemException {
FinderPath finderPath = FINDER_PATH_COUNT_BY_G_S;
Object[] finderArgs = new Object[] { groupId, status };
Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_ALBUM_WHERE);
query.append(_FINDER_COLUMN_G_S_GROUPID_2);
query.append(_FINDER_COLUMN_G_S_STATUS_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(status);
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.exception.SystemException in project liferay-ide by liferay.
the class AlbumPersistenceImpl method findByGroupId_PrevAndNext.
/**
* Returns the albums before and after the current album in the ordered set where groupId = ?.
*
* @param albumId the primary key of the current album
* @param groupId the group ID
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next album
* @throws org.liferay.jukebox.NoSuchAlbumException if a album with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
@Override
public Album[] findByGroupId_PrevAndNext(long albumId, long groupId, OrderByComparator orderByComparator) throws NoSuchAlbumException, SystemException {
Album album = findByPrimaryKey(albumId);
Session session = null;
try {
session = openSession();
Album[] array = new AlbumImpl[3];
array[0] = getByGroupId_PrevAndNext(session, album, groupId, orderByComparator, true);
array[1] = album;
array[2] = getByGroupId_PrevAndNext(session, album, groupId, orderByComparator, false);
return array;
} catch (Exception e) {
throw processException(e);
} finally {
closeSession(session);
}
}
use of com.liferay.portal.kernel.exception.SystemException in project liferay-ide by liferay.
the class AlbumPersistenceImpl method findByG_A_S_PrevAndNext.
/**
* Returns the albums before and after the current album in the ordered set where groupId = ? and artistId = ? and status = ?.
*
* @param albumId the primary key of the current album
* @param groupId the group ID
* @param artistId the artist ID
* @param status the status
* @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
* @return the previous, current, and next album
* @throws org.liferay.jukebox.NoSuchAlbumException if a album with the primary key could not be found
* @throws SystemException if a system exception occurred
*/
@Override
public Album[] findByG_A_S_PrevAndNext(long albumId, long groupId, long artistId, int status, OrderByComparator orderByComparator) throws NoSuchAlbumException, SystemException {
Album album = findByPrimaryKey(albumId);
Session session = null;
try {
session = openSession();
Album[] array = new AlbumImpl[3];
array[0] = getByG_A_S_PrevAndNext(session, album, groupId, artistId, status, orderByComparator, true);
array[1] = album;
array[2] = getByG_A_S_PrevAndNext(session, album, groupId, artistId, status, orderByComparator, false);
return array;
} catch (Exception e) {
throw processException(e);
} finally {
closeSession(session);
}
}
Aggregations