+ return loadTrackProperties(database.getMultiple(query, trackCreator));
+ }
+
+ /**
+ * Returns all tracks that were released at the party with the given ID.
+ *
+ * @param partyId
+ * The ID of the party
+ * @return All tracks that were released at the given party
+ * @throws DatabaseException
+ * if a database error occurs
+ */
+ public Collection<Track> getTracksByParty(String partyId) throws DatabaseException {
+ Query query = new Query(Type.SELECT, "TRACKS");
+ query.addField(new Field("TRACKS.*"));
+ query.addJoin(new Join(JoinType.INNER, "PARTY_TRACKS", new Field("PARTY_TRACKS.TRACK"), new Field("TRACKS.ID")));
+ query.addWhereClause(new ValueFieldWhereClause(new ValueField("PARTY_TRACKS.PARTY", new StringParameter(partyId))));
+ return loadTrackProperties(database.getMultiple(query, trackCreator));
+ }
+
+ /**
+ * Loads the properties for the given track.
+ *
+ * @param track
+ * The track for which to load the properties
+ * @return The track with the properties loaded
+ * @throws DatabaseException
+ * if a database error occurs
+ */
+ public Track loadTrackProperties(Track track) throws DatabaseException {
+ return loadProperties(track, "TRACK_PROPERTIES", "TRACK");
+ }
+
+ /**
+ * Loads the properties for the given tracks.
+ *
+ * @param tracks
+ * The tracks for which to load the properties
+ * @return The tracks with the properties loaded
+ * @throws DatabaseException
+ * if a database error occurs
+ */
+ public List<Track> loadTrackProperties(List<Track> tracks) throws DatabaseException {
+ for (Track track : tracks) {
+ loadTrackProperties(track);
+ }
+ return tracks;