Use new method to load artist properties.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 27 Jul 2012 11:15:47 +0000 (13:15 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 27 Jul 2012 11:15:47 +0000 (13:15 +0200)
src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java

index 5324d28..77f5ade 100644 (file)
@@ -241,22 +241,7 @@ public class DataManager {
         *             if a database error occurs
         */
        public Artist loadProperties(final Artist artist) throws DatabaseException {
-               Query query = new Query(Type.SELECT, "ARTIST_PROPERTIES");
-               query.addField(new Field("ARTIST_PROPERTIES.PROPERTY"));
-               query.addField(new Field("ARTIST_PROPERTIES.VALUE"));
-               query.addWhereClause(new ValueFieldWhereClause(new ValueField("ARTIST", new StringParameter(artist.getId()))));
-               database.process(query, new ResultProcessor() {
-
-                       @Override
-                       public void processResult(ResultSet resultSet) throws SQLException {
-                               if (resultSet.isFirst()) {
-                                       artist.getProperties().removeAll();
-                               }
-                               artist.getProperties().set(resultSet.getString("ARTIST_PROPERTIES.PROPERTY"), resultSet.getString("ARTIST_PROPERTIES.VALUE"));
-                       }
-
-               });
-               return artist;
+               return loadProperties(artist, "ARTIST_PROPERTIES", "ARTIST");
        }
 
        /**