171 lines
5.4 KiB
Java
171 lines
5.4 KiB
Java
/**
|
|
*
|
|
* Project: Eight Track, File: GuildSong.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.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.JoinColumn;
|
|
import javax.persistence.ManyToOne;
|
|
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 = "guild_song", catalog = "eighttrack", schema = "")
|
|
@NamedQueries({
|
|
@NamedQuery(name = "GuildSong.findAll", query = "SELECT g FROM GuildSong g")})
|
|
public class GuildSong 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 = "uuid")
|
|
private String uuid;
|
|
@Column(name = "date_added")
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date dateAdded;
|
|
@JoinColumn(name = "guild", referencedColumnName = "id")
|
|
@ManyToOne(optional = false)
|
|
private DiscordGuild guild;
|
|
@JoinColumn(name = "song", referencedColumnName = "id")
|
|
@ManyToOne(optional = false)
|
|
private Song song;
|
|
@OneToMany(cascade = CascadeType.ALL, mappedBy = "guildSong")
|
|
private List<GuildPlaylistSong> guildPlaylistSongList;
|
|
|
|
public GuildSong() {
|
|
}
|
|
|
|
public GuildSong(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public GuildSong(Long id, String uuid) {
|
|
this.id = id;
|
|
this.uuid = uuid;
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(Long id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getUuid() {
|
|
return uuid;
|
|
}
|
|
|
|
public void setUuid(String uuid) {
|
|
this.uuid = uuid;
|
|
}
|
|
|
|
public Date getDateAdded() {
|
|
return dateAdded;
|
|
}
|
|
|
|
public void setDateAdded(Date dateAdded) {
|
|
this.dateAdded = dateAdded;
|
|
}
|
|
|
|
public DiscordGuild getGuild() {
|
|
return guild;
|
|
}
|
|
|
|
public void setGuild(DiscordGuild guild) {
|
|
this.guild = guild;
|
|
}
|
|
|
|
public Song getSong() {
|
|
return song;
|
|
}
|
|
|
|
public void setSong(Song song) {
|
|
this.song = song;
|
|
}
|
|
|
|
public List<GuildPlaylistSong> getGuildPlaylistSongList() {
|
|
return guildPlaylistSongList;
|
|
}
|
|
|
|
public void setGuildPlaylistSongList(List<GuildPlaylistSong> guildPlaylistSongList) {
|
|
this.guildPlaylistSongList = guildPlaylistSongList;
|
|
}
|
|
|
|
@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 GuildSong)) {
|
|
return false;
|
|
}
|
|
GuildSong other = (GuildSong) 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.GuildSong[ id=" + id + " ]";
|
|
}
|
|
|
|
}
|