Refactored to use database
#5 Switched to use maria database to store song information #7 Added spring and hibernate support #8 Added song upload functionality
This commit is contained in:
@@ -0,0 +1,171 @@
|
||||
/**
|
||||
*
|
||||
* Project: Eight Track, File: GuildPlaylist.java
|
||||
*
|
||||
* Copyright 2019-2019 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_playlist", catalog = "eighttrack", schema = "")
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "GuildPlaylist.findAll", query = "SELECT g FROM GuildPlaylist g")})
|
||||
public class GuildPlaylist 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 = "userId")
|
||||
private long userId;
|
||||
@Basic(optional = false)
|
||||
@Column(name = "playlist")
|
||||
private String playlist;
|
||||
@Column(name = "date_added")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date dateAdded;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "guildPlaylist")
|
||||
private List<GuildPlaylistSong> guildPlaylistSongList;
|
||||
@JoinColumn(name = "guild", referencedColumnName = "id")
|
||||
@ManyToOne(optional = false)
|
||||
private DiscordGuild guild;
|
||||
|
||||
public GuildPlaylist() {
|
||||
}
|
||||
|
||||
public GuildPlaylist(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public GuildPlaylist(Long id, long userId, String playlist) {
|
||||
this.id = id;
|
||||
this.userId = userId;
|
||||
this.playlist = playlist;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getPlaylist() {
|
||||
return playlist;
|
||||
}
|
||||
|
||||
public void setPlaylist(String playlist) {
|
||||
this.playlist = playlist;
|
||||
}
|
||||
|
||||
public Date getDateAdded() {
|
||||
return dateAdded;
|
||||
}
|
||||
|
||||
public void setDateAdded(Date dateAdded) {
|
||||
this.dateAdded = dateAdded;
|
||||
}
|
||||
|
||||
public List<GuildPlaylistSong> getGuildPlaylistSongList() {
|
||||
return guildPlaylistSongList;
|
||||
}
|
||||
|
||||
public void setGuildPlaylistSongList(List<GuildPlaylistSong> guildPlaylistSongList) {
|
||||
this.guildPlaylistSongList = guildPlaylistSongList;
|
||||
}
|
||||
|
||||
public DiscordGuild getGuild() {
|
||||
return guild;
|
||||
}
|
||||
|
||||
public void setGuild(DiscordGuild guild) {
|
||||
this.guild = guild;
|
||||
}
|
||||
|
||||
@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 GuildPlaylist)) {
|
||||
return false;
|
||||
}
|
||||
GuildPlaylist other = (GuildPlaylist) 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.GuildPlaylist[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user