From 0e194faee7c632431b1514813b88b6532b96709d Mon Sep 17 00:00:00 2001 From: dankito Date: Mon, 20 Jul 2020 15:45:21 +0200 Subject: [PATCH] Made all properties overridable --- .../dankito/banking/ui/model/BankAccount.kt | 13 +------ .../net/dankito/banking/ui/model/Customer.kt | 38 +++++++++---------- 2 files changed, 21 insertions(+), 30 deletions(-) diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt index 1c0c31a0..7034c8d4 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/BankAccount.kt @@ -1,14 +1,11 @@ package net.dankito.banking.ui.model -//import com.fasterxml.jackson.annotation.JsonIdentityInfo -//import com.fasterxml.jackson.annotation.ObjectIdGenerators import net.dankito.utils.multiplatform.BigDecimal import net.dankito.utils.multiplatform.Date import net.dankito.utils.multiplatform.UUID import kotlin.jvm.JvmOverloads -//@JsonIdentityInfo(property = "id", generator = ObjectIdGenerators.PropertyGenerator::class) // to avoid stack overflow due to circular references open class BankAccount @JvmOverloads constructor( open val customer: Customer, open val identifier: String, @@ -26,7 +23,8 @@ open class BankAccount @JvmOverloads constructor( open var supportsRetrievingBalance: Boolean = false, open var supportsTransferringMoney: Boolean = false, open var supportsInstantPaymentMoneyTransfer: Boolean = false, - bookedAccountTransactions: List = listOf() + open var bookedTransactions: List = listOf(), + open var unbookedTransactions: List = listOf() ) { internal constructor() : this(Customer(), null, "") // for object deserializers @@ -58,13 +56,6 @@ open class BankAccount @JvmOverloads constructor( get() = "${customer.bankName} ${displayName}" - open var bookedTransactions: List = bookedAccountTransactions - protected set - - open var unbookedTransactions: List = listOf() - protected set - - open fun addBookedTransactions(retrievedBookedTransactions: List) { val uniqueTransactions = this.bookedTransactions.toMutableSet() diff --git a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt index 1302007b..e92845ce 100644 --- a/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt +++ b/ui/BankingUiCommon/src/commonMain/kotlin/net/dankito/banking/ui/model/Customer.kt @@ -3,25 +3,25 @@ package net.dankito.banking.ui.model //import com.fasterxml.jackson.annotation.JsonIdentityInfo //import com.fasterxml.jackson.annotation.ObjectIdGenerators import net.dankito.utils.multiplatform.BigDecimal -import net.dankito.utils.multiplatform.UUID import net.dankito.utils.multiplatform.sum import net.dankito.banking.ui.model.tan.TanMedium import net.dankito.banking.ui.model.tan.TanMediumStatus import net.dankito.banking.ui.model.tan.TanProcedure +import net.dankito.utils.multiplatform.UUID //@JsonIdentityInfo(property = "id", generator = ObjectIdGenerators.PropertyGenerator::class) // to avoid stack overflow due to circular references open class Customer( - val bankCode: String, - val customerId: String, - var password: String, - var finTsServerAddress: String, - var bankName: String, - var bic: String, - var customerName: String, - var userId: String = customerId, - var iconUrl: String? = null, - var accounts: List = listOf() + open val bankCode: String, + open val customerId: String, + open var password: String, + open var finTsServerAddress: String, + open var bankName: String, + open var bic: String, + open var customerName: String, + open var userId: String = customerId, + open var iconUrl: String? = null, + open var accounts: List = listOf() ) { @@ -33,26 +33,26 @@ open class Customer( : this(bankCode, customerId, password, finTsServerAddress, "", "", "") - var id: String = UUID.random() + open var id: String = UUID.random() - var supportedTanProcedures: List = listOf() + open var supportedTanProcedures: List = listOf() - var selectedTanProcedure: TanProcedure? = null + open var selectedTanProcedure: TanProcedure? = null - var tanMedia: List = listOf() + open var tanMedia: List = listOf() - val tanMediaSorted: List + open val tanMediaSorted: List get() = tanMedia.sortedByDescending { it.status == TanMediumStatus.Used } - val displayName: String + open val displayName: String get() = bankName - val balance: BigDecimal + open val balance: BigDecimal get() = accounts.map { it.balance }.sum() - val transactions: List + open val transactions: List get() = accounts.flatMap { it.bookedTransactions }