@Indexable(type = IndexableType.REINDEX) @Override public Album moveAlbumToTrash(long userId, long albumId) throws PortalException { 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; }
public void updateAsset( long userId, Album album, long[] assetCategoryIds, String[] assetTagNames, long[] assetLinkEntryIds) throws PortalException { AssetEntry assetEntry = assetEntryLocalService.updateEntry( userId, album.getGroupId(), album.getCreateDate(), album.getModifiedDate(), Album.class.getName(), album.getAlbumId(), album.getUuid(), 0, assetCategoryIds, assetTagNames, true, null, null, null, ContentTypes.TEXT_HTML, album.getName(), null, null, null, null, 0, 0, null, false); assetLinkLocalService.updateLinks( userId, assetEntry.getEntryId(), assetLinkEntryIds, AssetLinkConstants.TYPE_RELATED); }