package org.ajax4jsf.bean.tree.rich;

import org.richfaces.model.TreeNodeImpl;

public class Album extends TreeNodeImpl<Object> {

    /**
     * serial version ID
     */
    private static final long serialVersionUID = -1769541701902658524L;

    private long id;
    private String title;
    private Integer year;

    public Album() {
        setId(System.currentTimeMillis());
    }

//
// TreeNode implementation
//

    public Object getData() {
        return this;
    }

    public void setData(Object data) {
    }

//
// Album implementation
//
    /**
     * Gets value of id field.
     * @return value of id field
     */
    public long getId() {
        return id;
    }

    /**
     * Set a new value for id field.
     * @param id a new value for id field
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * Gets value of title field.
     * @return value of title field
     */
    public String getTitle() {
        return title;
    }

    /**
     * Set a new value for title field.
     * @param title a new value for title field
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * Gets value of year field.
     * @return value of year field
     */
    public Integer getYear() {
        return year;
    }

    /**
     * Set a new value for year field.
     * @param year a new value for year field
     */
    public void setYear(Integer year) {
        this.year = year;
    }

    public void addSong(Song song) {
        addChild(song.getId(), song);
    }

    /**
     * Gets value of performer field.
     * @return value of performer field
     */
    public Performer getPerformer() {
        return (Performer) getParent();
    }

    /**
     * Set a new value for performer field.
     * @param performer a new value for performer field
     */
    public void setPerformer(Performer performer) {
        setParent(performer);
    }

    public String getType() {
        return "album";
    }
}
