}
/**
+ * Returns all parties that the track with the given ID was released at.
+ *
+ * @param trackId
+ * The ID of the track
+ * @return All parties the track was released at
+ * @throws DatabaseException
+ * if a database error occurs
+ */
+ public Collection<Party> getPartiesByTrackId(String trackId) throws DatabaseException {
+ Query query = new Query(Type.SELECT, "PARTIES");
+ query.addField(new Field("PARTIES.*"));
+ query.addJoin(new Join(JoinType.INNER, "PARTY_TRACKS", new Field("PARTY_TRACKS.PARTY"), new Field("PARTIES.ID")));
+ query.addWhereClause(new ValueFieldWhereClause(new ValueField("PARTY_TRACKS.TRACK", new StringParameter(trackId))));
+ return loadPartyProperties(database.getMultiple(query, partyCreator));
+ }
+
+ /**
* Returns the party with the given ID.
*
* @param partyId
return super.getRelatedTracks();
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Collection<Party> getParties() {
+ if (!hasValue("parties")) {
+ try {
+ getValue("parties", Collection.class).set(getPartiesByTrackId(getId()));
+ } catch (DatabaseException de1) {
+ throw new RuntimeException("Could not load Parties for Track " + getId() + ".", de1);
+ }
+ }
+ return super.getParties();
+ }
+
}
/**
return this;
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @SuppressWarnings("unchecked")
+ public Collection<Party> getParties() {
+ return getValue("parties", Collection.class).get();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public Track setParties(Collection<Party> parties) {
+ getValue("parties", Collection.class).set(parties);
+ return this;
+ }
+
}
*/
public Track setRelatedTracks(Map<Relationship, Collection<Track>> relatedTracks);
+ /**
+ * Returns all parties this track was released at.
+ *
+ * @return All parties this track was released at
+ */
+ public Collection<Party> getParties();
+
+ /**
+ * Sets all parties this track was released at.
+ *
+ * @param parties
+ * All parties this track was released at
+ * @return This track
+ */
+ public Track setParties(Collection<Party> parties);
+
}