View Javadoc

1   /*
2    * Created on Jan 31, 2007
3    *
4    */
5   package org.musicontroller.gui.components;
6   
7   
8   import org.apache.tapestry.BaseComponent;
9   import org.musicontroller.core.Playlist;
10  import org.musicontroller.security.User;
11  
12  /**
13   * @author Varienaja
14   */
15  public abstract class PlaylistLink extends BaseComponent {
16  	public abstract User getUser();
17  	
18  	public abstract Playlist getPlaylist();
19  	public abstract void setPlaylist(Playlist playlist);
20  	
21  	public abstract Object[] getPlaylistinfo();
22  	public abstract void setPlaylistinfo(Object[] info);
23  	
24  	public Long getPlaylistid() {
25  		return getPlaylist()==null ? (Long) getPlaylistinfo()[0] : Long.valueOf(getPlaylist().getId());
26  	}
27  	
28  	public String getPlaylistname() {
29  		return getPlaylist()==null ? (String) getPlaylistinfo()[1] : getPlaylist().getName();
30  	}
31  	
32  	/**
33  	 * Used to construct the DownloadLink.
34  	 * @return The id of the current User.
35  	 */
36  	public Long getUserid() {
37  		if (getUser()!=null) {
38  			return getUser().getId();
39  		} else {
40  			return null;
41  		}
42  	}
43  	
44  	/**
45  	 * Used to construct the DownloadLink.
46  	 * @return The password hash of the current User.
47  	 */
48  	public String getPasshash() {
49  		if (getUser()!=null) {
50  			return getUser().getPassword();
51  		} else {
52  			return null;
53  		}
54  	}
55  
56  }