Search in sources :

Example 6 with NoSuchSongException

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

the class SongPersistenceImpl method findByArtistId_Last.

/**
 * Returns the last song in the ordered set where artistId = ?.
 *
 * @param artistId the artist ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching song
 * @throws org.liferay.jukebox.NoSuchSongException if a matching song could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Song findByArtistId_Last(long artistId, OrderByComparator orderByComparator) throws NoSuchSongException, SystemException {
    Song song = fetchByArtistId_Last(artistId, orderByComparator);
    if (song != null) {
        return song;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("artistId=");
    msg.append(artistId);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchSongException(msg.toString());
}
Also used : Song(org.liferay.jukebox.model.Song) NoSuchSongException(org.liferay.jukebox.NoSuchSongException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 7 with NoSuchSongException

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

the class SongPersistenceImpl method filterFindByGroupId_PrevAndNext.

/**
 * Returns the songs before and after the current song in the ordered set of songs that the user has permission to view where groupId = &#63;.
 *
 * @param songId the primary key of the current song
 * @param groupId the group ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the previous, current, and next song
 * @throws org.liferay.jukebox.NoSuchSongException if a song with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Song[] filterFindByGroupId_PrevAndNext(long songId, long groupId, OrderByComparator orderByComparator) throws NoSuchSongException, SystemException {
    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
        return findByGroupId_PrevAndNext(songId, groupId, orderByComparator);
    }
    Song song = findByPrimaryKey(songId);
    Session session = null;
    try {
        session = openSession();
        Song[] array = new SongImpl[3];
        array[0] = filterGetByGroupId_PrevAndNext(session, song, groupId, orderByComparator, true);
        array[1] = song;
        array[2] = filterGetByGroupId_PrevAndNext(session, song, groupId, orderByComparator, false);
        return array;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Song(org.liferay.jukebox.model.Song) SongImpl(org.liferay.jukebox.model.impl.SongImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchSongException(org.liferay.jukebox.NoSuchSongException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 8 with NoSuchSongException

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

the class SongPersistenceImpl method remove.

/**
 * Removes the song with the primary key from the database. Also notifies the appropriate model listeners.
 *
 * @param primaryKey the primary key of the song
 * @return the song that was removed
 * @throws org.liferay.jukebox.NoSuchSongException if a song with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Song remove(Serializable primaryKey) throws NoSuchSongException, SystemException {
    Session session = null;
    try {
        session = openSession();
        Song song = (Song) session.get(SongImpl.class, primaryKey);
        if (song == null) {
            if (_log.isWarnEnabled()) {
                _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
            }
            throw new NoSuchSongException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }
        return remove(song);
    } catch (NoSuchSongException nsee) {
        throw nsee;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Song(org.liferay.jukebox.model.Song) NoSuchSongException(org.liferay.jukebox.NoSuchSongException) SongImpl(org.liferay.jukebox.model.impl.SongImpl) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchSongException(org.liferay.jukebox.NoSuchSongException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 9 with NoSuchSongException

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

the class SongPersistenceImpl method findByAlbumId_First.

/**
 * Returns the first song in the ordered set where albumId = &#63;.
 *
 * @param albumId the album ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the first matching song
 * @throws org.liferay.jukebox.NoSuchSongException if a matching song could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Song findByAlbumId_First(long albumId, OrderByComparator orderByComparator) throws NoSuchSongException, SystemException {
    Song song = fetchByAlbumId_First(albumId, orderByComparator);
    if (song != null) {
        return song;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("albumId=");
    msg.append(albumId);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchSongException(msg.toString());
}
Also used : Song(org.liferay.jukebox.model.Song) NoSuchSongException(org.liferay.jukebox.NoSuchSongException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 10 with NoSuchSongException

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

the class SongPersistenceImpl method findByGroupId_Last.

/**
 * Returns the last song in the ordered set where groupId = &#63;.
 *
 * @param groupId the group ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching song
 * @throws org.liferay.jukebox.NoSuchSongException if a matching song could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Song findByGroupId_Last(long groupId, OrderByComparator orderByComparator) throws NoSuchSongException, SystemException {
    Song song = fetchByGroupId_Last(groupId, orderByComparator);
    if (song != null) {
        return song;
    }
    StringBundler msg = new StringBundler(4);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("groupId=");
    msg.append(groupId);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchSongException(msg.toString());
}
Also used : Song(org.liferay.jukebox.model.Song) NoSuchSongException(org.liferay.jukebox.NoSuchSongException) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Aggregations

NoSuchSongException (org.liferay.jukebox.NoSuchSongException)41 Song (org.liferay.jukebox.model.Song)41 StringBundler (com.liferay.portal.kernel.util.StringBundler)24 Session (com.liferay.portal.kernel.dao.orm.Session)17 SystemException (com.liferay.portal.kernel.exception.SystemException)17 SongImpl (org.liferay.jukebox.model.impl.SongImpl)17