Search in sources :

Example 71 with Artist

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

the class ArtistPersistenceImpl method findByG_S_Last.

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

Example 72 with Artist

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

the class ArtistPersistenceImpl method filterFindByGroupId.

/**
 * Returns an ordered range of all the artists that the user has permissions to view where groupId = &#63;.
 *
 * <p>
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link org.liferay.jukebox.model.impl.ArtistModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
 * </p>
 *
 * @param groupId the group ID
 * @param start the lower bound of the range of artists
 * @param end the upper bound of the range of artists (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of matching artists that the user has permission to view
 * @throws SystemException if a system exception occurred
 */
@Override
public List<Artist> filterFindByGroupId(long groupId, int start, int end, OrderByComparator orderByComparator) throws SystemException {
    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
        return findByGroupId(groupId, start, end, orderByComparator);
    }
    StringBundler query = null;
    if (orderByComparator != null) {
        query = new StringBundler(3 + (orderByComparator.getOrderByFields().length * 3));
    } else {
        query = new StringBundler(3);
    }
    if (getDB().isSupportsInlineDistinct()) {
        query.append(_FILTER_SQL_SELECT_ARTIST_WHERE);
    } else {
        query.append(_FILTER_SQL_SELECT_ARTIST_NO_INLINE_DISTINCT_WHERE_1);
    }
    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
    if (!getDB().isSupportsInlineDistinct()) {
        query.append(_FILTER_SQL_SELECT_ARTIST_NO_INLINE_DISTINCT_WHERE_2);
    }
    if (orderByComparator != null) {
        if (getDB().isSupportsInlineDistinct()) {
            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true);
        } else {
            appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true);
        }
    } else {
        if (getDB().isSupportsInlineDistinct()) {
            query.append(ArtistModelImpl.ORDER_BY_JPQL);
        } else {
            query.append(ArtistModelImpl.ORDER_BY_SQL);
        }
    }
    String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(), Artist.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
    Session session = null;
    try {
        session = openSession();
        SQLQuery q = session.createSQLQuery(sql);
        if (getDB().isSupportsInlineDistinct()) {
            q.addEntity(_FILTER_ENTITY_ALIAS, ArtistImpl.class);
        } else {
            q.addEntity(_FILTER_ENTITY_TABLE, ArtistImpl.class);
        }
        QueryPos qPos = QueryPos.getInstance(q);
        qPos.add(groupId);
        return (List<Artist>) QueryUtil.list(q, getDialect(), start, end);
    } catch (Exception e) {
        throw processException(e);
    } finally {
        closeSession(session);
    }
}
Also used : Artist(org.liferay.jukebox.model.Artist) ArrayList(java.util.ArrayList) UnmodifiableList(com.liferay.portal.kernel.util.UnmodifiableList) List(java.util.List) SQLQuery(com.liferay.portal.kernel.dao.orm.SQLQuery) QueryPos(com.liferay.portal.kernel.dao.orm.QueryPos) StringBundler(com.liferay.portal.kernel.util.StringBundler) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArtistException(org.liferay.jukebox.NoSuchArtistException) Session(com.liferay.portal.kernel.dao.orm.Session)

Example 73 with Artist

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

the class ArtistPersistenceImpl method findByUserId_First.

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

Example 74 with Artist

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

the class ArtistPersistenceImpl method findByCompanyId_First.

/**
 * Returns the first artist 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 first matching artist
 * @throws org.liferay.jukebox.NoSuchArtistException if a matching artist could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Artist findByCompanyId_First(long companyId, OrderByComparator orderByComparator) throws NoSuchArtistException, SystemException {
    Artist artist = fetchByCompanyId_First(companyId, orderByComparator);
    if (artist != null) {
        return artist;
    }
    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 NoSuchArtistException(msg.toString());
}
Also used : Artist(org.liferay.jukebox.model.Artist) StringBundler(com.liferay.portal.kernel.util.StringBundler) NoSuchArtistException(org.liferay.jukebox.NoSuchArtistException)

Example 75 with Artist

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

the class ArtistPersistenceImpl method fetchByPrimaryKey.

/**
 * Returns the artist with the primary key or returns <code>null</code> if it could not be found.
 *
 * @param primaryKey the primary key of the artist
 * @return the artist, or <code>null</code> if a artist with the primary key could not be found
 * @throws SystemException if a system exception occurred
 */
@Override
public Artist fetchByPrimaryKey(Serializable primaryKey) throws SystemException {
    Artist artist = (Artist) EntityCacheUtil.getResult(ArtistModelImpl.ENTITY_CACHE_ENABLED, ArtistImpl.class, primaryKey);
    if (artist == _nullArtist) {
        return null;
    }
    if (artist == null) {
        Session session = null;
        try {
            session = openSession();
            artist = (Artist) session.get(ArtistImpl.class, primaryKey);
            if (artist != null) {
                cacheResult(artist);
            } else {
                EntityCacheUtil.putResult(ArtistModelImpl.ENTITY_CACHE_ENABLED, ArtistImpl.class, primaryKey, _nullArtist);
            }
        } catch (Exception e) {
            EntityCacheUtil.removeResult(ArtistModelImpl.ENTITY_CACHE_ENABLED, ArtistImpl.class, primaryKey);
            throw processException(e);
        } finally {
            closeSession(session);
        }
    }
    return artist;
}
Also used : Artist(org.liferay.jukebox.model.Artist) SystemException(com.liferay.portal.kernel.exception.SystemException) NoSuchArtistException(org.liferay.jukebox.NoSuchArtistException) ArtistImpl(org.liferay.jukebox.model.impl.ArtistImpl) Session(com.liferay.portal.kernel.dao.orm.Session)

Aggregations

Artist (org.liferay.jukebox.model.Artist)79 NoSuchArtistException (org.liferay.jukebox.NoSuchArtistException)45 StringBundler (com.liferay.portal.kernel.util.StringBundler)43 SystemException (com.liferay.portal.kernel.exception.SystemException)30 Session (com.liferay.portal.kernel.dao.orm.Session)28 SQLQuery (com.liferay.portal.kernel.dao.orm.SQLQuery)26 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)25 Query (com.liferay.portal.kernel.dao.orm.Query)18 ArrayList (java.util.ArrayList)15 ArtistImpl (org.liferay.jukebox.model.impl.ArtistImpl)15 UnmodifiableList (com.liferay.portal.kernel.util.UnmodifiableList)14 List (java.util.List)14 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)9 Document (com.liferay.portal.kernel.search.Document)5 DLFileEntry (com.liferay.portlet.documentlibrary.model.DLFileEntry)4 Album (org.liferay.jukebox.model.Album)4 FileEntry (com.liferay.portal.kernel.repository.model.FileEntry)3 Indexable (com.liferay.portal.kernel.search.Indexable)3 Element (com.liferay.portal.kernel.xml.Element)3 PortalException (com.liferay.portal.kernel.exception.PortalException)2