From: David ‘Bombe’ Roden Date: Thu, 19 Apr 2012 14:55:46 +0000 (+0200) Subject: Add method to get all artists for a track. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d1d46d54d4b10a6cb6a2c513acefdac3e0d21b0f;p=demoscenemusic.git Add method to get all artists for a track. --- diff --git a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java index 0c6f422..9ec6d73 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/data/DataManager.java @@ -75,6 +75,15 @@ public class DataManager { return database.getMultiple(query, artistCreator); } + public List getArtistsByTrack(String trackId) throws DatabaseException { + Query query = new Query(Type.SELECT, "ARTISTS"); + query.addField(new Field("ARTISTS.*")); + query.addJoin(new Join(JoinType.INNER, "TRACK_ARTISTS", new Field("TRACK_ARTISTS.ARTIST"), new Field("ARTISTS.ID"))); + query.addWhereClause(new ValueFieldWhereClause(new ValueField("TRACK_ARTISTS.TRACK", new StringParameter(trackId)))); + query.addOrderField(new OrderField(new Field("TRACK_ARTISTS.DISPLAY_ORDER"))); + return database.getMultiple(query, artistCreator); + } + public Track trackById(String id) throws DatabaseException { Query query = new Query(Type.SELECT, "TRACKS"); query.addField(new Field("TRACKS.*"));