Added a base Model class which implements equals.

This commit is contained in:
Jonathan Bernard 2016-02-12 17:18:37 -06:00
parent a795397b3b
commit b4ce76063b
8 changed files with 22 additions and 34 deletions

View File

@ -1,10 +1,6 @@
package com.jdbernard.wdiwtlt.db.models;
import javax.persistence.Entity;
@Entity
public class Album {
public int id;
public class Album extends Model {
public String name;
public Integer trackTotal;
public Integer year;

View File

@ -1,10 +1,6 @@
package com.jdbernard.wdiwtlt.db.models;
import javax.persistence.Entity;
@Entity
public class Artist {
public int id;
public class Artist extends Model {
public String name;
public String toString() { return name; }

View File

@ -1,10 +1,6 @@
package com.jdbernard.wdiwtlt.db.models;
import javax.persistence.Entity;
@Entity
public class Bookmark {
public int id;
public class Bookmark extends Model {
public String name;
public int playlistId;
public int mediaFileId;

View File

@ -1,10 +1,6 @@
package com.jdbernard.wdiwtlt.db.models;
import javax.persistence.Entity;
@Entity
public class Image {
public int id;
public class Image extends Model {
public String url;
public String toString() { return url; }

View File

@ -2,14 +2,10 @@ package com.jdbernard.wdiwtlt.db.models;
import java.util.Date;
import javax.persistence.Entity;
@Entity
public class MediaFile {
public class MediaFile extends Model {
public static final String TAG_INFO = "tag info";
public static final String FILE_LOCATION = "file location";
public int id;
public String name;
public Integer trackNumber;
public int playCount = 0;

View File

@ -0,0 +1,15 @@
package com.jdbernard.wdiwtlt.db.models;
import javax.persistence.Entity;
@Entity
public class Model {
public int id;
public boolean equals(Object thatObj) {
if (thatObj == null) return false;
if (!(thatObj instanceof Model)) return false;
Model that = (Model) thatObj;
return this.id == that.id; }
}

View File

@ -1,11 +1,8 @@
package com.jdbernard.wdiwtlt.db.models;
import java.util.Date;
import javax.persistence.Entity;
@Entity
public class Playlist {
public int id;
public class Playlist extends Model {
public boolean userCreated;
public Date lastUsed;
public String name;

View File

@ -1,10 +1,6 @@
package com.jdbernard.wdiwtlt.db.models;
import javax.persistence.Entity;
@Entity
public class Tag {
public int id;
public class Tag extends Model {
public String name;
public String toString() { return name; }