|
|
|
@ -3,6 +3,7 @@ package net.pokeranalytics.android.model.realm |
|
|
|
import io.realm.RealmObject |
|
|
|
import io.realm.RealmObject |
|
|
|
import io.realm.annotations.PrimaryKey |
|
|
|
import io.realm.annotations.PrimaryKey |
|
|
|
import io.realm.kotlin.where |
|
|
|
import io.realm.kotlin.where |
|
|
|
|
|
|
|
import net.pokeranalytics.android.R |
|
|
|
import net.pokeranalytics.android.model.interfaces.ManageableStatus |
|
|
|
import net.pokeranalytics.android.model.interfaces.ManageableStatus |
|
|
|
import net.pokeranalytics.android.model.interfaces.NameManageable |
|
|
|
import net.pokeranalytics.android.model.interfaces.NameManageable |
|
|
|
import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource |
|
|
|
import net.pokeranalytics.android.ui.adapter.StaticRowRepresentableDataSource |
|
|
|
@ -57,16 +58,12 @@ open class TournamentName : RealmObject(), NameManageable, StaticRowRepresentabl |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun getFailedSaveMessage(status: ManageableStatus): Int { |
|
|
|
override fun getFailedSaveMessage(status: ManageableStatus): Int { |
|
|
|
//TODO if (status == ManageableStatus.DATA_INVALID) R.string.tournament_name_empty_field_error |
|
|
|
if (status == ManageableStatus.DATA_INVALID) R.string.tournament_name_empty_field_error |
|
|
|
//TODO else if (status == ManageableStatus.ALREADY_EXISTS) R.string.duplicate_tournament_name_error |
|
|
|
else if (status == ManageableStatus.ALREADY_EXISTS) R.string.duplicate_tournament_name_error |
|
|
|
return super.getFailedSaveMessage(status) |
|
|
|
return super.getFailedSaveMessage(status) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun isValidForDelete(): Boolean { |
|
|
|
override fun isValidForDelete(): Boolean { |
|
|
|
return this.realm.where<Session>().equalTo("tournamentName.id", id).findAll().isEmpty() |
|
|
|
return this.realm.where<Session>().equalTo("tournamentName.id", id).findAll().isEmpty() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun getFailedDeleteMessage(): Int { |
|
|
|
|
|
|
|
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|