com.ldodds.musicbrainz
Class BeanPopulator

java.lang.Object
  |
  +--com.ldodds.musicbrainz.BeanPopulator

public class BeanPopulator
extends java.lang.Object

This class provides methods to interpret a Jena Model returned from a MusicBrainz query.

The methods will process the model and realise the results as instances of the Album, Artist, Track and TrackSummary javabean. See individual Javadoc comments for which method is suitable for processing which query results.

Author:
ldodds

Constructor Summary
BeanPopulator()
           
 
Method Summary
static com.ldodds.musicbrainz.Album getAlbum(Resource rAlbum, boolean includeTracks)
           
static java.util.List getAlbums(Model model)
          Call this method to retrieve the albums in an mq:Result/mm:albumList.
static com.ldodds.musicbrainz.Artist getArtist(Resource rArtist, boolean shallow)
           
static java.util.List getArtists(Model model)
          Call this method to retrieve the artists contained in an mq:Result/mm:artistList.
static com.ldodds.musicbrainz.ReleaseDate getReleaseDate(Resource resource)
           
static java.util.List getReleaseDates(Resource album)
           
static com.ldodds.musicbrainz.Track getTrack(Resource rAlbum, Resource rTrack)
           
static java.util.List getTracks(Model model)
          Call this to retrieve the tracks from an mq:Result/mm:trackList.
static com.ldodds.musicbrainz.TrackSummary getTrackSummary(Model model)
          Builds a TrackSummary object from the results of a getQuickTrackInfoFromTrackId query.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BeanPopulator

public BeanPopulator()
Method Detail

getArtists

public static java.util.List getArtists(Model model)
Call this method to retrieve the artists contained in an mq:Result/mm:artistList. Will walk through the graph populating the artist with a list of albums, and those albums with tracks depending on the level of detail in the Model.

Parameters:
model -
Returns:
the list of Artist object, populated from the artistList in the Model

getArtist

public static com.ldodds.musicbrainz.Artist getArtist(Resource rArtist,
                                                      boolean shallow)

getAlbums

public static java.util.List getAlbums(Model model)
Call this method to retrieve the albums in an mq:Result/mm:albumList. Will walk through the model retrieving details of the tracks and artists depending on the level of detail in the Model

Parameters:
model -
Returns:
the List of Album object, may be empty.

getTracks

public static java.util.List getTracks(Model model)
Call this to retrieve the tracks from an mq:Result/mm:trackList. Will walk through the model retrieving details of the tracks, albums, artists, etc depending on the level of detail in the model.

Parameters:
model -
Returns:

getAlbum

public static com.ldodds.musicbrainz.Album getAlbum(Resource rAlbum,
                                                    boolean includeTracks)

getReleaseDates

public static java.util.List getReleaseDates(Resource album)

getReleaseDate

public static com.ldodds.musicbrainz.ReleaseDate getReleaseDate(Resource resource)

getTrack

public static com.ldodds.musicbrainz.Track getTrack(Resource rAlbum,
                                                    Resource rTrack)

getTrackSummary

public static com.ldodds.musicbrainz.TrackSummary getTrackSummary(Model model)
Builds a TrackSummary object from the results of a getQuickTrackInfoFromTrackId query.

Parameters:
model - result of the quick track info query.
Returns:
The TrackSummary or null