Search in sources :

Example 61 with Album

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

the class AlbumPersistenceImpl method findByCompanyId_PrevAndNext.

/**
 * Returns the albums before and after the current album in the ordered set where companyId = ?.
 *
 * @param albumId the primary key of the current album
 * @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[] findByCompanyId_PrevAndNext(long albumId, long companyId, OrderByComparator orderByComparator) throws NoSuchAlbumException, SystemException {
    Album album = findByPrimaryKey(albumId);
    Session session = null;
    try {
        session = openSession();
        Album[] array = new AlbumImpl[3];
        array[0] = getByCompanyId_PrevAndNext(session, album, companyId, orderByComparator, true);
        array[1] = album;
        array[2] = getByCompanyId_PrevAndNext(session, album, companyId, 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 62 with Album

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

the class AlbumPersistenceImpl method remove.

/**
 * Removes the album with the primary key from the database. Also notifies the appropriate model listeners.
 *
 * @param primaryKey the primary key of the album
 * @return the album that was removed
 * @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 remove(Serializable primaryKey) throws NoSuchAlbumException, SystemException {
    Session session = null;
    try {
        session = openSession();
        Album album = (Album) session.get(AlbumImpl.class, primaryKey);
        if (album == null) {
            if (_log.isWarnEnabled()) {
                _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
            }
            throw new NoSuchAlbumException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
        }
        return remove(album);
    } catch (NoSuchAlbumException nsee) {
        throw nsee;
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : AlbumImpl(org.liferay.jukebox.model.impl.AlbumImpl) NoSuchAlbumException(org.liferay.jukebox.NoSuchAlbumException) 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 63 with Album

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

the class AlbumPersistenceImpl method findByG_LikeN_S_Last.

/**
 * Returns the last album in the ordered set where groupId = &#63; and name LIKE &#63; and status = &#63;.
 *
 * @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 last matching album
 * @throws org.liferay.jukebox.NoSuchAlbumException if a matching album could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Album findByG_LikeN_S_Last(long groupId, String name, int status, OrderByComparator orderByComparator) throws NoSuchAlbumException, SystemException {
    Album album = fetchByG_LikeN_S_Last(groupId, name, status, orderByComparator);
    if (album != null) {
        return album;
    }
    StringBundler msg = new StringBundler(8);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("groupId=");
    msg.append(groupId);
    msg.append(", name=");
    msg.append(name);
    msg.append(", status=");
    msg.append(status);
    msg.append(StringPool.CLOSE_CURLY_BRACE);
    throw new NoSuchAlbumException(msg.toString());
}
Also used : NoSuchAlbumException(org.liferay.jukebox.NoSuchAlbumException) Album(org.liferay.jukebox.model.Album) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 64 with Album

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

the class AlbumPersistenceImpl method findByArtistId_Last.

/**
 * Returns the last album in the ordered set where artistId = &#63;.
 *
 * @param artistId the artist ID
 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
 * @return the last matching album
 * @throws org.liferay.jukebox.NoSuchAlbumException if a matching album could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Album findByArtistId_Last(long artistId, OrderByComparator orderByComparator) throws NoSuchAlbumException, SystemException {
    Album album = fetchByArtistId_Last(artistId, orderByComparator);
    if (album != null) {
        return album;
    }
    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 NoSuchAlbumException(msg.toString());
}
Also used : NoSuchAlbumException(org.liferay.jukebox.NoSuchAlbumException) Album(org.liferay.jukebox.model.Album) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 65 with Album

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

the class AlbumPersistenceImpl method findByCompanyId_Last.

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

Aggregations

Album (org.liferay.jukebox.model.Album)97 NoSuchAlbumException (org.liferay.jukebox.NoSuchAlbumException)55 StringBundler (com.liferay.portal.kernel.util.StringBundler)53 SystemException (com.liferay.portal.kernel.exception.SystemException)37 Session (com.liferay.portal.kernel.dao.orm.Session)34 SQLQuery (com.liferay.portal.kernel.dao.orm.SQLQuery)32 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)31 Query (com.liferay.portal.kernel.dao.orm.Query)22 AlbumImpl (org.liferay.jukebox.model.impl.AlbumImpl)18 UnmodifiableList (com.liferay.portal.kernel.util.UnmodifiableList)17 ArrayList (java.util.ArrayList)17 List (java.util.List)17 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)11 Indexable (com.liferay.portal.kernel.search.Indexable)8 User (com.liferay.portal.model.User)6 Song (org.liferay.jukebox.model.Song)6 ServiceContext (com.liferay.portal.service.ServiceContext)4 Date (java.util.Date)4 Artist (org.liferay.jukebox.model.Artist)4 PortalException (com.liferay.portal.kernel.exception.PortalException)3