package ar.edu.unrc.exa.dc.dose2016.riocuartobandasderock.model;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * This class represents a song played by Rio Cuarto's bands 
 */

@Entity
@Table(name = "SongDB")
public class Song {
	
   /**
	* id represents the id of the song
	* nameSong represents the name of the song
	* genere represents the genere of the song
	* performBy represents the bands from Rio Cuarto who played this song
	* duration represents the duration of this song
	* author represents the author who composed the song
	* album represents the album where the song belongs
	*/
	
	@Id
	@Column(name = "idSong")
	private String id;
	
	@Column(name = "name")
	private String nameSong;

	@Column(name = "duration")
	private int duration;
	
	/**
	 * Default constructor of class song
	 */
	public Song() {

	}
	
	/**
	 * Constructor of the class Song with parameters
	 * @param i represent the id of the song to assign
	 * @param nsong represents the name of the song to assign
	 * @param gen represents the genre of the song to assign
	 * @param band represents the band's name of the song to assign
	 * @param dur represents the duration of the song to assign
	 * @param aut represents the author of the song to assign
	 * @param alb represent the album to assign
	 */
	public Song(String nsong, int dur){
		nameSong = nsong;
		duration = dur;
	}

// Seters and geters of the method song............
	
	/**
	 * @return the id of the song
	 */
	public String getId(){
		return id;
	}
	
	/**
	 * Sets the id of the song
	 * @param i represents the id of the song to assign
	 */
	public void setId(String i){
		id = i;
	}
	
	/**
	 * @return the name of the song
	 */
	public String getName(){
		return nameSong;
	}
	
	/**
	 * Sets the name of the song
	 * @param nsong represents the name to assign
	 */
	public void setName(String nsong){
		nameSong = nsong;
	}
	
	/**
	 * @return the duration of the song
	 */
	public int getDuration(){
		return duration;
	}
	
	/**
	 * Sets a duration for the song
	 * @param dur represents the duration to assign
	 */
	public void setDuration(int dur){
		duration = dur;
	}
	
	public String getDurationAsString(){
		int cociente = duration/60;
		int resto = duration%60;
		return cociente + ":" + resto;
	} 
	
}

@@ -2228,16 +2228,83 @@
 r;%0A%09%7D%0A%09%0A
+%09/**%0A%09 * @return the duration in format of conventional time%0A%09 **/%0A
 %09public 

add comment