Search in sources :

Example 51 with Artist

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

the class ArtistPersistenceImpl method findByG_S_First.

/**
 * Returns the first 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 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 findByG_S_First(long groupId, int status, OrderByComparator orderByComparator) throws NoSuchArtistException, SystemException {
    Artist artist = fetchByG_S_First(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 52 with Artist

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

the class ArtistPersistenceImpl method filterGetByGroupId_PrevAndNext.

protected Artist filterGetByGroupId_PrevAndNext(Session session, Artist artist, long groupId, OrderByComparator orderByComparator, boolean previous) {
    StringBundler query = null;
    if (orderByComparator != null) {
        query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 6));
    } 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) {
        String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
        if (orderByConditionFields.length > 0) {
            query.append(WHERE_AND);
        }
        for (int i = 0; i < orderByConditionFields.length; i++) {
            if (getDB().isSupportsInlineDistinct()) {
                query.append(_ORDER_BY_ENTITY_ALIAS);
            } else {
                query.append(_ORDER_BY_ENTITY_TABLE);
            }
            query.append(orderByConditionFields[i]);
            if ((i + 1) < orderByConditionFields.length) {
                if (orderByComparator.isAscending() ^ previous) {
                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
                } else {
                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
                }
            } else {
                if (orderByComparator.isAscending() ^ previous) {
                    query.append(WHERE_GREATER_THAN);
                } else {
                    query.append(WHERE_LESSER_THAN);
                }
            }
        }
        query.append(ORDER_BY_CLAUSE);
        String[] orderByFields = orderByComparator.getOrderByFields();
        for (int i = 0; i < orderByFields.length; i++) {
            if (getDB().isSupportsInlineDistinct()) {
                query.append(_ORDER_BY_ENTITY_ALIAS);
            } else {
                query.append(_ORDER_BY_ENTITY_TABLE);
            }
            query.append(orderByFields[i]);
            if ((i + 1) < orderByFields.length) {
                if (orderByComparator.isAscending() ^ previous) {
                    query.append(ORDER_BY_ASC_HAS_NEXT);
                } else {
                    query.append(ORDER_BY_DESC_HAS_NEXT);
                }
            } else {
                if (orderByComparator.isAscending() ^ previous) {
                    query.append(ORDER_BY_ASC);
                } else {
                    query.append(ORDER_BY_DESC);
                }
            }
        }
    } 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);
    SQLQuery q = session.createSQLQuery(sql);
    q.setFirstResult(0);
    q.setMaxResults(2);
    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);
    if (orderByComparator != null) {
        Object[] values = orderByComparator.getOrderByConditionValues(artist);
        for (Object value : values) {
            qPos.add(value);
        }
    }
    List<Artist> list = q.list();
    if (list.size() == 2) {
        return list.get(1);
    } else {
        return null;
    }
}
Also used : Artist(org.liferay.jukebox.model.Artist) SQLQuery(com.liferay.portal.kernel.dao.orm.SQLQuery) QueryPos(com.liferay.portal.kernel.dao.orm.QueryPos) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 53 with Artist

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

the class ArtistPersistenceImpl method getByG_LikeN_S_PrevAndNext.

protected Artist getByG_LikeN_S_PrevAndNext(Session session, Artist artist, long groupId, String name, int status, OrderByComparator orderByComparator, boolean previous) {
    StringBundler query = null;
    if (orderByComparator != null) {
        query = new StringBundler(6 + (orderByComparator.getOrderByFields().length * 6));
    } else {
        query = new StringBundler(3);
    }
    query.append(_SQL_SELECT_ARTIST_WHERE);
    query.append(_FINDER_COLUMN_G_LIKEN_S_GROUPID_2);
    boolean bindName = false;
    if (name == null) {
        query.append(_FINDER_COLUMN_G_LIKEN_S_NAME_1);
    } else if (name.equals(StringPool.BLANK)) {
        query.append(_FINDER_COLUMN_G_LIKEN_S_NAME_3);
    } else {
        bindName = true;
        query.append(_FINDER_COLUMN_G_LIKEN_S_NAME_2);
    }
    query.append(_FINDER_COLUMN_G_LIKEN_S_STATUS_2);
    if (orderByComparator != null) {
        String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
        if (orderByConditionFields.length > 0) {
            query.append(WHERE_AND);
        }
        for (int i = 0; i < orderByConditionFields.length; i++) {
            query.append(_ORDER_BY_ENTITY_ALIAS);
            query.append(orderByConditionFields[i]);
            if ((i + 1) < orderByConditionFields.length) {
                if (orderByComparator.isAscending() ^ previous) {
                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
                } else {
                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
                }
            } else {
                if (orderByComparator.isAscending() ^ previous) {
                    query.append(WHERE_GREATER_THAN);
                } else {
                    query.append(WHERE_LESSER_THAN);
                }
            }
        }
        query.append(ORDER_BY_CLAUSE);
        String[] orderByFields = orderByComparator.getOrderByFields();
        for (int i = 0; i < orderByFields.length; i++) {
            query.append(_ORDER_BY_ENTITY_ALIAS);
            query.append(orderByFields[i]);
            if ((i + 1) < orderByFields.length) {
                if (orderByComparator.isAscending() ^ previous) {
                    query.append(ORDER_BY_ASC_HAS_NEXT);
                } else {
                    query.append(ORDER_BY_DESC_HAS_NEXT);
                }
            } else {
                if (orderByComparator.isAscending() ^ previous) {
                    query.append(ORDER_BY_ASC);
                } else {
                    query.append(ORDER_BY_DESC);
                }
            }
        }
    } else {
        query.append(ArtistModelImpl.ORDER_BY_JPQL);
    }
    String sql = query.toString();
    Query q = session.createQuery(sql);
    q.setFirstResult(0);
    q.setMaxResults(2);
    QueryPos qPos = QueryPos.getInstance(q);
    qPos.add(groupId);
    if (bindName) {
        qPos.add(name.toLowerCase());
    }
    qPos.add(status);
    if (orderByComparator != null) {
        Object[] values = orderByComparator.getOrderByConditionValues(artist);
        for (Object value : values) {
            qPos.add(value);
        }
    }
    List<Artist> list = q.list();
    if (list.size() == 2) {
        return list.get(1);
    } else {
        return null;
    }
}
Also used : Artist(org.liferay.jukebox.model.Artist) SQLQuery(com.liferay.portal.kernel.dao.orm.SQLQuery) Query(com.liferay.portal.kernel.dao.orm.Query) QueryPos(com.liferay.portal.kernel.dao.orm.QueryPos) StringBundler(com.liferay.portal.kernel.util.StringBundler)

Example 54 with Artist

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

the class ArtistPersistenceImpl method findByG_LikeN_S_First.

/**
 * Returns the first artist 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 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 findByG_LikeN_S_First(long groupId, String name, int status, OrderByComparator orderByComparator) throws NoSuchArtistException, SystemException {
    Artist artist = fetchByG_LikeN_S_First(groupId, name, status, orderByComparator);
    if (artist != null) {
        return artist;
    }
    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 NoSuchArtistException(msg.toString());
}
Also used : Artist(org.liferay.jukebox.model.Artist) StringBundler(com.liferay.portal.kernel.util.StringBundler) NoSuchArtistException(org.liferay.jukebox.NoSuchArtistException)

Example 55 with Artist

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

the class ArtistPersistenceImpl method findByU_G_Last.

/**
 * Returns the last artist in the ordered set where userId = &#63; and groupId = &#63;.
 *
 * @param userId the user ID
 * @param groupId the group ID
 * @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 findByU_G_Last(long userId, long groupId, OrderByComparator orderByComparator) throws NoSuchArtistException, SystemException {
    Artist artist = fetchByU_G_Last(userId, groupId, orderByComparator);
    if (artist != null) {
        return artist;
    }
    StringBundler msg = new StringBundler(6);
    msg.append(_NO_SUCH_ENTITY_WITH_KEY);
    msg.append("userId=");
    msg.append(userId);
    msg.append(", groupId=");
    msg.append(groupId);
    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)

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