restructure packages and split databases

This commit is contained in:
Felix 2018-09-05 23:10:08 +02:00
parent 40bfdc1470
commit 14609cc907
35 changed files with 75 additions and 68 deletions

View file

@ -1,6 +1,6 @@
package de.nicidienase.chaosflix.common
import de.nicidienase.chaosflix.common.entities.recording.persistence.PersistentRecording
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.PersistentRecording
import java.util.*
import kotlin.collections.ArrayList

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities
package de.nicidienase.chaosflix.common.mediadata.entities
import android.arch.persistence.room.TypeConverter

View file

@ -1,18 +1,14 @@
package de.nicidienase.chaosflix.common.entities
package de.nicidienase.chaosflix.common.mediadata.entities
import android.arch.persistence.db.SupportSQLiteDatabase
import android.arch.persistence.room.Database
import android.arch.persistence.room.RoomDatabase
import android.arch.persistence.room.TypeConverters
import android.arch.persistence.room.migration.Migration
import de.nicidienase.chaosflix.common.entities.download.OfflineEvent
import de.nicidienase.chaosflix.common.entities.download.OfflineEventDao
import de.nicidienase.chaosflix.common.entities.recording.RelatedEvent
import de.nicidienase.chaosflix.common.entities.recording.persistence.*
import de.nicidienase.chaosflix.common.entities.userdata.PlaybackProgress
import de.nicidienase.chaosflix.common.entities.userdata.PlaybackProgressDao
import de.nicidienase.chaosflix.common.entities.userdata.WatchlistItem
import de.nicidienase.chaosflix.common.entities.userdata.WatchlistItemDao
import de.nicidienase.chaosflix.common.userdata.entities.download.OfflineEvent
import de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence.*
import de.nicidienase.chaosflix.common.userdata.entities.progress.PlaybackProgress
import de.nicidienase.chaosflix.common.userdata.entities.watchlist.WatchlistItem
@Database(entities = arrayOf(
PersistentItem::class,
@ -25,18 +21,13 @@ import de.nicidienase.chaosflix.common.entities.userdata.WatchlistItemDao
WatchlistItem::class,
OfflineEvent::class), version = 5, exportSchema = true)
@TypeConverters(Converters::class)
abstract class ChaosflixDatabase : RoomDatabase() {
abstract fun playbackProgressDao(): PlaybackProgressDao
abstract fun watchlistItemDao(): WatchlistItemDao
abstract fun conferenceDao(): ConferenceDao
abstract fun eventDao(): EventDao
abstract fun recordingDao(): RecordingDao
abstract fun relatedEventDao(): RelatedEventDao
abstract class MediaDatabase : RoomDatabase() {
abstract fun conferenceGroupDao(): ConferenceGroupDao
abstract fun offlineEventDao(): OfflineEventDao
abstract fun conferenceDao(): ConferenceDao
abstract fun eventDao(): EventDao
abstract fun relatedEventDao(): RelatedEventDao
abstract fun recordingDao(): RecordingDao
companion object {
val migration_2_3 = object : Migration(2, 3) {

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording
package de.nicidienase.chaosflix.common.mediadata.entities.recording
import com.google.gson.annotations.SerializedName;

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording
package de.nicidienase.chaosflix.common.mediadata.entities.recording
import java.util.*
import kotlin.collections.HashMap

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording
package de.nicidienase.chaosflix.common.mediadata.entities.recording
import com.google.gson.annotations.SerializedName

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording
package de.nicidienase.chaosflix.common.mediadata.entities.recording
import com.google.gson.annotations.SerializedName;

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording
package de.nicidienase.chaosflix.common.mediadata.entities.recording
import android.os.Parcel
import android.os.Parcelable

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.lifecycle.LiveData
import android.arch.persistence.room.*

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.persistence.room.*
import android.os.Parcel

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.lifecycle.LiveData
import android.arch.persistence.room.Dao

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.lifecycle.LiveData
import android.arch.persistence.room.*

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.persistence.room.*
import android.os.Parcel

View file

@ -1,11 +1,11 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.persistence.room.*
import android.os.Parcel
import android.os.Parcelable
import android.text.Html
import android.text.Spanned
import de.nicidienase.chaosflix.common.entities.recording.Event
import de.nicidienase.chaosflix.common.mediadata.entities.recording.Event
@Entity(tableName = "event",
foreignKeys = arrayOf(ForeignKey(

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.persistence.room.Entity
import android.arch.persistence.room.PrimaryKey

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.persistence.room.*

View file

@ -1,9 +1,9 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.persistence.room.*
import android.os.Parcel
import android.os.Parcelable
import de.nicidienase.chaosflix.common.entities.recording.Recording
import de.nicidienase.chaosflix.common.mediadata.entities.recording.Recording
@Entity(tableName = "recording",
foreignKeys = arrayOf(ForeignKey(

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.persistence.room.Entity
import android.arch.persistence.room.ForeignKey
@ -6,7 +6,7 @@ import android.arch.persistence.room.Ignore
import android.arch.persistence.room.PrimaryKey
import android.os.Parcel
import android.os.Parcelable
import de.nicidienase.chaosflix.common.entities.recording.RelatedEvent
import de.nicidienase.chaosflix.common.mediadata.entities.recording.RelatedEvent
@Entity(tableName = "related",
foreignKeys = arrayOf(ForeignKey(

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.lifecycle.LiveData
import android.arch.persistence.room.Dao

View file

@ -1,8 +1,8 @@
package de.nicidienase.chaosflix.common.entities.recording.persistence
package de.nicidienase.chaosflix.common.mediadata.entities.recording.persistence
import android.arch.lifecycle.LiveData
import android.arch.persistence.room.*
import de.nicidienase.chaosflix.common.entities.recording.RelatedEvent
import de.nicidienase.chaosflix.common.mediadata.entities.recording.RelatedEvent
@Dao
interface RelatedEventDao: PersistentItemDao<RelatedEvent> {

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.streaming
package de.nicidienase.chaosflix.common.mediadata.entities.streaming
import android.arch.persistence.room.Entity
import com.fasterxml.jackson.annotation.JsonIgnoreProperties

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.streaming
package de.nicidienase.chaosflix.common.mediadata.entities.streaming
import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import kotlin.collections.ArrayList

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.streaming
package de.nicidienase.chaosflix.common.mediadata.entities.streaming
import android.os.Parcel
import android.os.Parcelable

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.streaming
package de.nicidienase.chaosflix.common.mediadata.entities.streaming
import android.os.Parcel
import android.os.Parcelable

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.streaming
package de.nicidienase.chaosflix.common.mediadata.entities.streaming
import android.os.Parcel
import android.os.Parcelable

View file

@ -1,14 +1,14 @@
package de.nicidienase.chaosflix.common.network
package de.nicidienase.chaosflix.common.mediadata.network
import de.nicidienase.chaosflix.common.entities.recording.Conference
import de.nicidienase.chaosflix.common.entities.recording.ConferencesWrapper
import de.nicidienase.chaosflix.common.entities.recording.Event
import de.nicidienase.chaosflix.common.entities.recording.Recording
import de.nicidienase.chaosflix.common.mediadata.entities.recording.Conference
import de.nicidienase.chaosflix.common.mediadata.entities.recording.ConferencesWrapper
import de.nicidienase.chaosflix.common.mediadata.entities.recording.Event
import de.nicidienase.chaosflix.common.mediadata.entities.recording.Recording
import io.reactivex.Single
import retrofit2.http.GET
import retrofit2.http.Path
interface RecordingService {
public interface RecordingService {
@GET("public/conferences")
fun getConferencesWrapper(): Single<ConferencesWrapper>

View file

@ -1,11 +1,11 @@
package de.nicidienase.chaosflix.common.network
package de.nicidienase.chaosflix.common.mediadata.network
import de.nicidienase.chaosflix.common.entities.streaming.LiveConference
import de.nicidienase.chaosflix.common.mediadata.entities.streaming.LiveConference
import io.reactivex.Flowable
import io.reactivex.Single
import retrofit2.http.GET
interface StreamingService {
public interface StreamingService {
@GET("streams/v2.json")
fun getStreamingConferences(): Single<List<LiveConference>>

View file

@ -0,0 +1,21 @@
package de.nicidienase.chaosflix.common.userdata
import android.arch.persistence.room.Database
import android.arch.persistence.room.RoomDatabase
import de.nicidienase.chaosflix.common.userdata.entities.download.*
import de.nicidienase.chaosflix.common.userdata.entities.progress.PlaybackProgress
import de.nicidienase.chaosflix.common.userdata.entities.progress.PlaybackProgressDao
import de.nicidienase.chaosflix.common.userdata.entities.watchlist.WatchlistItem
import de.nicidienase.chaosflix.common.userdata.entities.watchlist.WatchlistItemDao
@Database(entities = arrayOf(
PlaybackProgress::class,
WatchlistItem::class,
OfflineEvent::class), version = 1, exportSchema = true)
abstract class UserDatabase : RoomDatabase() {
abstract fun playbackProgressDao(): PlaybackProgressDao
abstract fun watchlistItemDao(): WatchlistItemDao
abstract fun offlineEventDao(): OfflineEventDao
}

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.download
package de.nicidienase.chaosflix.common.userdata.entities.download
import android.arch.persistence.room.*
import de.nicidienase.chaosflix.common.entities.recording.persistence.PersistentEvent

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.download
package de.nicidienase.chaosflix.common.userdata.entities.download
import android.arch.lifecycle.LiveData
import android.arch.persistence.room.Dao

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.userdata
package de.nicidienase.chaosflix.common.userdata.entities.progress
import android.arch.persistence.room.ColumnInfo
import android.arch.persistence.room.Entity

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.userdata
package de.nicidienase.chaosflix.common.userdata.entities.progress
import android.arch.lifecycle.LiveData
import android.arch.persistence.room.Dao

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.userdata
package de.nicidienase.chaosflix.common.userdata.entities.watchlist
import android.arch.persistence.room.ColumnInfo
import android.arch.persistence.room.Entity

View file

@ -1,4 +1,4 @@
package de.nicidienase.chaosflix.common.entities.userdata
package de.nicidienase.chaosflix.common.userdata.entities.watchlist
import android.arch.lifecycle.LiveData
import android.arch.persistence.room.*

View file

@ -1,12 +1,7 @@
package de.nicidienase.chaosflix.common
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.KotlinModule
import com.google.gson.Gson
import de.nicidienase.chaosflix.common.entities.recording.ConferencesWrapper
import de.nicidienase.chaosflix.common.entities.recording.persistence.PersistentConference
import de.nicidienase.chaosflix.common.entities.recording.persistence.PersistentEvent
import de.nicidienase.chaosflix.common.network.RecordingService
import junit.framework.Assert.assertNotNull
import okhttp3.OkHttpClient
import org.junit.Before