Search in sources :

Example 36 with Artist

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

the class ArtistIndexer method doReindex.

@Override
protected void doReindex(String className, long classPK) throws Exception {
    Artist artist = ArtistLocalServiceUtil.getArtist(classPK);
    doReindex(artist);
}
Also used : Artist(org.liferay.jukebox.model.Artist)

Example 37 with Artist

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

the class ArtistIndexer method doDelete.

@Override
protected void doDelete(Object obj) throws Exception {
    Artist artist = (Artist) obj;
    deleteDocument(artist.getCompanyId(), artist.getArtistId());
}
Also used : Artist(org.liferay.jukebox.model.Artist)

Example 38 with Artist

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

the class ArtistIndexer method doReindex.

@Override
protected void doReindex(Object obj) throws Exception {
    Artist artist = (Artist) obj;
    Document document = getDocument(artist);
    SearchEngineUtil.updateDocument(getSearchEngineId(), artist.getCompanyId(), document);
}
Also used : Artist(org.liferay.jukebox.model.Artist) Document(com.liferay.portal.kernel.search.Document)

Example 39 with Artist

use of org.liferay.jukebox.model.Artist 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)

Example 40 with Artist

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

the class AlbumStagedModelDataHandler method doExportStagedModel.

@Override
protected void doExportStagedModel(PortletDataContext portletDataContext, Album album) throws Exception {
    Artist artist = ArtistLocalServiceUtil.getArtist(album.getArtistId());
    Element albumElement = portletDataContext.getExportDataElement(album);
    if (portletDataContext.getBooleanParameter(JukeboxPortletDataHandler.NAMESPACE, "artists")) {
        // Artists are selected to export, making sure this album's artist
        // is going to be exported as well
        StagedModelDataHandlerUtil.exportReferenceStagedModel(portletDataContext, album, artist, PortletDataContext.REFERENCE_TYPE_DEPENDENCY);
    } else {
        // Artists are not exported - adding missing reference element to
        // validate
        portletDataContext.addReferenceElement(album, albumElement, artist, PortletDataContext.REFERENCE_TYPE_DEPENDENCY, true);
    }
    if (album.hasCustomImage()) {
        FileEntry fileEntry = album.getCustomImage();
        StagedModelDataHandlerUtil.exportReferenceStagedModel(portletDataContext, album, Album.class, fileEntry, FileEntry.class, PortletDataContext.REFERENCE_TYPE_WEAK);
    }
    portletDataContext.addClassedModel(albumElement, ExportImportPathUtil.getModelPath(album), album);
}
Also used : Artist(org.liferay.jukebox.model.Artist) Element(com.liferay.portal.kernel.xml.Element) FileEntry(com.liferay.portal.kernel.repository.model.FileEntry) DLFileEntry(com.liferay.portlet.documentlibrary.model.DLFileEntry)

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