Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved a couple of shared elements in Album Artist and Track (external…

… ids, popularity, and more to come) to abstract RestrictedMedia. should probably also move some stuff up from Media to RestrictedMedia, such as toURL thats not applicatble for File, Image, et c.
  • Loading branch information...
commit b1049b04efb4d2d632a26d70a7111777e832cc26 1 parent 3c3ab58
thk0 authored
View
21 java/trunk/src/main/java/se/despotify/domain/media/Album.java
@@ -34,15 +34,11 @@
@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
private Image cover;
- private Float popularity;
private Integer year;
@OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH}, mappedBy = "album")
private List<Track> tracks;
- @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
- private List<ExternalId> externalIds;
-
@CollectionOfElements
@Column(length = 512)
private List<String> c;
@@ -132,14 +128,6 @@ public void setCover(Image cover) {
this.cover = cover;
}
- public Float getPopularity() {
- return popularity;
- }
-
- public void setPopularity(Float popularity) {
- this.popularity = popularity;
- }
-
public List<Track> getTracks() {
return tracks;
}
@@ -148,14 +136,6 @@ public void setTracks(List<Track> tracks) {
this.tracks = tracks;
}
- public List<ExternalId> getExternalIds() {
- return externalIds;
- }
-
- public void setExternalIds(List<ExternalId> externalIds) {
- this.externalIds = externalIds;
- }
-
public List<String> getC() {
return c;
}
@@ -219,7 +199,6 @@ public String toString() {
"id='" + id + '\'' +
", name='" + name + '\'' +
", type='" + type + '\'' +
- ", popularity=" + popularity +
", discNames=" + discNames +
", mainArtist=" + (mainArtist == null ? null : mainArtist.getId()) +
", cover='" + cover + '\'' +
View
127 java/trunk/src/main/java/se/despotify/domain/media/Artist.java
@@ -43,11 +43,6 @@
private List<Album> allAlbumsWithTrackPresent;
- @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
- private List<ExternalId> externalIds;
-
- private Float popularity;
-
public Artist() {
super();
}
@@ -103,21 +98,6 @@ public void setPortrait(Image portrait) {
this.portrait = portrait;
}
- public Float getPopularity() {
- return popularity;
- }
-
- public void setPopularity(Float popularity) {
- this.popularity = popularity;
- }
-
- public List<ExternalId> getExternalIds() {
- return externalIds;
- }
-
- public void setExternalIds(List<ExternalId> externalIds) {
- this.externalIds = externalIds;
- }
public List<Artist> getSimilarArtists() {
return similarArtists;
@@ -175,119 +155,12 @@ public void setTracks(List<Track> tracks) {
this.tracks = tracks;
}
-
-
-
-
-// public static Artist fromXMLElement(XMLElement artistNode, Store store, Date fullyLoadedDate) {
-// Artist artist = store.getArtist(artistNode.getChildText("id"));
-//
-// /* Set name. */
-// if (artistNode.hasChild("name")) {
-// artist.name = artistNode.getChildText("name");
-// }
-//
-// /* Set portrait. */
-// if (artistNode.hasChild("portrait")) {
-// XMLElement portraitNode = artistNode.getChild("portrait");
-// if (!"".equals(portraitNode.getText().trim())) {
-// artist.portrait = Image.fromXMLElement(portraitNode, store);
-// }
-// }
-//
-// /* Set popularity. */
-// if (artistNode.hasChild("popularity")) {
-// artist.popularity = Float.parseFloat(artistNode.getChildText("popularity"));
-// }
-//
-// XMLElement biosNode = artistNode.getChild("bios");
-// if (biosNode != null) {
-//
-// List<Biography> biographies = new ArrayList<Biography>();
-//
-// for (XMLElement bioNode : biosNode.getChildren()) {
-// if (!"bio".equals(bioNode.getElement().getNodeName())) {
-// log.warn("Unknown bios child node " + bioNode.getElement().getNodeName());
-// } else {
-// Biography biography = new Biography();
-// biography.setText(bioNode.getChildText("text"));
-// if (bioNode.hasChild("portraits")) {
-// biography.setPortraits(new ArrayList<Image>());
-// for (XMLElement portraitNode : bioNode.getChild("portraits").getChildren()) {
-// biography.getPortraits().add(Image.fromXMLElement(portraitNode, store));
-// }
-// }
-// biographies.add(biography);
-// }
-// artist.biographies = biographies;
-// }
-// }
-//
-// if (artistNode.hasChild("years-active")) {
-// artist.yearsActive = new ArrayList<String>(Arrays.asList(artistNode.getChildText("years-active").split(",")));
-// }
-//
-// if (artistNode.hasChild("genres")) {
-// String[] genreIds = artistNode.getChildText("genres").split(",");
-// Set<String> genres = new LinkedHashSet<String>(genreIds.length);
-// for (String genre : genreIds) {
-// if (!"".equals(genre)) {
-// genres.add(genre);
-// }
-// }
-// artist.genres = genres;
-// }
-//
-// XMLElement albumsNode = artistNode.getChild("albums");
-// if (albumsNode != null) {
-// List<Album> allAlbumsWithTrackPresent = new ArrayList<Album>();
-// for (XMLElement albumNode : albumsNode.getChildren()) {
-// Album album = Album.fromXMLElement(albumNode, store, fullyLoadedDate);
-//
-// // add to all albums
-// allAlbumsWithTrackPresent.add(album);
-//
-// // add to main artist albums
-// if (artist.equals(album.getMainArtist())) {
-// if (artist.getMainArtistAlbums() == null) {
-// artist.setMainArtistAlbums(new ArrayList<Album>());
-// }
-// if (!artist.getMainArtistAlbums().contains(album)) {
-// artist.getMainArtistAlbums().add(album);
-// }
-// }
-//
-// }
-// artist.allAlbumsWithTrackPresent = allAlbumsWithTrackPresent;
-// }
-//
-// /* Set similar artists. */
-// if (artistNode.hasChild("similar-artists")) {
-//
-// List<Artist> similarArtists = new ArrayList<Artist>();
-//
-// for (XMLElement similarArtistElement : artistNode.getChild("similar-artists").getChildren()) {
-// similarArtists.add(Artist.fromXMLElement(similarArtistElement, store, null));
-// }
-//
-// artist.setSimilarArtists(similarArtists);
-// }
-//
-// if (fullyLoadedDate != null) {
-// artist.setLoaded(fullyLoadedDate);
-// }
-//
-// return artist;
-// }
-
-
@Override
public String toString() {
return "Artist{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", portrait='" + portrait + '\'' +
- ", popularity=" + popularity +
", similarArtists=" + (similarArtists == null ? null : similarArtists.size()) +
'}';
}
View
20 java/trunk/src/main/java/se/despotify/domain/media/RestrictedMedia.java
@@ -19,6 +19,26 @@
@OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
private List<Restriction> restrictions;
+ private Float popularity;
+
+ @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
+ private List<ExternalId> externalIds;
+
+ public Float getPopularity() {
+ return popularity;
+ }
+
+ public void setPopularity(Float popularity) {
+ this.popularity = popularity;
+ }
+
+ public List<ExternalId> getExternalIds() {
+ return externalIds;
+ }
+
+ public void setExternalIds(List<ExternalId> externalIds) {
+ this.externalIds = externalIds;
+ }
public List<Restriction> getRestrictions() {
return restrictions;
View
22 java/trunk/src/main/java/se/despotify/domain/media/Track.java
@@ -36,8 +36,6 @@
@ManyToOne(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
private Image cover;
- private Float popularity;
-
@ManyToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
private List<Track> similarTracks;
@@ -47,9 +45,6 @@
@ManyToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
private List<Track> redirections;
- @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH})
- private List<ExternalId> externalIds;
-
public Track() {
}
@@ -170,22 +165,6 @@ public void setCover(Image cover) {
this.cover = cover;
}
- public Float getPopularity() {
- return popularity;
- }
-
- public void setPopularity(Float popularity) {
- this.popularity = popularity;
- }
-
- public List<ExternalId> getExternalIds() {
- return externalIds;
- }
-
- public void setExternalIds(List<ExternalId> externalIds) {
- this.externalIds = externalIds;
- }
-
public List<Track> getSimilarTracks() {
return similarTracks;
}
@@ -216,7 +195,6 @@ public String toString() {
", length=" + length +
", files=" + files +
", cover='" + cover + '\'' +
- ", popularity=" + popularity +
'}';
}
Please sign in to comment.
Something went wrong with that request. Please try again.