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;
}
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;
}
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;
}
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);
}
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;
}
Aggregations