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:
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Project: Eight Track, File: EightTrackBeanConfiguration.java
|
||||
*
|
||||
* Copyright 2019 Locusworks LLC.
|
||||
* 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,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Project: Eight Track, File: EightTrackDataSource.java
|
||||
*
|
||||
* Copyright 2019 Locusworks LLC.
|
||||
* 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,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Project: Eight Track, File: DiscordGuild.java
|
||||
*
|
||||
* Copyright 2019 Locusworks LLC.
|
||||
* 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,
|
||||
@@ -34,7 +34,9 @@ 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;
|
||||
@@ -42,6 +44,7 @@ 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;
|
||||
@@ -71,6 +74,10 @@ public class DiscordGuild implements Serializable {
|
||||
@Column(name = "date_joined")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date dateJoined;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "guild")
|
||||
private List<GuildSong> guildSongList;
|
||||
@OneToMany(cascade = CascadeType.ALL, mappedBy = "guild")
|
||||
private List<GuildPlaylist> guildPlaylistList;
|
||||
|
||||
public DiscordGuild() {
|
||||
}
|
||||
@@ -117,6 +124,22 @@ public class DiscordGuild implements Serializable {
|
||||
this.dateJoined = dateJoined;
|
||||
}
|
||||
|
||||
public List<GuildSong> getGuildSongList() {
|
||||
return guildSongList;
|
||||
}
|
||||
|
||||
public void setGuildSongList(List<GuildSong> guildSongList) {
|
||||
this.guildSongList = guildSongList;
|
||||
}
|
||||
|
||||
public List<GuildPlaylist> getGuildPlaylistList() {
|
||||
return guildPlaylistList;
|
||||
}
|
||||
|
||||
public void setGuildPlaylistList(List<GuildPlaylist> guildPlaylistList) {
|
||||
this.guildPlaylistList = guildPlaylistList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 0;
|
||||
@@ -139,7 +162,7 @@ public class DiscordGuild implements Serializable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "net.locusworks.discord.pseudobot.database.entities.DiscordGuild[ id=" + id + " ]";
|
||||
return "net.locusworks.discord.eighttrack.database.entities.DiscordGuild[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
/**
|
||||
*
|
||||
* Project: Eight Track, File: GuildPlaylistSong.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 javax.persistence.Basic;
|
||||
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.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author isaac
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "guild_playlist_song", catalog = "eighttrack", schema = "")
|
||||
@NamedQueries({
|
||||
@NamedQuery(name = "GuildPlaylistSong.findAll", query = "SELECT g FROM GuildPlaylistSong g")})
|
||||
public class GuildPlaylistSong implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Basic(optional = false)
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
@Column(name = "date_added")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date dateAdded;
|
||||
@JoinColumn(name = "guild_playlist", referencedColumnName = "id")
|
||||
@ManyToOne(optional = false)
|
||||
private GuildPlaylist guildPlaylist;
|
||||
@JoinColumn(name = "guild_song", referencedColumnName = "id")
|
||||
@ManyToOne(optional = false)
|
||||
private GuildSong guildSong;
|
||||
|
||||
public GuildPlaylistSong() {
|
||||
}
|
||||
|
||||
public GuildPlaylistSong(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getDateAdded() {
|
||||
return dateAdded;
|
||||
}
|
||||
|
||||
public void setDateAdded(Date dateAdded) {
|
||||
this.dateAdded = dateAdded;
|
||||
}
|
||||
|
||||
public GuildPlaylist getGuildPlaylist() {
|
||||
return guildPlaylist;
|
||||
}
|
||||
|
||||
public void setGuildPlaylist(GuildPlaylist guildPlaylist) {
|
||||
this.guildPlaylist = guildPlaylist;
|
||||
}
|
||||
|
||||
public GuildSong getGuildSong() {
|
||||
return guildSong;
|
||||
}
|
||||
|
||||
public void setGuildSong(GuildSong guildSong) {
|
||||
this.guildSong = guildSong;
|
||||
}
|
||||
|
||||
@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 GuildPlaylistSong)) {
|
||||
return false;
|
||||
}
|
||||
GuildPlaylistSong other = (GuildPlaylistSong) 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.GuildPlaylistSong[ id=" + id + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
*
|
||||
* Project: Eight Track, File: GuildSong.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_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;
|
||||
@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 Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
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 + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
/**
|
||||
*
|
||||
* Project: Eight Track, File: Song.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.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 = "uuid")
|
||||
private String uuid;
|
||||
@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 uuid, String title, String filePath, String fileHash) {
|
||||
this.id = id;
|
||||
this.uuid = uuid;
|
||||
this.title = title;
|
||||
this.filePath = filePath;
|
||||
this.fileHash = fileHash;
|
||||
}
|
||||
|
||||
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 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 + " ]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Project: Eight Track, File: GuildRepository.java
|
||||
*
|
||||
* Copyright 2019 Locusworks LLC.
|
||||
* 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,
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
*
|
||||
* Project: Eight Track, File: GuildSongRepository.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.
|
||||
*/
|
||||
package net.locusworks.discord.eighttrack.database.repos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
import net.locusworks.discord.eighttrack.database.entities.DiscordGuild;
|
||||
import net.locusworks.discord.eighttrack.database.entities.GuildSong;
|
||||
import net.locusworks.discord.eighttrack.database.entities.Song;
|
||||
|
||||
public interface GuildSongRepository extends CrudRepository<GuildSong, Long> {
|
||||
|
||||
GuildSong findByGuildAndSong(DiscordGuild guild, Song song);
|
||||
|
||||
@Query("SELECT gs FROM GuildSong gs WHERE gs.guild.guildId = ?1 AND gs.song.fileHash = ?2")
|
||||
GuildSong findByGuildAndSongHash(Long guildId, String songHash);
|
||||
|
||||
List<GuildSong> findByGuild(DiscordGuild guild);
|
||||
|
||||
@Query("SELECT gs FROM GuildSong gs WHERE gs.guild.guildId = ?1")
|
||||
List<GuildSong> findByGuild(Long guildId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/**
|
||||
*
|
||||
* Project: Eight Track, File: SongRepository.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.
|
||||
*/
|
||||
package net.locusworks.discord.eighttrack.database.repos;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import net.locusworks.discord.eighttrack.database.entities.Song;
|
||||
|
||||
public interface SongRepository extends CrudRepository<Song, Long> {
|
||||
|
||||
Song findByUuid(String uuid);
|
||||
|
||||
Song findByFileHash(String fileHash);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user