Search in sources :

Example 36 with Album

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

the class AlbumIndexer method doGetDocument.

@Override
protected Document doGetDocument(Object obj) throws Exception {
    Album album = (Album) obj;
    Document document = getBaseModelDocument(PORTLET_ID, album);
    document.addDate(Field.MODIFIED_DATE, album.getModifiedDate());
    document.addText(Field.TITLE, album.getName());
    document.addKeyword("year", album.getYear());
    Artist artist = ArtistLocalServiceUtil.getArtist(album.getArtistId());
    document.addText("artist", artist.getName());
    document.addKeyword("artistId", artist.getArtistId());
    return document;
}
Also used : Artist(org.liferay.jukebox.model.Artist) Album(org.liferay.jukebox.model.Album) Document(com.liferay.portal.kernel.search.Document)

Example 37 with Album

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

the class ArtistLocalServiceImpl method deleteArtist.

@Indexable(type = IndexableType.DELETE)
public Artist deleteArtist(long artistId) throws PortalException, SystemException {
    Artist artist = artistPersistence.findByPrimaryKey(artistId);
    List<Album> albums = albumLocalService.getAlbumsByArtistId(artistId);
    for (Album album : albums) {
        albumLocalService.deleteAlbum(album.getAlbumId());
    }
    try {
        PortletFileRepositoryUtil.deletePortletFileEntry(artist.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(artistId));
    } catch (Exception e) {
    }
    return artistPersistence.remove(artistId);
}
Also used : Artist(org.liferay.jukebox.model.Artist) Album(org.liferay.jukebox.model.Album) PortalException(com.liferay.portal.kernel.exception.PortalException) SystemException(com.liferay.portal.kernel.exception.SystemException) ArtistNameException(org.liferay.jukebox.ArtistNameException) Indexable(com.liferay.portal.kernel.search.Indexable)

Example 38 with Album

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

the class AlbumPermission method check.

public static void check(PermissionChecker permissionChecker, long albumId, String actionId) throws PortalException, SystemException {
    Album album = AlbumLocalServiceUtil.getAlbum(albumId);
    check(permissionChecker, album, actionId);
}
Also used : Album(org.liferay.jukebox.model.Album)

Example 39 with Album

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

the class AlbumTrashHandler method getRestoreContainedModelLink.

@Override
public String getRestoreContainedModelLink(PortletRequest portletRequest, long classPK) throws PortalException, SystemException {
    Album album = AlbumLocalServiceUtil.getAlbum(classPK);
    PortletURL portletURL = getRestoreURL(portletRequest, classPK);
    portletURL.setParameter("albumId", String.valueOf(album.getAlbumId()));
    return portletURL.toString();
}
Also used : Album(org.liferay.jukebox.model.Album) PortletURL(javax.portlet.PortletURL)

Example 40 with Album

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

the class SongIndexer method doGetDocument.

@Override
protected Document doGetDocument(Object obj) throws Exception {
    Song song = (Song) obj;
    Document document = getBaseModelDocument(PORTLET_ID, song);
    document.addDate(Field.MODIFIED_DATE, song.getModifiedDate());
    document.addText(Field.TITLE, song.getName());
    Album album = AlbumLocalServiceUtil.getAlbum(song.getAlbumId());
    document.addText("album", album.getName());
    document.addKeyword("albumId", album.getAlbumId());
    Artist artist = ArtistLocalServiceUtil.getArtist(song.getArtistId());
    document.addText("artist", artist.getName());
    document.addKeyword("artistId", artist.getArtistId());
    return document;
}
Also used : Artist(org.liferay.jukebox.model.Artist) Song(org.liferay.jukebox.model.Song) Album(org.liferay.jukebox.model.Album) Document(com.liferay.portal.kernel.search.Document)

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