/** * Change the item. * * @param old DOCUMENT_ME * @param sNewName DOCUMENT_ME * @return new album * @throws JajukException the jajuk exception */ public Album changeAlbumName(Album old, String sNewName) throws JajukException { // check there is actually a change if (old.getName2().equals(sNewName)) { return old; } // check up front as later the state of the track is already changed boolean bQueueUpdateRequired = false; if (QueueModel.getPlayingFile() != null && QueueModel.getPlayingFile().getTrack().getAlbum().equals(old)) { bQueueUpdateRequired = true; } Album newItem = registerAlbum(sNewName, old.getDiscID()); // re apply old properties from old item newItem.cloneProperties(old); // update tracks for (Track track : TrackManager.getInstance().getTracks()) { if (track.getAlbum().equals(old)) { TrackManager.getInstance().changeTrackAlbum(track, sNewName, null); } } // if current track album name is changed, notify it if (bQueueUpdateRequired) { ObservationManager.notify(new JajukEvent(JajukEvents.ALBUM_CHANGED)); } // remove old item removeItem(old); return newItem; }
/** * Change the item * * @param old * @param sNewName * @return new album */ public Album changeAlbumName(Album old, String sNewName) throws JajukException { // check there is actually a change if (old.getName2().equals(sNewName)) { return old; } Album newItem = registerAlbum(sNewName); // re apply old properties from old item newItem.cloneProperties(old); // update tracks for (Track track : TrackManager.getInstance().getTracks()) { if (track.getAlbum().equals(old)) { TrackManager.getInstance().changeTrackAlbum(track, sNewName, null); } } // if current track album name is changed, notify it if (FIFO.getInstance().getCurrentFile() != null && FIFO.getInstance().getCurrentFile().getTrack().getAlbum().equals(old)) { ObservationManager.notify(new Event(EventSubject.EVENT_ALBUM_CHANGED)); } return newItem; }