use of com.liferay.portal.kernel.dao.orm.Session 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.dao.orm.Session 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.dao.orm.Session 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.dao.orm.Session 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);
}
}
use of com.liferay.portal.kernel.dao.orm.Session in project liferay-ide by liferay.
the class AlbumPersistenceImpl method countByUuid_C.
/**
* Returns the number of albums where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @return the number of matching albums
* @throws SystemException if a system exception occurred
*/
@Override
public int countByUuid_C(String uuid, long companyId) throws SystemException {
FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_C;
Object[] finderArgs = new Object[] { uuid, companyId };
Long count = (Long) FinderCacheUtil.getResult(finderPath, finderArgs, this);
if (count == null) {
StringBundler query = new StringBundler(3);
query.append(_SQL_COUNT_ALBUM_WHERE);
boolean bindUuid = false;
if (uuid == null) {
query.append(_FINDER_COLUMN_UUID_C_UUID_1);
} else if (uuid.equals(StringPool.BLANK)) {
query.append(_FINDER_COLUMN_UUID_C_UUID_3);
} else {
bindUuid = true;
query.append(_FINDER_COLUMN_UUID_C_UUID_2);
}
query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
String sql = query.toString();
Session session = null;
try {
session = openSession();
Query q = session.createQuery(sql);
QueryPos qPos = QueryPos.getInstance(q);
if (bindUuid) {
qPos.add(uuid);
}
qPos.add(companyId);
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