Search in sources :

Example 36 with NoSuchAlbumException

use of org.liferay.jukebox.NoSuchAlbumException in project liferay-ide by liferay.

the class AlbumPersistenceImpl method filterFindByGroupId_PrevAndNext.

/**
 * Returns the albums before and after the current album in the ordered set of albums that the user has permission to view 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[] filterFindByGroupId_PrevAndNext(long albumId, long groupId, OrderByComparator orderByComparator) throws NoSuchAlbumException, SystemException {
    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
        return findByGroupId_PrevAndNext(albumId, groupId, orderByComparator);
    }
    Album album = findByPrimaryKey(albumId);
    Session session = null;
    try {
        session = openSession();
        Album[] array = new AlbumImpl[3];
        array[0] = filterGetByGroupId_PrevAndNext(session, album, groupId, orderByComparator, true);
        array[1] = album;
        array[2] = filterGetByGroupId_PrevAndNext(session, album, groupId, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : AlbumImpl(org.liferay.jukebox.model.impl.AlbumImpl) Album(org.liferay.jukebox.model.Album) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchAlbumException(org.liferay.jukebox.NoSuchAlbumException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 37 with NoSuchAlbumException

use of org.liferay.jukebox.NoSuchAlbumException in project liferay-ide by liferay.

the class AlbumPersistenceImpl method findByArtistId_PrevAndNext.

/**
 * Returns the albums before and after the current album in the ordered set where artistId = &#63;.
 *
 * @param albumId the primary key of the current album
 * @param artistId the artist 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[] findByArtistId_PrevAndNext(long albumId, long artistId, OrderByComparator orderByComparator) throws NoSuchAlbumException, SystemException {
    Album album = findByPrimaryKey(albumId);
    Session session = null;
    try {
        session = openSession();
        Album[] array = new AlbumImpl[3];
        array[0] = getByArtistId_PrevAndNext(session, album, artistId, orderByComparator, true);
        array[1] = album;
        array[2] = getByArtistId_PrevAndNext(session, album, artistId, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : AlbumImpl(org.liferay.jukebox.model.impl.AlbumImpl) Album(org.liferay.jukebox.model.Album) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchAlbumException(org.liferay.jukebox.NoSuchAlbumException) Session(com.liferay.portal.kernel.dao.orm.Session)

Aggregations

NoSuchAlbumException (org.liferay.jukebox.NoSuchAlbumException)37 Album (org.liferay.jukebox.model.Album)37 StringBundler (com.liferay.portal.kernel.util.StringBundler)21 Session (com.liferay.portal.kernel.dao.orm.Session)16 SystemException (com.liferay.portal.kernel.exception.SystemException)16 AlbumImpl (org.liferay.jukebox.model.impl.AlbumImpl)16