From: David ‘Bombe’ Roden Date: Thu, 19 Apr 2012 14:10:23 +0000 (+0200) Subject: Add method to get all groups by artist. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5f24f213aebba016708f1794d012d3e4189c487b;p=demoscenemusic.git Add method to get all groups by artist. --- 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();