Package com.jitcaforwin.extended.api.track

Examples of com.jitcaforwin.extended.api.track.Album


   *            Album artist of the album.
   * @return The (created) album.
   * @throws JitcaException if an error occurs.
   */
  public Album getAlbum(String title, Artist albumArtist){
    Album album = searchForAlbum(title, albumArtist);
    if (album != null)
      return album;
    else
      return addAlbum(title, albumArtist);
  }
View Full Code Here


   * @param album
   *            Album which should be tested.
   * @return True, if the specified album is currently managed.
   */
  public boolean isAlbumManaged(Album album) {
    Album managedAlbum = this.searchForAlbum(album.getName(), album.getAlbumArtist());
    if (managedAlbum == null)
      return false;
    else if (album.getName().equals(managedAlbum.getName())
        && album.getAlbumArtist().getName().equals(managedAlbum.getAlbumArtist().getName()))
      return true;
    else
      return false;
  }
View Full Code Here

   */
  private Album searchForAlbum(String title, Artist albumArtist) {
    Map<String, Album> albumsOfArtist = this.searchForArtist(albumArtist);
    if (albumsOfArtist == null)
      return null;
    Album album = albumsOfArtist.get(title);
    return album;
  }
View Full Code Here

   *            Album artist of the album.
   * @return The created album.
   * @throws JitcaException if an error occurs.
   */
  private Album addAlbum(String title, Artist albumArtist) {
    Album album = null;
    // special case treatments
    if (this.isSpecialCase(albumArtist)){
      if (albumArtist instanceof VariousArtists){
        album = new VariousArtistsAlbum(title, albumArtist, source);
      }
    } else {
      album = new AlbumImpl(title, albumArtist, source);
    }
   

    Map<String, Album> albumsOfArtist = searchForArtist(albumArtist);

    if (albumsOfArtist == null) {
      albumsOfArtist = addArtist(albumArtist);
    }

    albumsOfArtist.put(title, album);
    if (!this.lazy){
      album.loadAllTracks();
    }
   
    return album;
  }
View Full Code Here

    EasyMock.replay(libraryMock);
    EasyMock.replay(trackCollectionMock);
    EasyMock.replay(trackFactoryMock);
   
    Artist albumArtist = ArtistImpl.create("Nelly Furtado", libraryMock);
    Album loose = new AlbumImpl("Loose", albumArtist, libraryMock);
    Album folklore = new AlbumImpl("Folklore", albumArtist, libraryMock);
   
    EasyMock.reset(libraryMock);
    EasyMock.expect(libraryMock.getAlbum("Loose", albumArtist)).andReturn(loose);
    EasyMock.expect(libraryMock.getAlbum("Loose", albumArtist)).andReturn(loose);
    EasyMock.expect(libraryMock.getAlbum("Folklore", albumArtist)).andReturn(folklore);
    EasyMock.replay(libraryMock);
   
   
    Album album1 = libraryMock.getAlbum("Loose", albumArtist);
    assertTrue(album1.getName().equals("Loose"));
    assertTrue(album1.getAlbumArtist().getName().equals("Nelly Furtado"));

    Album album2 = libraryMock.getAlbum("Loose", albumArtist);
    assertTrue(album1.equals(album2));
    assertTrue(album1.equals(album1));

    Album album3 = libraryMock.getAlbum("Folklore", albumArtist);
    assertTrue(!album1.equals(album3));
  }
View Full Code Here

   *            Album artist of the album.
   * @return The (created) album.
   * @throws JitcaException if an error occurs.
   */
  public Album getAlbum(String title, Artist albumArtist){
    Album album = searchForAlbum(title, albumArtist);
    if (album != null)
      return album;
    else
      return addAlbum(title, albumArtist);
  }
View Full Code Here

   * @param album
   *            Album which should be tested.
   * @return True, if the specified album is currently managed.
   */
  public boolean isAlbumManaged(Album album) {
    Album managedAlbum = this.searchForAlbum(album.getName(), album.getAlbumArtist());
    if (managedAlbum == null)
      return false;
    else if (album.getName().equals(managedAlbum.getName())
        && album.getAlbumArtist().getName().equals(managedAlbum.getAlbumArtist().getName()))
      return true;
    else
      return false;
  }
View Full Code Here

   */
  private Album searchForAlbum(String title, Artist albumArtist) {
    Map<String, Album> albumsOfArtist = this.searchForArtist(albumArtist);
    if (albumsOfArtist == null)
      return null;
    Album album = albumsOfArtist.get(title);
    return album;
  }
View Full Code Here

   *            Album artist of the album.
   * @return The created album.
   * @throws JitcaException if an error occurs.
   */
  private Album addAlbum(String title, Artist albumArtist) {
    Album album = null;
    // special case treatments
    if (this.isSpecialCase(albumArtist)){
      if (albumArtist instanceof VariousArtists){
        album = new VariousArtistsAlbum(title, albumArtist, source);
      }
    } else {
      album = new AlbumImpl(title, albumArtist, source);
    }
   

    Map<String, Album> albumsOfArtist = searchForArtist(albumArtist);

    if (albumsOfArtist == null) {
      albumsOfArtist = addArtist(albumArtist);
    }

    albumsOfArtist.put(title, album);
    if (!this.lazy){
      album.loadAllTracks();
    }
   
    return album;
  }
View Full Code Here

TOP

Related Classes of com.jitcaforwin.extended.api.track.Album

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.