Search in sources :

Example 51 with Song

use of org.liferay.jukebox.model.Song 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 52 with Song

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

the class AlbumLocalServiceImpl method moveAlbumToTrash.

@Indexable(type = IndexableType.REINDEX)
@Override
public Album moveAlbumToTrash(long userId, long albumId) throws PortalException, SystemException {
    ServiceContext serviceContext = new ServiceContext();
    // Folder
    User user = userPersistence.findByPrimaryKey(userId);
    Date now = new Date();
    Album album = albumPersistence.findByPrimaryKey(albumId);
    int oldStatus = album.getStatus();
    album.setModifiedDate(serviceContext.getModifiedDate(now));
    album.setStatus(WorkflowConstants.STATUS_IN_TRASH);
    album.setStatusByUserId(user.getUserId());
    album.setStatusByUserName(user.getFullName());
    album.setStatusDate(serviceContext.getModifiedDate(now));
    albumPersistence.update(album);
    // Asset
    assetEntryLocalService.updateVisible(Album.class.getName(), album.getAlbumId(), false);
    // Trash
    TrashEntry trashEntry = trashEntryLocalService.addTrashEntry(userId, album.getGroupId(), Album.class.getName(), album.getAlbumId(), album.getUuid(), null, oldStatus, null, null);
    // Folders and entries
    List<Song> songs = songLocalService.getSongsByAlbumId(album.getAlbumId());
    moveDependentsToTrash(songs, trashEntry.getEntryId());
    return album;
}
Also used : Song(org.liferay.jukebox.model.Song) User(com.liferay.portal.model.User) TrashEntry(com.liferay.portlet.trash.model.TrashEntry) ServiceContext(com.liferay.portal.service.ServiceContext) Album(org.liferay.jukebox.model.Album) Date(java.util.Date) Indexable(com.liferay.portal.kernel.search.Indexable)

Example 53 with Song

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

the class AlbumLocalServiceImpl method restoreAlbumFromTrash.

@Indexable(type = IndexableType.REINDEX)
@Override
public Album restoreAlbumFromTrash(long userId, long albumId) throws PortalException, SystemException {
    ServiceContext serviceContext = new ServiceContext();
    // Folder
    User user = userPersistence.findByPrimaryKey(userId);
    Date now = new Date();
    Album album = albumPersistence.findByPrimaryKey(albumId);
    TrashEntry trashEntry = trashEntryLocalService.getEntry(Album.class.getName(), albumId);
    album.setModifiedDate(serviceContext.getModifiedDate(now));
    album.setStatus(trashEntry.getStatus());
    album.setStatusByUserId(user.getUserId());
    album.setStatusByUserName(user.getFullName());
    album.setStatusDate(serviceContext.getModifiedDate(now));
    albumPersistence.update(album);
    assetEntryLocalService.updateVisible(Album.class.getName(), album.getAlbumId(), true);
    // Songs
    List<Song> songs = songLocalService.getSongsByAlbumId(album.getGroupId(), album.getAlbumId(), WorkflowConstants.STATUS_IN_TRASH);
    restoreDependentsFromTrash(songs, trashEntry.getEntryId());
    // Trash
    trashEntryLocalService.deleteEntry(trashEntry.getEntryId());
    return album;
}
Also used : Song(org.liferay.jukebox.model.Song) User(com.liferay.portal.model.User) TrashEntry(com.liferay.portlet.trash.model.TrashEntry) ServiceContext(com.liferay.portal.service.ServiceContext) Album(org.liferay.jukebox.model.Album) Date(java.util.Date) Indexable(com.liferay.portal.kernel.search.Indexable)

Example 54 with Song

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

the class SongExportActionableDynamicQuery method performAction.

@Override
@SuppressWarnings("unused")
protected void performAction(Object object) throws PortalException, SystemException {
    Song stagedModel = (Song) object;
    StagedModelDataHandlerUtil.exportStagedModel(_portletDataContext, stagedModel);
}
Also used : Song(org.liferay.jukebox.model.Song)

Example 55 with Song

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

the class SongModelImpl method toModel.

/**
 * Converts the soap model instance into a normal model instance.
 *
 * @param soapModel the soap model instance to convert
 * @return the normal model instance
 */
public static Song toModel(SongSoap soapModel) {
    if (soapModel == null) {
        return null;
    }
    Song model = new SongImpl();
    model.setUuid(soapModel.getUuid());
    model.setSongId(soapModel.getSongId());
    model.setCompanyId(soapModel.getCompanyId());
    model.setGroupId(soapModel.getGroupId());
    model.setUserId(soapModel.getUserId());
    model.setUserName(soapModel.getUserName());
    model.setCreateDate(soapModel.getCreateDate());
    model.setModifiedDate(soapModel.getModifiedDate());
    model.setArtistId(soapModel.getArtistId());
    model.setAlbumId(soapModel.getAlbumId());
    model.setName(soapModel.getName());
    model.setStatus(soapModel.getStatus());
    model.setStatusByUserId(soapModel.getStatusByUserId());
    model.setStatusByUserName(soapModel.getStatusByUserName());
    model.setStatusDate(soapModel.getStatusDate());
    return model;
}
Also used : Song(org.liferay.jukebox.model.Song)

Aggregations

Song (org.liferay.jukebox.model.Song)110 NoSuchSongException (org.liferay.jukebox.NoSuchSongException)61 StringBundler (com.liferay.portal.kernel.util.StringBundler)59 SystemException (com.liferay.portal.kernel.exception.SystemException)39 Session (com.liferay.portal.kernel.dao.orm.Session)37 SQLQuery (com.liferay.portal.kernel.dao.orm.SQLQuery)35 QueryPos (com.liferay.portal.kernel.dao.orm.QueryPos)34 Query (com.liferay.portal.kernel.dao.orm.Query)25 ArrayList (java.util.ArrayList)22 UnmodifiableList (com.liferay.portal.kernel.util.UnmodifiableList)19 List (java.util.List)19 SongImpl (org.liferay.jukebox.model.impl.SongImpl)19 FinderPath (com.liferay.portal.kernel.dao.orm.FinderPath)12 Indexable (com.liferay.portal.kernel.search.Indexable)9 User (com.liferay.portal.model.User)7 ServiceContext (com.liferay.portal.service.ServiceContext)6 TrashEntry (com.liferay.portlet.trash.model.TrashEntry)6 Date (java.util.Date)6 Album (org.liferay.jukebox.model.Album)6 Folder (com.liferay.portal.kernel.repository.model.Folder)3