242 lines
6.8 KiB
Java
242 lines
6.8 KiB
Java
/**
|
|
*
|
|
* Project: Eight Track, File: Song.java
|
|
*
|
|
* Copyright 2019-2020 Locusworks LLC.
|
|
* All rights reserved. Federal copyright law prohibits unauthorized reproduction by
|
|
* any means and imposes fines up to $25,000 for violation. No part of this material
|
|
* may be reproduced, transmitted, transcribed, stored in a retrieval system, copied,
|
|
* modified, duplicated, adapted or translated into another program language in any
|
|
* form or by any means, electronic, mechanical, photocopying, recording, or
|
|
* otherwise, without the prior written permission from Locusworks. Locusworks
|
|
* affirms that Eight-Track(R) software and data is subject to United States
|
|
* Government Purpose Rights. Contact Locusworks, 1313 Lawnview Drive
|
|
* Forney TX 75126, (802) 488-0438, for commercial licensing opportunities.
|
|
*
|
|
* IN NO EVENT SHALL LOCUSWORKS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
|
* INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT
|
|
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF LOCUSWORKS HAS BEEN
|
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. NO RESPONSIBILITY IS ASSUMED BY
|
|
* LOCUSWORKS FOR ITS USE, OR FOR ANY INFRINGEMENTS OF PATENTS OR OTHER RIGHTS OF
|
|
* THIRD PARTIES RESULTING FROM ITS USE. LOCUSWORKS SPECIFICALLY DISCLAIMS ANY
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND
|
|
* ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
|
|
* IS". LOCUSWORKS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
|
* ENHANCEMENTS, OR MODIFICATIONS.
|
|
*/
|
|
/*
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
* To change this template file, choose Tools | Templates
|
|
* and open the template in the editor.
|
|
*/
|
|
package net.locusworks.discord.eighttrack.database.entities;
|
|
|
|
import java.io.Serializable;
|
|
import java.math.BigInteger;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import javax.persistence.Basic;
|
|
import javax.persistence.CascadeType;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.GeneratedValue;
|
|
import javax.persistence.GenerationType;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.NamedQueries;
|
|
import javax.persistence.NamedQuery;
|
|
import javax.persistence.OneToMany;
|
|
import javax.persistence.Table;
|
|
import javax.persistence.Temporal;
|
|
import javax.persistence.TemporalType;
|
|
|
|
/**
|
|
*
|
|
* @author isaac
|
|
*/
|
|
@Entity
|
|
@Table(name = "song", catalog = "eighttrack", schema = "")
|
|
@NamedQueries({
|
|
@NamedQuery(name = "Song.findAll", query = "SELECT s FROM Song s")})
|
|
public class Song implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
@Basic(optional = false)
|
|
@Column(name = "id")
|
|
private Long id;
|
|
@Basic(optional = false)
|
|
@Column(name = "title")
|
|
private String title;
|
|
@Column(name = "artist")
|
|
private String artist;
|
|
@Column(name = "album")
|
|
private String album;
|
|
@Column(name = "genre")
|
|
private String genre;
|
|
@Column(name = "track_number")
|
|
private String trackNumber;
|
|
@Column(name = "disc_number")
|
|
private String discNumber;
|
|
@Column(name = "release_year")
|
|
private String releaseYear;
|
|
@Column(name = "duration")
|
|
private BigInteger duration;
|
|
@Basic(optional = false)
|
|
@Column(name = "file_path")
|
|
private String filePath;
|
|
@Basic(optional = false)
|
|
@Column(name = "file_hash")
|
|
private String fileHash;
|
|
@Column(name = "date_added")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date dateAdded;
|
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "song")
|
|
private List<GuildSong> guildSongList;
|
|
|
|
public Song() {
|
|
}
|
|
|
|
public Song(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public Song(Long id, String title, String filePath, String fileHash) {
|
|
this.id = id;
|
|
this.title = title;
|
|
this.filePath = filePath;
|
|
this.fileHash = fileHash;
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getTitle() {
|
|
return title;
|
|
}
|
|
|
|
public void setTitle(String title) {
|
|
this.title = title;
|
|
}
|
|
|
|
public String getArtist() {
|
|
return artist;
|
|
}
|
|
|
|
public void setArtist(String artist) {
|
|
this.artist = artist;
|
|
}
|
|
|
|
public String getAlbum() {
|
|
return album;
|
|
}
|
|
|
|
public void setAlbum(String album) {
|
|
this.album = album;
|
|
}
|
|
|
|
public String getGenre() {
|
|
return genre;
|
|
}
|
|
|
|
public void setGenre(String genre) {
|
|
this.genre = genre;
|
|
}
|
|
|
|
public String getTrackNumber() {
|
|
return trackNumber;
|
|
}
|
|
|
|
public void setTrackNumber(String trackNumber) {
|
|
this.trackNumber = trackNumber;
|
|
}
|
|
|
|
public String getDiscNumber() {
|
|
return discNumber;
|
|
}
|
|
|
|
public void setDiscNumber(String discNumber) {
|
|
this.discNumber = discNumber;
|
|
}
|
|
|
|
public String getReleaseYear() {
|
|
return releaseYear;
|
|
}
|
|
|
|
public void setReleaseYear(String releaseYear) {
|
|
this.releaseYear = releaseYear;
|
|
}
|
|
|
|
public BigInteger getDuration() {
|
|
return duration;
|
|
}
|
|
|
|
public void setDuration(BigInteger duration) {
|
|
this.duration = duration;
|
|
}
|
|
|
|
public String getFilePath() {
|
|
return filePath;
|
|
}
|
|
|
|
public void setFilePath(String filePath) {
|
|
this.filePath = filePath;
|
|
}
|
|
|
|
public String getFileHash() {
|
|
return fileHash;
|
|
}
|
|
|
|
public void setFileHash(String fileHash) {
|
|
this.fileHash = fileHash;
|
|
}
|
|
|
|
public Date getDateAdded() {
|
|
return dateAdded;
|
|
}
|
|
|
|
public void setDateAdded(Date dateAdded) {
|
|
this.dateAdded = dateAdded;
|
|
}
|
|
|
|
public List<GuildSong> getGuildSongList() {
|
|
return guildSongList;
|
|
}
|
|
|
|
public void setGuildSongList(List<GuildSong> guildSongList) {
|
|
this.guildSongList = guildSongList;
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
int hash = 0;
|
|
hash += (id != null ? id.hashCode() : 0);
|
|
return hash;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object object) {
|
|
// TODO: Warning - this method won't work in the case the id fields are not set
|
|
if (!(object instanceof Song)) {
|
|
return false;
|
|
}
|
|
Song other = (Song) object;
|
|
if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "net.locusworks.discord.eighttrack.database.entities.Song[ id=" + id + " ]";
|
|
}
|
|
|
|
}
|