From 0b253d8c5d8b773760aca1ad3996f2a0e95e0f44 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 19 Apr 2012 16:29:24 +0200 Subject: [PATCH] Add method to get all artists for a group. --- .../java/net/pterodactylus/demoscenemusic/data/DataManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java index 5554f76..b56634f 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java @@ -76,6 +76,14 @@ public class DataManager { return artistLoader.get(); } + public Collection getArtistsByGroup(String groupId) throws DatabaseException { + Query query = new Query(Type.SELECT, "ARTISTS"); + query.addField(new Field("ARTISTS.*")); + query.addJoin(new Join(JoinType.INNER, "GROUP_ARTISTS", new Field("ARTISTS.ID"), new Field("GROUP_ARTISTS.ARTIST"))); + query.addWhereClause(new ValueFieldWhereClause(new ValueField("GROUP_ARTISTS.GROUP_", new StringParameter(groupId)))); + return database.getMultiple(query, artistCreator); + } + public Track trackById(String id) throws DatabaseException { Query query = new Query(Type.SELECT, "TRACKS"); query.addField(new Field("TRACKS.*")); -- 2.7.4