From 5f24f213aebba016708f1794d012d3e4189c487b 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:10:23 +0200 Subject: [PATCH] Add method to get all groups by artist. --- .../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 d1a8769..85f35fa 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java @@ -118,6 +118,14 @@ public class DataManager { return trackLoader.all(); } + public Collection getGroupsByArtist(String artistId) throws DatabaseException { + Query query = new Query(Type.SELECT, "GROUPS"); + query.addField(new Field("GROUPS.*")); + query.addJoin(new Join(JoinType.INNER, "GROUP_ARTISTS", new Field("GROUPS.ID"), new Field("GROUP_ARTISTS.GROUP_"))); + query.addWhereClause(new ValueFieldWhereClause(new ValueField("GROUP_ARTISTS.ARTIST", new StringParameter(artistId)))); + return database.getMultiple(query, DefaultGroup.CREATOR); + } + private class TrackLoader implements ResultProcessor { private final List loadedTracks = new ArrayList(); -- 2.7.4