Made all properties overridable

This commit is contained in:
dankito 2020-06-24 20:26:03 +02:00
parent 81515d1125
commit ec435c1191
2 changed files with 58 additions and 62 deletions

View File

@ -10,43 +10,43 @@ import java.util.*
@JsonIdentityInfo(property = "id", generator = ObjectIdGenerators.PropertyGenerator::class) // to avoid stack overflow due to circular references @JsonIdentityInfo(property = "id", generator = ObjectIdGenerators.PropertyGenerator::class) // to avoid stack overflow due to circular references
open class AccountTransaction( open class AccountTransaction(
val bankAccount: BankAccount, open val bankAccount: BankAccount,
val amount: BigDecimal, open val amount: BigDecimal,
val currency: String, open val currency: String,
val unparsedUsage: String, open val unparsedUsage: String,
val bookingDate: Date, open val bookingDate: Date,
val otherPartyName: String?, open val otherPartyName: String?,
val otherPartyBankCode: String?, open val otherPartyBankCode: String?,
val otherPartyAccountId: String?, open val otherPartyAccountId: String?,
val bookingText: String?, open val bookingText: String?,
val valueDate: Date, open val valueDate: Date,
val statementNumber: Int, open val statementNumber: Int,
val sequenceNumber: Int?, open val sequenceNumber: Int?,
val openingBalance: BigDecimal?, open val openingBalance: BigDecimal?,
val closingBalance: BigDecimal?, open val closingBalance: BigDecimal?,
val endToEndReference: String?, open val endToEndReference: String?,
val customerReference: String?, open val customerReference: String?,
val mandateReference: String?, open val mandateReference: String?,
val creditorIdentifier: String?, open val creditorIdentifier: String?,
val originatorsIdentificationCode: String?, open val originatorsIdentificationCode: String?,
val compensationAmount: String?, open val compensationAmount: String?,
val originalAmount: String?, open val originalAmount: String?,
val sepaUsage: String?, open val sepaUsage: String?,
val deviantOriginator: String?, open val deviantOriginator: String?,
val deviantRecipient: String?, open val deviantRecipient: String?,
val usageWithNoSpecialType: String?, open val usageWithNoSpecialType: String?,
val primaNotaNumber: String?, open val primaNotaNumber: String?,
val textKeySupplement: String?, open val textKeySupplement: String?,
val currencyType: String?, open val currencyType: String?,
val bookingKey: String, open val bookingKey: String,
val referenceForTheAccountOwner: String, open val referenceForTheAccountOwner: String,
val referenceOfTheAccountServicingInstitution: String?, open val referenceOfTheAccountServicingInstitution: String?,
val supplementaryDetails: String?, open val supplementaryDetails: String?,
val transactionReferenceNumber: String, open val transactionReferenceNumber: String,
val relatedReferenceNumber: String? open val relatedReferenceNumber: String?
) { ) {
companion object { companion object {
@ -66,14 +66,11 @@ open class AccountTransaction(
null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,
null, "", "", null, null, "", null) null, "", "", null, null, "", null)
open var id: String = "${bankAccount.id} ${IdDateFormat.format(bookingDate)} ${IdDateFormat.format(valueDate)} $amount $currency $unparsedUsage $otherPartyName $otherPartyBankCode $otherPartyAccountId"
var id: String = "${bankAccount.id} ${IdDateFormat.format(bookingDate)} ${IdDateFormat.format(valueDate)} $amount $currency $unparsedUsage $otherPartyName $otherPartyBankCode $otherPartyAccountId" open val showOtherPartyName: Boolean
val showOtherPartyName: Boolean
get() = otherPartyName.isNullOrBlank() == false /* && type != "ENTGELTABSCHLUSS" && type != "AUSZAHLUNG" */ // TODO get() = otherPartyName.isNullOrBlank() == false /* && type != "ENTGELTABSCHLUSS" && type != "AUSZAHLUNG" */ // TODO
open val usage: String
val usage: String
get() = sepaUsage ?: unparsedUsage get() = sepaUsage ?: unparsedUsage

View File

@ -8,33 +8,32 @@ import java.util.*
@JsonIdentityInfo(property = "id", generator = ObjectIdGenerators.PropertyGenerator::class) // to avoid stack overflow due to circular references @JsonIdentityInfo(property = "id", generator = ObjectIdGenerators.PropertyGenerator::class) // to avoid stack overflow due to circular references
open class BankAccount @JvmOverloads constructor( open class BankAccount @JvmOverloads constructor(
val customer: Customer, open val customer: Customer,
val identifier: String, open val identifier: String,
var accountHolderName: String, open var accountHolderName: String,
var iban: String?, open var iban: String?,
var subAccountNumber: String?, open var subAccountNumber: String?,
val customerId: String, open val customerId: String,
var balance: BigDecimal = BigDecimal.ZERO, open var balance: BigDecimal = BigDecimal.ZERO,
var currency: String = "EUR", open var currency: String = "EUR",
var type: BankAccountType = BankAccountType.Girokonto, open var type: BankAccountType = BankAccountType.Girokonto,
val productName: String? = null, open val productName: String? = null,
val accountLimit: String? = null, open val accountLimit: String? = null,
var lastRetrievedTransactionsTimestamp: Date? = null, open var lastRetrievedTransactionsTimestamp: Date? = null,
var supportsRetrievingAccountTransactions: Boolean = false, open var supportsRetrievingAccountTransactions: Boolean = false,
var supportsRetrievingBalance: Boolean = false, open var supportsRetrievingBalance: Boolean = false,
var supportsTransferringMoney: Boolean = false, open var supportsTransferringMoney: Boolean = false,
var supportsInstantPaymentMoneyTransfer: Boolean = false, open var supportsInstantPaymentMoneyTransfer: Boolean = false,
bookedAccountTransactions: List<AccountTransaction> = listOf() bookedAccountTransactions: List<AccountTransaction> = listOf()
) { ) {
internal constructor() : this(Customer(), "", "", null, null, "") // for object deserializers internal constructor() : this(Customer(), "", "", null, null, "") // for object deserializers
var id: String = UUID.randomUUID().toString() open var id: String = UUID.randomUUID().toString()
protected set
val displayName: String open val displayName: String
get() { get() {
val productName = productName ?: subAccountNumber val productName = productName ?: subAccountNumber
@ -46,14 +45,14 @@ open class BankAccount @JvmOverloads constructor(
return identifier return identifier
} }
val displayNameIncludingBankName: String open val displayNameIncludingBankName: String
get() = "${customer.bank.name} ${displayName}" get() = "${customer.bank.name} ${displayName}"
var bookedTransactions: List<AccountTransaction> = bookedAccountTransactions open var bookedTransactions: List<AccountTransaction> = bookedAccountTransactions
protected set protected set
var unbookedTransactions: List<Any> = listOf() open var unbookedTransactions: List<Any> = listOf()
protected set protected set