package org.ajax4jsf.bean.tree.rich;

import org.richfaces.model.TreeNodeImpl;

public class Performer extends TreeNodeImpl<Object> {

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

    private long id;
    private String name;

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

//
// TreeNode implementation
//

    public Object getData() {
        return this;
    }

    public void setData(Object data) {
    }

//
// Performer 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 name field.
     * @return value of name field
     */
    public String getName() {
        return name;
    }

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

    public void addAlbum(Album album) {
        addChild(album.getId(), album);
    }

    /**
     * Gets value of library field.
     * @return value of library field
     */
    public AudioLibrary getLibrary() {
        return (AudioLibrary) getParent();
    }

    /**
     * Set a new value for library field.
     * @param library a new value for library field
     */
    public void setLibrary(AudioLibrary library) {
        setLibrary(library);
    }

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