From 5bb38e455ca4268500856ab36224c437cd18c860 Mon Sep 17 00:00:00 2001 From: Shams Asari Date: Tue, 15 Jan 2019 18:52:58 +0000 Subject: [PATCH] Add back V3 TransactionBuilder c'tor (#4587) --- .../corda/core/transactions/TransactionBuilder.kt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt b/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt index 599d9e9755..b1799233e7 100644 --- a/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt +++ b/core/src/main/kotlin/net/corda/core/transactions/TransactionBuilder.kt @@ -42,7 +42,7 @@ import kotlin.collections.component2 @DeleteForDJVM open class TransactionBuilder( var notary: Party? = null, - var lockId: UUID = (Strand.currentStrand() as? FlowStateMachine<*>)?.id?.uuid ?: UUID.randomUUID(), + var lockId: UUID = defaultLockId(), protected val inputs: MutableList = arrayListOf(), protected val attachments: MutableList = arrayListOf(), protected val outputs: MutableList> = arrayListOf(), @@ -52,9 +52,20 @@ open class TransactionBuilder( protected val references: MutableList = arrayListOf(), protected val serviceHub: ServiceHub? = (Strand.currentStrand() as? FlowStateMachine<*>)?.serviceHub ) { + constructor(notary: Party? = null, + lockId: UUID = defaultLockId(), + inputs: MutableList = arrayListOf(), + attachments: MutableList = arrayListOf(), + outputs: MutableList> = arrayListOf(), + commands: MutableList> = arrayListOf(), + window: TimeWindow? = null, + privacySalt: PrivacySalt = PrivacySalt() + ) : this(notary, lockId, inputs, attachments, outputs, commands, window, privacySalt, arrayListOf()) + constructor(notary: Party) : this(notary, window = null) private companion object { + private fun defaultLockId() = (Strand.currentStrand() as? FlowStateMachine<*>)?.id?.uuid ?: UUID.randomUUID() private val log = contextLogger() private const val CORDA_VERSION_THAT_INTRODUCED_FLATTENED_COMMANDS = 4 }