Added a base Model class which implements equals.
This commit is contained in:
parent
a795397b3b
commit
b4ce76063b
@ -1,10 +1,6 @@
|
|||||||
package com.jdbernard.wdiwtlt.db.models;
|
package com.jdbernard.wdiwtlt.db.models;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
public class Album extends Model {
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Album {
|
|
||||||
public int id;
|
|
||||||
public String name;
|
public String name;
|
||||||
public Integer trackTotal;
|
public Integer trackTotal;
|
||||||
public Integer year;
|
public Integer year;
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
package com.jdbernard.wdiwtlt.db.models;
|
package com.jdbernard.wdiwtlt.db.models;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
public class Artist extends Model {
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Artist {
|
|
||||||
public int id;
|
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
public String toString() { return name; }
|
public String toString() { return name; }
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
package com.jdbernard.wdiwtlt.db.models;
|
package com.jdbernard.wdiwtlt.db.models;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
public class Bookmark extends Model {
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Bookmark {
|
|
||||||
public int id;
|
|
||||||
public String name;
|
public String name;
|
||||||
public int playlistId;
|
public int playlistId;
|
||||||
public int mediaFileId;
|
public int mediaFileId;
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
package com.jdbernard.wdiwtlt.db.models;
|
package com.jdbernard.wdiwtlt.db.models;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
public class Image extends Model {
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Image {
|
|
||||||
public int id;
|
|
||||||
public String url;
|
public String url;
|
||||||
|
|
||||||
public String toString() { return url; }
|
public String toString() { return url; }
|
||||||
|
@ -2,14 +2,10 @@ package com.jdbernard.wdiwtlt.db.models;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
public class MediaFile extends Model {
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class MediaFile {
|
|
||||||
public static final String TAG_INFO = "tag info";
|
public static final String TAG_INFO = "tag info";
|
||||||
public static final String FILE_LOCATION = "file location";
|
public static final String FILE_LOCATION = "file location";
|
||||||
|
|
||||||
public int id;
|
|
||||||
public String name;
|
public String name;
|
||||||
public Integer trackNumber;
|
public Integer trackNumber;
|
||||||
public int playCount = 0;
|
public int playCount = 0;
|
||||||
|
@ -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; }
|
||||||
|
}
|
@ -1,11 +1,8 @@
|
|||||||
package com.jdbernard.wdiwtlt.db.models;
|
package com.jdbernard.wdiwtlt.db.models;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import javax.persistence.Entity;
|
|
||||||
|
|
||||||
@Entity
|
public class Playlist extends Model {
|
||||||
public class Playlist {
|
|
||||||
public int id;
|
|
||||||
public boolean userCreated;
|
public boolean userCreated;
|
||||||
public Date lastUsed;
|
public Date lastUsed;
|
||||||
public String name;
|
public String name;
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
package com.jdbernard.wdiwtlt.db.models;
|
package com.jdbernard.wdiwtlt.db.models;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
public class Tag extends Model {
|
||||||
|
|
||||||
@Entity
|
|
||||||
public class Tag {
|
|
||||||
public int id;
|
|
||||||
public String name;
|
public String name;
|
||||||
|
|
||||||
public String toString() { return name; }
|
public String toString() { return name; }
|
||||||
|
Loading…
Reference in New Issue
Block a user