Search in sources :

Example 6 with SongImpl

use of org.liferay.jukebox.model.impl.SongImpl in project liferay-ide by liferay.

the class SongPersistenceImpl method findByG_A_S_PrevAndNext.

/**
 * Returns the songs before and after the current song in the ordered set where groupId = ? and albumId = ? and status = ?.
 *
 * @param songId the primary key of the current song
 * @param groupId the group ID
 * @param albumId the album ID
 * @param status the status
 * @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[] findByG_A_S_PrevAndNext(long songId, long groupId, long albumId, int status, OrderByComparator orderByComparator) throws NoSuchSongException, SystemException {
    Song song = findByPrimaryKey(songId);
    Session session = null;
    try {
        session = openSession();
        Song[] array = new SongImpl[3];
        array[0] = getByG_A_S_PrevAndNext(session, song, groupId, albumId, status, orderByComparator, true);
        array[1] = song;
        array[2] = getByG_A_S_PrevAndNext(session, song, groupId, albumId, status, 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 7 with SongImpl

use of org.liferay.jukebox.model.impl.SongImpl in project liferay-ide by liferay.

the class SongPersistenceImpl method filterFindByG_LikeN_S_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; and name LIKE &#63; and status = &#63;.
 *
 * @param songId the primary key of the current song
 * @param groupId the group ID
 * @param name the name
 * @param status the status
 * @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[] filterFindByG_LikeN_S_PrevAndNext(long songId, long groupId, String name, int status, OrderByComparator orderByComparator) throws NoSuchSongException, SystemException {
    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
        return findByG_LikeN_S_PrevAndNext(songId, groupId, name, status, orderByComparator);
    }
    Song song = findByPrimaryKey(songId);
    Session session = null;
    try {
        session = openSession();
        Song[] array = new SongImpl[3];
        array[0] = filterGetByG_LikeN_S_PrevAndNext(session, song, groupId, name, status, orderByComparator, true);
        array[1] = song;
        array[2] = filterGetByG_LikeN_S_PrevAndNext(session, song, groupId, name, status, 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 SongImpl

use of org.liferay.jukebox.model.impl.SongImpl in project liferay-ide by liferay.

the class SongPersistenceImpl method toUnwrappedModel.

protected Song toUnwrappedModel(Song song) {
    if (song instanceof SongImpl) {
        return song;
    }
    SongImpl songImpl = new SongImpl();
    songImpl.setNew(song.isNew());
    songImpl.setPrimaryKey(song.getPrimaryKey());
    songImpl.setUuid(song.getUuid());
    songImpl.setSongId(song.getSongId());
    songImpl.setCompanyId(song.getCompanyId());
    songImpl.setGroupId(song.getGroupId());
    songImpl.setUserId(song.getUserId());
    songImpl.setUserName(song.getUserName());
    songImpl.setCreateDate(song.getCreateDate());
    songImpl.setModifiedDate(song.getModifiedDate());
    songImpl.setArtistId(song.getArtistId());
    songImpl.setAlbumId(song.getAlbumId());
    songImpl.setName(song.getName());
    songImpl.setStatus(song.getStatus());
    songImpl.setStatusByUserId(song.getStatusByUserId());
    songImpl.setStatusByUserName(song.getStatusByUserName());
    songImpl.setStatusDate(song.getStatusDate());
    return songImpl;
}
Also used : SongImpl(org.liferay.jukebox.model.impl.SongImpl)

Example 9 with SongImpl

use of org.liferay.jukebox.model.impl.SongImpl in project liferay-ide by liferay.

the class SongPersistenceImpl method findByG_A_PrevAndNext.

/**
 * Returns the songs before and after the current song in the ordered set where groupId = &#63; and albumId = &#63;.
 *
 * @param songId the primary key of the current song
 * @param groupId the group ID
 * @param albumId the album 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[] findByG_A_PrevAndNext(long songId, long groupId, long albumId, OrderByComparator orderByComparator) throws NoSuchSongException, SystemException {
    Song song = findByPrimaryKey(songId);
    Session session = null;
    try {
        session = openSession();
        Song[] array = new SongImpl[3];
        array[0] = getByG_A_PrevAndNext(session, song, groupId, albumId, orderByComparator, true);
        array[1] = song;
        array[2] = getByG_A_PrevAndNext(session, song, groupId, albumId, 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 10 with SongImpl

use of org.liferay.jukebox.model.impl.SongImpl in project liferay-ide by liferay.

the class SongPersistenceImpl method create.

/**
 * Creates a new song with the primary key. Does not add the song to the database.
 *
 * @param songId the primary key for the new song
 * @return the new song
 */
@Override
public Song create(long songId) {
    Song song = new SongImpl();
    song.setNew(true);
    song.setPrimaryKey(songId);
    String uuid = PortalUUIDUtil.generate();
    song.setUuid(uuid);
    return song;
}
Also used : Song(org.liferay.jukebox.model.Song) SongImpl(org.liferay.jukebox.model.impl.SongImpl)

Aggregations

SongImpl (org.liferay.jukebox.model.impl.SongImpl)18 Song (org.liferay.jukebox.model.Song)17 Session (com.liferay.portal.kernel.dao.orm.Session)16 SystemException (com.liferay.portal.kernel.exception.SystemException)16 NoSuchSongException (org.liferay.jukebox.NoSuchSongException)16