diff --git a/ultrasonic/src/main/java/org/moire/ultrasonic/domain/Indexes.java b/ultrasonic/src/main/java/org/moire/ultrasonic/domain/Indexes.java deleted file mode 100644 index 81fbdd86..00000000 --- a/ultrasonic/src/main/java/org/moire/ultrasonic/domain/Indexes.java +++ /dev/null @@ -1,66 +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; -import java.util.List; - -/** - * @author Sindre Mehus - */ -public class Indexes implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 8156117238598414701L; - private final long lastModified; - private final String ignoredArticles; - private final List shortcuts; - private final List artists; - - public Indexes(long lastModified, String ignoredArticles, List shortcuts, List artists) - { - this.lastModified = lastModified; - this.ignoredArticles = ignoredArticles; - this.shortcuts = shortcuts; - this.artists = artists; - } - - public long getLastModified() - { - return lastModified; - } - - public List getShortcuts() - { - return shortcuts; - } - - public List getArtists() - { - return artists; - } - - public String getIgnoredArticles() - { - return ignoredArticles; - } -} \ No newline at end of file diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/APIIndexesConverter.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/APIIndexesConverter.kt index fbecc194..4f72202a 100644 --- a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/APIIndexesConverter.kt +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/APIIndexesConverter.kt @@ -7,7 +7,9 @@ import org.moire.ultrasonic.api.subsonic.models.Index import org.moire.ultrasonic.api.subsonic.models.Indexes as APIIndexes fun APIIndexes.toDomainEntity(): Indexes = Indexes(this.lastModified, this.ignoredArticles, - this.shortcutList.map { it.toDomainEntity() }, this.indexList.foldIndexToArtistList()) + this.shortcutList.map { it.toDomainEntity() }.toMutableList(), + this.indexList.foldIndexToArtistList().toMutableList() +) private fun List.foldIndexToArtistList(): List = this.fold(listOf(), { acc, index -> acc + index.artists.map { it.toDomainEntity() } diff --git a/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/Indexes.kt b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/Indexes.kt new file mode 100644 index 00000000..48711c2d --- /dev/null +++ b/ultrasonic/src/main/kotlin/org/moire/ultrasonic/domain/Indexes.kt @@ -0,0 +1,14 @@ +package org.moire.ultrasonic.domain + +import java.io.Serializable + +data class Indexes( + val lastModified: Long, + val ignoredArticles: String, + val shortcuts: MutableList = mutableListOf(), + val artists: MutableList = mutableListOf() +) : Serializable { + companion object { + private const val serialVersionUID = 8156117238598414701L + } +} diff --git a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/domain/APIPlaylistConverterTest.kt b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/domain/APIPlaylistConverterTest.kt index 6179f7cc..3d35339a 100644 --- a/ultrasonic/src/test/kotlin/org/moire/ultrasonic/domain/APIPlaylistConverterTest.kt +++ b/ultrasonic/src/test/kotlin/org/moire/ultrasonic/domain/APIPlaylistConverterTest.kt @@ -44,7 +44,7 @@ class APIPlaylistConverterTest { name `should equal to` entity.name comment `should equal to` entity.comment owner `should equal to` entity.owner - public `should equal to` entity.public + public `should equal` entity.public songCount `should equal to` entity.songCount.toString() created `should equal to` playlistDateFormat.format(entity.created?.time) }