Remove obsolete track and artist loaders.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 19 Apr 2012 14:55:35 +0000 (16:55 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 19 Apr 2012 14:55:35 +0000 (16:55 +0200)
src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java

index 5d3c1de..0c6f422 100644 (file)
@@ -19,9 +19,7 @@ package net.pterodactylus.demoscenemusic.data;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
 import java.util.concurrent.Callable;
 
@@ -33,11 +31,9 @@ import net.pterodactylus.util.database.Join;
 import net.pterodactylus.util.database.Join.JoinType;
 import net.pterodactylus.util.database.ObjectCreator;
 import net.pterodactylus.util.database.OrderField;
-import net.pterodactylus.util.database.OrderField.Order;
 import net.pterodactylus.util.database.Parameter.StringParameter;
 import net.pterodactylus.util.database.Query;
 import net.pterodactylus.util.database.Query.Type;
-import net.pterodactylus.util.database.ResultProcessor;
 import net.pterodactylus.util.database.ValueField;
 import net.pterodactylus.util.database.ValueFieldWhereClause;
 
@@ -102,71 +98,6 @@ public class DataManager {
                return database.getMultiple(query, groupCreator);
        }
 
-       private class TrackLoader implements ResultProcessor {
-
-               private final List<Track> loadedTracks = new ArrayList<Track>();
-               private Track track;
-
-               public Track get() {
-                       return loadedTracks.isEmpty() ? null : loadedTracks.get(0);
-               }
-
-               public List<Track> all() {
-                       return loadedTracks;
-               }
-
-               /**
-                * {@inheritDoc}
-                */
-               public void processResult(ResultSet resultSet) throws SQLException {
-                       String trackId = resultSet.getString("TRACKS.ID");
-                       if ((track == null) || (!track.id().equals(trackId))) {
-                               track = new DefaultTrack(trackId).name(resultSet.getString("TRACKS.NAME")).artists(new ArrayList<Artist>()).styles(new HashSet<Style>());
-                               loadedTracks.add(track);
-                       }
-                       Artist artist = new LazyArtist(resultSet.getString("ARTISTS.ID")).name(resultSet.getString("ARTISTS.NAME"));
-                       if (!track.artists().contains(artist)) {
-                               track.artists().add(artist);
-                       }
-                       Style style = new DefaultStyle(resultSet.getString("STYLES.ID")).name(resultSet.getString("STYLES.NAME"));
-                       track.styles().add(style);
-               }
-
-       }
-
-       private class ArtistLoader implements ResultProcessor {
-
-               private final List<Artist> artists = new ArrayList<Artist>();
-               private Artist artist;
-
-               public Artist get() {
-                       return artists.isEmpty() ? null : artists.get(0);
-               }
-
-               public List<Artist> all() {
-                       return artists;
-               }
-
-               //
-               // RESULTPROCESSOR METHODS
-               //
-
-               /**
-                * {@inheritDoc}
-                */
-               public void processResult(ResultSet resultSet) throws SQLException {
-                       String artistId = resultSet.getString("ARTISTS.ID");
-                       if ((artist == null) || (!artist.id().equals(artistId))) {
-                               artist = new LazyArtist(artistId).name(resultSet.getString("ARTISTS.NAME")).groups(new HashSet<Group>());
-                               artists.add(artist);
-                       }
-
-                       Group group = new DefaultGroup(resultSet.getString("GROUPS.ID")).name(resultSet.getString("GROUPS.NAME")).url(resultSet.getString("GROUPS.URL"));
-                       artist.groups().add(group);
-               }
-
-       }
-
        private class LazyArtist extends DefaultArtist {
 
                private final Memoizer<Void> tracksMemoizer = new Memoizer<Void>(new Callable<Void>() {