diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/domain/Artist.java b/ultrasonic/src/main/java/org/moire/ultrasonic/domain/Artist.java deleted file mode 100644 index 5fef9cfe..00000000 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/domain/Artist.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - This file is part of Subsonic. - - Subsonic is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Subsonic is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with Subsonic. If not, see . - - Copyright 2009 (C) Sindre Mehus - */ -package org.moire.ultrasonic.domain; - -import java.io.Serializable; - -/** - * @author Sindre Mehus - */ -public class Artist implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = -5790532593784846982L; - private String id; - private String name; - private String index; - private String coverArt; - private Long albumCount; - private int closeness; - - public String getId() - { - return id; - } - - public void setId(String id) - { - this.id = id; - } - - public String getName() - { - return name; - } - - public void setName(String name) - { - this.name = name; - } - - public String getIndex() - { - return index; - } - - public void setIndex(String index) - { - this.index = index; - } - - public String getCoverArt() - { - return coverArt; - } - - public void setCoverArt(String coverArt) - { - this.coverArt = coverArt; - } - - public long getAlbumCount() - { - return albumCount; - } - - public void setAlbumCount(Long albumCount) - { - this.albumCount = albumCount; - } - - public int getCloseness() - { - return closeness; - } - - public void setCloseness(int closeness) - { - this.closeness = closeness; - } - - @Override - public String toString() - { - return name; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Artist artist = (Artist) o; - - if (closeness != artist.closeness) return false; - if (id != null ? !id.equals(artist.id) : artist.id != null) return false; - if (name != null ? !name.equals(artist.name) : artist.name != null) return false; - if (index != null ? !index.equals(artist.index) : artist.index != null) return false; - if (coverArt != null ? !coverArt.equals(artist.coverArt) : artist.coverArt != null) - return false; - return albumCount != null ? albumCount.equals(artist.albumCount) : artist.albumCount == null; - } - - @Override - public int hashCode() { - int result = id != null ? id.hashCode() : 0; - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (index != null ? index.hashCode() : 0); - result = 31 * result + (coverArt != null ? coverArt.hashCode() : 0); - result = 31 * result + (albumCount != null ? albumCount.hashCode() : 0); - result = 31 * result + closeness; - return result; - } -} \ No newline at end of file diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/APIArtistConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/APIArtistConverter.kt index 2a144b95..d7381164 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/APIArtistConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/APIArtistConverter.kt @@ -5,10 +5,10 @@ package org.moire.ultrasonic.domain import org.moire.ultrasonic.api.subsonic.models.Artist as APIArtist -fun APIArtist.toDomainEntity(): Artist = Artist().apply { - id = this@toDomainEntity.id +fun APIArtist.toDomainEntity(): Artist = Artist( + id = this@toDomainEntity.id, name = this@toDomainEntity.name -} +) fun APIArtist.toMusicDirectoryDomainEntity(): MusicDirectory = MusicDirectory().apply { name = this@toMusicDirectoryDomainEntity.name diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/Artist.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/Artist.kt new file mode 100644 index 00000000..dd46d415 --- /dev/null +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/Artist.kt @@ -0,0 +1,16 @@ +package org.moire.ultrasonic.domain + +import java.io.Serializable + +data class Artist( + var id: String? = null, + var name: String? = null, + var index: String? = null, + var coverArt: String? = null, + var albumCount: Long? = null, + var closeness: Int = 0 +) : Serializable { + companion object { + private const val serialVersionUID = -5790532593784846982L + } +} diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/domain/APIArtistConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/domain/APIArtistConverterTest.kt index c2a48340..6d7a40d7 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/domain/APIArtistConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/domain/APIArtistConverterTest.kt @@ -20,8 +20,8 @@ class APIArtistConverterTest { val convertedEntity = entity.toDomainEntity() with(convertedEntity) { - id `should equal to` entity.id - name `should equal to` entity.name + id `should equal` entity.id + name `should equal` entity.name } }