package thegroup.projectcddb.database;

import java.rmi.*;
import javax.ejb.*;

/**
 *  Class which encapsulates the idea of a CD/Disc according to the data from
 *  an assocaited CDDB entry.
 *
 *@author     diana abbas < dabbas @ umail ucsb edu >
 *@author     kyle dorman < kyle_dorman @ umail ucsb edu> 
 *@version    1.0
 *@see        Track
 */
public class CDEntryBean implements EntityBean
{
	/**
	 *  The runtime context of the entity bean
	 *
	 *
	 */
	public EntityContext context;

	/**
	 *  The Disc ID, a hex number that every file has
	 *
	 *
	 */
	public String discId;
	/**
	 *  The ID, essentially the primary key for the disc
	 *
	 *
	 */
	public Integer id;
	/**
	 *  Title of the disc
	 *
	 *
	 */
	public String title;
	/**
	 *  Year of the disc
	 *
	 *
	 */
	public String year;
	/**
	 *  Genre of the disc
	 *
	 *
	 */
	public String genre;
	/**
	 *  Extended data associated with the disc which may or may not exist
	 *
	 *
	 */
	public String extendedData;


	/**
	 *  Constructor for the CDEntryBean object
	 *
	 *
	 */
	public CDEntryBean() { }


	/**
	 *  Sets the Id attribute of the CDEntry object
	 *
	 *@param  id  The new Id value
	 *
	 */
	public void setId( Integer id )
	{

		this.id = id;
	}


	/**
	 *  Sets the Title attribute of the CDEntry object
	 *
	 *@param  title  The new Title value
	 *@since         empty
	 */
	public void setTitle( String title )
	{
		this.title = title + "\n";
	}


	/**
	 *  Sets the Year attribute of the CDEntry object
	 *
	 *@param  year  The new Year value
	 *@since        empty
	 */
	public void setYear( String year )
	{

		this.year = year;
	}


	/**
	 *  Sets the Genre attribute of the CDEntry object
	 *
	 *@param  genre  The new Genre value
	 *
	 */
	public void setGenre( String genre )
	{
		this.genre = genre;
	}


	/**
	 *  Sets the ExtendedData attribute of the CDEntry object
	 *
	 *@param  extendedData  The new ExtendedData value
	 *
	 */
	public void setExtendedData( String extendedData )
	{
		this.extendedData = extendedData + "\n";
	}


	/**
	 *  Sets the Discid attribute of the CDEntryBean object
	 *
	 *@param  discid  The new Discid value
	 *
	 */
	public void setDiscid( String discid )
	{
		this.discId = discid;
	}


	/**
	 *  Sets the EntityContext attribute of the CDEntryBean object
	 *
	 *@param  context              The new EntityContext value
	 *@exception  EJBException     Indicates a failure caused by a system-level error
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public void setEntityContext( EntityContext context )
			 throws EJBException, RemoteException
	{
		this.context = context;
	}


	/**
	 *  Gets the Id attribute of the CDEntry object
	 *
	 *@return                      The Id value
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public Integer getId() throws RemoteException
	{

		return id;
	}


	/**
	 *  Gets the Title attribute of the CDEntry object
	 *
	 *@return                      The Title value
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public String getTitle() throws RemoteException
	{

		return title;
	}


	/**
	 *  Gets the Year attribute of the CDEntry object
	 *
	 *@return                      The Year value
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public String getYear() throws RemoteException
	{

		return year;
	}


	/**
	 *  Gets the Genre attribute of the CDEntry object
	 *
	 *@return                      The Genre value
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public String getGenre() throws RemoteException
	{
		return genre;
	}


	/**
	 *  Gets the ExtendedData attribute of the CDEntry object
	 *
	 *@return                      The ExtendedData value
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public String getExtendedData() throws RemoteException
	{
		return extendedData;
	}


	/**
	 *  Gets the Discid attribute of the CDEntryBean object
	 *
	 *@return    The Discid value
	 *
	 */
	public String getDiscId()
	{
		return discId;
	}


	/**
	 *  Creates a bean with the information given to it
	 *
	 *@param  discid                         
	 *@param  title                          
	 *@param  year                           
	 *@param  genre                          
	 *@param  extendedData                   
	 *@return                      A bean with all the info given
	 *@exception  CreateException  Failure to create an entity EJB object
	 *
	 */
	public Integer ejbCreate( String discid, String title, String year, String genre, String extendedData ) throws javax.ejb.CreateException
	{
		this.discId = discid;
		this.title = title;
		this.year = year;
		this.genre = genre;
		this.extendedData = extendedData;
		return null;
	}


	/**
	 *  Manages the already created bean
	 *
	 *@param  discid                         
	 *@param  title                         
	 *@param  year                           
	 *@param  genre                          
	 *@param  extendedData                   
	 *@exception  CreateException  Failure to create an entity EJB object
	 *
	 */
	public void ejbPostCreate( String discid, String title, String year, String genre, String extendedData ) throws javax.ejb.CreateException
	{
	}


	/**
	 *  Unset the associated entity context. The container calls this method before removing the instance
	 *
	 *@exception  EJBException     Indicates a failure caused by a system-level error
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public void unsetEntityContext()
			 throws EJBException, RemoteException
	{
	}


	/**
	 *  A container invokes this method when the instance is taken out of the pool of available instances to become associated with a specific EJB object. 
         *  This method transitions the instance to the ready state.
	 *
	 *@exception  EJBException     Indicates a failure caused by a system-level error
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public void ejbActivate()
			 throws EJBException, RemoteException
	{
	}


	/**
	 *  A container invokes this method to instruct the instance to synchronize its state by loading it state from the underlying database
	 *
	 *@exception  EJBException     Indicates a failure caused by a system-level error
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public void ejbLoad()
			 throws EJBException, RemoteException
	{
	}


	/**
	 *  A container invokes this method on an instance before the instance becomes disassociated with a specific EJB object. 
         *  After this method completes, the container will place the instance into the pool of available instances.
	 *
	 *@exception  EJBException     Indicates a failure caused by a system-level error
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 *
	 */
	public void ejbPassivate()
			 throws EJBException, RemoteException
	{
	}


	/**
	 *  A container invokes this method before it removes the EJB object that is currently associated with the instance.
	 *
         *@exception  RemoveException  An attempt to remove an EJB object when the enterprise Bean or the container does not allow the EJB object to be removed
	 *@exception  EJBException     Indicates a failure caused by a system-level error
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 */
	public void ejbRemove()
			 throws EJBException, RemoteException, RemoveException
	{
	}


	/**
	 *  A container invokes this method to instruct the instance to synchronize its state by storing it to the underlying database.
	 *
	 *@exception  EJBException     Indicates a failure caused by a system-level error
	 *@exception  RemoteException  Provides backward compatibility for enterprise beans
	 */
	public void ejbStore()
			 throws EJBException, RemoteException
	{
	}

}
