Use new and improved method to load properties.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 31 Jul 2012 05:01:31 +0000 (07:01 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 31 Jul 2012 05:01:31 +0000 (07:01 +0200)
src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java

index 5972bd8..a11027c 100644 (file)
@@ -276,10 +276,7 @@ public class DataManager {
         *             if a database error occurs
         */
        public List<Artist> loadArtistProperties(List<Artist> artists) throws DatabaseException {
-               for (Artist artist : artists) {
-                       loadArtistProperties(artist);
-               }
-               return artists;
+               return loadProperties(artists, "ARTIST_PROPERTIES", "ARTIST");
        }
 
        /**
@@ -424,10 +421,7 @@ public class DataManager {
         *             if a database error occurs
         */
        public List<Track> loadTrackProperties(List<Track> tracks) throws DatabaseException {
-               for (Track track : tracks) {
-                       loadTrackProperties(track);
-               }
-               return tracks;
+               return loadProperties(tracks, "TRACK_PROPERTIES", "TRACK");
        }
 
        /**
@@ -564,10 +558,7 @@ public class DataManager {
         *             if a database error occurs
         */
        public List<TrackDerivative> loadTrackDerivativeProperties(List<TrackDerivative> trackDerivatives) throws DatabaseException {
-               for (TrackDerivative trackDerivative : trackDerivatives) {
-                       loadTrackDerivativeProperties(trackDerivative);
-               }
-               return trackDerivatives;
+               return loadProperties(trackDerivatives, "TRACK_DERIVATIVE_PROPERTIES", "TRACK_DERIVATIVE");
        }
 
        /**
@@ -669,11 +660,8 @@ public class DataManager {
         * @throws DatabaseException
         *             if a database error occurs
         */
-       public Collection<Group> loadGroupProperties(Collection<Group> groups) throws DatabaseException {
-               for (Group group : groups) {
-                       loadGroupProperties(group);
-               }
-               return groups;
+       public Collection<Group> loadGroupProperties(List<Group> groups) throws DatabaseException {
+               return loadProperties(groups, "GROUP_PROPERTIES", "GROUP_ID");
        }
 
        /**
@@ -809,10 +797,7 @@ public class DataManager {
         *             if a database error occurs
         */
        public List<Party> loadPartyProperties(List<Party> parties) throws DatabaseException {
-               for (Party party : parties) {
-                       loadPartyProperties(party);
-               }
-               return parties;
+               return loadProperties(parties, "PARTY_PROPERTIES", "PARTY");
        }
 
        /**