mirror of
https://github.com/corda/corda.git
synced 2025-06-01 15:10:54 +00:00
CORDA-2403: Flagged API issues between 4.0 and 3.3. (#4541)
This commit is contained in:
parent
76182f29d3
commit
05ffb3d101
@ -1057,7 +1057,7 @@ public interface net.corda.core.cordapp.Cordapp
|
|||||||
public abstract java.util.List<Class<? extends net.corda.core.serialization.SerializeAsToken>> getServices()
|
public abstract java.util.List<Class<? extends net.corda.core.serialization.SerializeAsToken>> getServices()
|
||||||
##
|
##
|
||||||
public final class net.corda.core.cordapp.CordappContext extends java.lang.Object
|
public final class net.corda.core.cordapp.CordappContext extends java.lang.Object
|
||||||
public <init>(net.corda.core.cordapp.Cordapp, net.corda.core.crypto.SecureHash, ClassLoader, net.corda.core.cordapp.CordappConfig)
|
public <init>(net.corda.core.cordapp.Cordapp, net.corda.core.crypto.SecureHash, ClassLoader)
|
||||||
@Nullable
|
@Nullable
|
||||||
public final net.corda.core.crypto.SecureHash getAttachmentId()
|
public final net.corda.core.crypto.SecureHash getAttachmentId()
|
||||||
@NotNull
|
@NotNull
|
||||||
@ -3463,10 +3463,6 @@ public static final class net.corda.core.node.services.vault.AttachmentQueryCrit
|
|||||||
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>)
|
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>)
|
||||||
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<String>)
|
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<String>)
|
||||||
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<java.time.Instant>)
|
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<java.time.Instant>)
|
||||||
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<java.time.Instant>, net.corda.core.node.services.vault.ColumnPredicate<java.util.List<String>>)
|
|
||||||
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<java.time.Instant>, net.corda.core.node.services.vault.ColumnPredicate<java.util.List<String>>, net.corda.core.node.services.vault.ColumnPredicate<java.util.List<java.security.PublicKey>>)
|
|
||||||
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<java.time.Instant>, net.corda.core.node.services.vault.ColumnPredicate<java.util.List<String>>, net.corda.core.node.services.vault.ColumnPredicate<java.util.List<java.security.PublicKey>>, net.corda.core.node.services.vault.ColumnPredicate<Boolean>)
|
|
||||||
public <init>(net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<String>, net.corda.core.node.services.vault.ColumnPredicate<java.time.Instant>, net.corda.core.node.services.vault.ColumnPredicate<java.util.List<String>>, net.corda.core.node.services.vault.ColumnPredicate<java.util.List<java.security.PublicKey>>, net.corda.core.node.services.vault.ColumnPredicate<Boolean>, net.corda.core.node.services.vault.ColumnPredicate<Integer>)
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public final net.corda.core.node.services.vault.ColumnPredicate<String> component1()
|
public final net.corda.core.node.services.vault.ColumnPredicate<String> component1()
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
package net.corda.core.contracts
|
package net.corda.core.contracts
|
||||||
|
|
||||||
|
import net.corda.core.CordaInternal
|
||||||
import net.corda.core.KeepForDJVM
|
import net.corda.core.KeepForDJVM
|
||||||
import net.corda.core.internal.cordapp.CordappImpl.Companion.DEFAULT_CORDAPP_VERSION
|
import net.corda.core.internal.cordapp.CordappImpl.Companion.DEFAULT_CORDAPP_VERSION
|
||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
import java.security.PublicKey
|
import java.security.PublicKey
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrap an attachment in this if it is to be used as an executable contract attachment
|
* An [Attachment] which represents a contract JAR.
|
||||||
*
|
*
|
||||||
* @property attachment The attachment representing the contract JAR
|
* @property attachment The attachment representing the contract JAR
|
||||||
* @property contract The contract name contained within the JAR. A Contract attachment has to contain at least 1 contract.
|
* @property contract The contract name contained within the JAR. A Contract attachment has to contain at least 1 contract.
|
||||||
@ -14,13 +15,31 @@ import java.security.PublicKey
|
|||||||
*/
|
*/
|
||||||
@KeepForDJVM
|
@KeepForDJVM
|
||||||
@CordaSerializable
|
@CordaSerializable
|
||||||
class ContractAttachment @JvmOverloads constructor(
|
class ContractAttachment private constructor(
|
||||||
val attachment: Attachment,
|
val attachment: Attachment,
|
||||||
val contract: ContractClassName,
|
val contract: ContractClassName,
|
||||||
val additionalContracts: Set<ContractClassName> = emptySet(),
|
val additionalContracts: Set<ContractClassName>,
|
||||||
val uploader: String? = null,
|
val uploader: String?,
|
||||||
override val signerKeys: List<PublicKey> = emptyList(),
|
override val signerKeys: List<PublicKey>,
|
||||||
val version: Int = DEFAULT_CORDAPP_VERSION) : Attachment by attachment {
|
val version: Int
|
||||||
|
) : Attachment by attachment {
|
||||||
|
@JvmOverloads
|
||||||
|
constructor(attachment: Attachment,
|
||||||
|
contract: ContractClassName,
|
||||||
|
additionalContracts: Set<ContractClassName> = emptySet(),
|
||||||
|
uploader: String? = null) : this(attachment, contract, additionalContracts, uploader, emptyList(), DEFAULT_CORDAPP_VERSION)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@CordaInternal
|
||||||
|
fun create(attachment: Attachment,
|
||||||
|
contract: ContractClassName,
|
||||||
|
additionalContracts: Set<ContractClassName> = emptySet(),
|
||||||
|
uploader: String? = null,
|
||||||
|
signerKeys: List<PublicKey> = emptyList(),
|
||||||
|
version: Int = DEFAULT_CORDAPP_VERSION): ContractAttachment {
|
||||||
|
return ContractAttachment(attachment, contract, additionalContracts, uploader, signerKeys, version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val allContracts: Set<ContractClassName> get() = additionalContracts + contract
|
val allContracts: Set<ContractClassName> get() = additionalContracts + contract
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package net.corda.core.cordapp
|
package net.corda.core.cordapp
|
||||||
|
|
||||||
|
import net.corda.core.CordaInternal
|
||||||
import net.corda.core.DeleteForDJVM
|
import net.corda.core.DeleteForDJVM
|
||||||
import net.corda.core.crypto.SecureHash
|
import net.corda.core.crypto.SecureHash
|
||||||
|
import java.lang.UnsupportedOperationException
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An app context provides information about where an app was loaded from, access to its classloader,
|
* An app context provides information about where an app was loaded from, access to its classloader,
|
||||||
@ -17,9 +19,45 @@ import net.corda.core.crypto.SecureHash
|
|||||||
* @property config Configuration for this CorDapp
|
* @property config Configuration for this CorDapp
|
||||||
*/
|
*/
|
||||||
@DeleteForDJVM
|
@DeleteForDJVM
|
||||||
class CordappContext internal constructor(
|
class CordappContext private constructor(
|
||||||
val cordapp: Cordapp,
|
val cordapp: Cordapp,
|
||||||
val attachmentId: SecureHash?,
|
val attachmentId: SecureHash?,
|
||||||
val classLoader: ClassLoader,
|
val classLoader: ClassLoader,
|
||||||
val config: CordappConfig
|
val config: CordappConfig
|
||||||
)
|
) {
|
||||||
|
companion object {
|
||||||
|
@CordaInternal
|
||||||
|
fun create(cordapp: Cordapp, attachmentId: SecureHash?, classLoader: ClassLoader, config: CordappConfig): CordappContext {
|
||||||
|
return CordappContext(cordapp, attachmentId, classLoader, config)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("CordappContexts should not be created. Instead retrieve them using `CordappProvider.getAppContext()`.")
|
||||||
|
constructor(
|
||||||
|
cordapp: Cordapp,
|
||||||
|
attachmentId: SecureHash?,
|
||||||
|
classLoader: ClassLoader
|
||||||
|
) : this(cordapp, attachmentId, classLoader, EmptyCordappConfig)
|
||||||
|
|
||||||
|
private object EmptyCordappConfig : CordappConfig {
|
||||||
|
override fun exists(path: String): Boolean {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun get(path: String) = throw CordappConfigException("Cordapp configuration is incorrect", UnsupportedOperationException())
|
||||||
|
|
||||||
|
override fun getInt(path: String) = throw CordappConfigException("Cordapp configuration is incorrect", UnsupportedOperationException())
|
||||||
|
|
||||||
|
override fun getLong(path: String) = throw CordappConfigException("Cordapp configuration is incorrect", UnsupportedOperationException())
|
||||||
|
|
||||||
|
override fun getFloat(path: String) = throw CordappConfigException("Cordapp configuration is incorrect", UnsupportedOperationException())
|
||||||
|
|
||||||
|
override fun getDouble(path: String) = throw CordappConfigException("Cordapp configuration is incorrect", UnsupportedOperationException())
|
||||||
|
|
||||||
|
override fun getNumber(path: String) = throw CordappConfigException("Cordapp configuration is incorrect", UnsupportedOperationException())
|
||||||
|
|
||||||
|
override fun getString(path: String) = throw CordappConfigException("Cordapp configuration is incorrect", UnsupportedOperationException())
|
||||||
|
|
||||||
|
override fun getBoolean(path: String) = throw CordappConfigException("Cordapp configuration is incorrect", UnsupportedOperationException())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -3,10 +3,6 @@ package net.corda.core.internal
|
|||||||
import net.corda.core.DeleteForDJVM
|
import net.corda.core.DeleteForDJVM
|
||||||
import net.corda.core.contracts.ContractAttachment
|
import net.corda.core.contracts.ContractAttachment
|
||||||
import net.corda.core.contracts.ContractClassName
|
import net.corda.core.contracts.ContractClassName
|
||||||
import net.corda.core.cordapp.Cordapp
|
|
||||||
import net.corda.core.cordapp.CordappConfig
|
|
||||||
import net.corda.core.cordapp.CordappContext
|
|
||||||
import net.corda.core.crypto.SecureHash
|
|
||||||
import net.corda.core.flows.DataVendingFlow
|
import net.corda.core.flows.DataVendingFlow
|
||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
import net.corda.core.node.NetworkParameters
|
import net.corda.core.node.NetworkParameters
|
||||||
@ -19,16 +15,12 @@ import net.corda.core.node.services.vault.Builder
|
|||||||
import net.corda.core.node.services.vault.Sort
|
import net.corda.core.node.services.vault.Sort
|
||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
import net.corda.core.serialization.SerializationContext
|
import net.corda.core.serialization.SerializationContext
|
||||||
import net.corda.core.serialization.internal.AttachmentsClassLoaderBuilder
|
|
||||||
import net.corda.core.transactions.LedgerTransaction
|
import net.corda.core.transactions.LedgerTransaction
|
||||||
import net.corda.core.transactions.SignedTransaction
|
import net.corda.core.transactions.SignedTransaction
|
||||||
import net.corda.core.transactions.TransactionBuilder
|
import net.corda.core.transactions.TransactionBuilder
|
||||||
import net.corda.core.transactions.WireTransaction
|
import net.corda.core.transactions.WireTransaction
|
||||||
import org.slf4j.Logger
|
|
||||||
import org.slf4j.LoggerFactory
|
|
||||||
import org.slf4j.MDC
|
import org.slf4j.MDC
|
||||||
import java.security.PublicKey
|
import java.security.PublicKey
|
||||||
import java.util.jar.JarEntry
|
|
||||||
import java.util.jar.JarInputStream
|
import java.util.jar.JarInputStream
|
||||||
|
|
||||||
// *Internal* Corda-specific utilities.
|
// *Internal* Corda-specific utilities.
|
||||||
@ -61,10 +53,6 @@ fun TransactionBuilder.toLedgerTransaction(services: ServicesForResolution, seri
|
|||||||
return toLedgerTransactionWithContext(services, serializationContext)
|
return toLedgerTransactionWithContext(services, serializationContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun createCordappContext(cordapp: Cordapp, attachmentId: SecureHash?, classLoader: ClassLoader, config: CordappConfig): CordappContext {
|
|
||||||
return CordappContext(cordapp, attachmentId, classLoader, config)
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Checks if this flow is an idempotent flow. */
|
/** Checks if this flow is an idempotent flow. */
|
||||||
fun Class<out FlowLogic<*>>.isIdempotentFlow(): Boolean {
|
fun Class<out FlowLogic<*>>.isIdempotentFlow(): Boolean {
|
||||||
return IdempotentFlow::class.java.isAssignableFrom(this)
|
return IdempotentFlow::class.java.isAssignableFrom(this)
|
||||||
|
@ -162,28 +162,39 @@ sealed class QueryCriteria : GenericQueryCriteria<QueryCriteria, IQueryCriteriaP
|
|||||||
/**
|
/**
|
||||||
* LinearStateQueryCriteria: provides query by attributes defined in [VaultSchema.VaultLinearState]
|
* LinearStateQueryCriteria: provides query by attributes defined in [VaultSchema.VaultLinearState]
|
||||||
*/
|
*/
|
||||||
data class LinearStateQueryCriteria @JvmOverloads constructor(
|
data class LinearStateQueryCriteria(
|
||||||
override val participants: List<AbstractParty>? = null,
|
override val participants: List<AbstractParty>?,
|
||||||
val uuid: List<UUID>? = null,
|
val uuid: List<UUID>? = null,
|
||||||
val externalId: List<String>? = null,
|
val externalId: List<String>? = null,
|
||||||
override val status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
override val status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
||||||
override val contractStateTypes: Set<Class<out ContractState>>? = null,
|
override val contractStateTypes: Set<Class<out ContractState>>? = null,
|
||||||
override val relevancyStatus: Vault.RelevancyStatus = Vault.RelevancyStatus.ALL
|
override val relevancyStatus: Vault.RelevancyStatus = Vault.RelevancyStatus.ALL
|
||||||
) : CommonQueryCriteria() {
|
) : CommonQueryCriteria() {
|
||||||
|
// V3 c'tor
|
||||||
|
@JvmOverloads
|
||||||
constructor(
|
constructor(
|
||||||
participants: List<AbstractParty>? = null,
|
participants: List<AbstractParty>? = null,
|
||||||
linearId: List<UniqueIdentifier>? = null,
|
uuid: List<UUID>? = null,
|
||||||
|
externalId: List<String>? = null,
|
||||||
status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
||||||
contractStateTypes: Set<Class<out ContractState>>? = null,
|
contractStateTypes: Set<Class<out ContractState>>? = null
|
||||||
relevancyStatus: Vault.RelevancyStatus
|
) : this(participants, uuid, externalId, status, contractStateTypes, Vault.RelevancyStatus.ALL)
|
||||||
) : this(participants, linearId?.map { it.id }, linearId?.mapNotNull { it.externalId }, status, contractStateTypes, relevancyStatus)
|
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
participants: List<AbstractParty>? = null,
|
||||||
|
linearId: List<UniqueIdentifier>? = null,
|
||||||
|
status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
||||||
|
contractStateTypes: Set<Class<out ContractState>>? = null,
|
||||||
|
relevancyStatus: Vault.RelevancyStatus = Vault.RelevancyStatus.ALL
|
||||||
|
) : this(participants, linearId?.map { it.id }, linearId?.mapNotNull { it.externalId }, status, contractStateTypes, relevancyStatus)
|
||||||
|
|
||||||
|
// V3 c'tor
|
||||||
constructor(
|
constructor(
|
||||||
participants: List<AbstractParty>? = null,
|
participants: List<AbstractParty>? = null,
|
||||||
linearId: List<UniqueIdentifier>? = null,
|
linearId: List<UniqueIdentifier>? = null,
|
||||||
status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
||||||
contractStateTypes: Set<Class<out ContractState>>? = null
|
contractStateTypes: Set<Class<out ContractState>>? = null
|
||||||
) : this(participants, linearId?.map { it.id }, linearId?.mapNotNull { it.externalId }, status, contractStateTypes)
|
) : this(participants, linearId, status, contractStateTypes, Vault.RelevancyStatus.ALL)
|
||||||
|
|
||||||
override fun visit(parser: IQueryCriteriaParser): Collection<Predicate> {
|
override fun visit(parser: IQueryCriteriaParser): Collection<Predicate> {
|
||||||
super.visit(parser)
|
super.visit(parser)
|
||||||
@ -202,7 +213,8 @@ sealed class QueryCriteria : GenericQueryCriteria<QueryCriteria, IQueryCriteriaP
|
|||||||
uuid,
|
uuid,
|
||||||
externalId,
|
externalId,
|
||||||
status,
|
status,
|
||||||
contractStateTypes
|
contractStateTypes,
|
||||||
|
relevancyStatus
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -226,7 +238,7 @@ sealed class QueryCriteria : GenericQueryCriteria<QueryCriteria, IQueryCriteriaP
|
|||||||
/**
|
/**
|
||||||
* FungibleStateQueryCriteria: provides query by attributes defined in [VaultSchema.VaultFungibleStates]
|
* FungibleStateQueryCriteria: provides query by attributes defined in [VaultSchema.VaultFungibleStates]
|
||||||
*/
|
*/
|
||||||
data class FungibleAssetQueryCriteria @JvmOverloads constructor(
|
data class FungibleAssetQueryCriteria constructor(
|
||||||
override val participants: List<AbstractParty>? = null,
|
override val participants: List<AbstractParty>? = null,
|
||||||
val owner: List<AbstractParty>? = null,
|
val owner: List<AbstractParty>? = null,
|
||||||
val quantity: ColumnPredicate<Long>? = null,
|
val quantity: ColumnPredicate<Long>? = null,
|
||||||
@ -234,8 +246,18 @@ sealed class QueryCriteria : GenericQueryCriteria<QueryCriteria, IQueryCriteriaP
|
|||||||
val issuerRef: List<OpaqueBytes>? = null,
|
val issuerRef: List<OpaqueBytes>? = null,
|
||||||
override val status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
override val status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
||||||
override val contractStateTypes: Set<Class<out ContractState>>? = null,
|
override val contractStateTypes: Set<Class<out ContractState>>? = null,
|
||||||
override val relevancyStatus: Vault.RelevancyStatus = Vault.RelevancyStatus.ALL
|
override val relevancyStatus: Vault.RelevancyStatus
|
||||||
) : CommonQueryCriteria() {
|
) : CommonQueryCriteria() {
|
||||||
|
@JvmOverloads constructor(
|
||||||
|
participants: List<AbstractParty>? = null,
|
||||||
|
owner: List<AbstractParty>? = null,
|
||||||
|
quantity: ColumnPredicate<Long>? = null,
|
||||||
|
issuer: List<AbstractParty>? = null,
|
||||||
|
issuerRef: List<OpaqueBytes>? = null,
|
||||||
|
status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
||||||
|
contractStateTypes: Set<Class<out ContractState>>? = null
|
||||||
|
) : this(participants, owner, quantity, issuer, issuerRef, status, contractStateTypes, Vault.RelevancyStatus.ALL)
|
||||||
|
|
||||||
override fun visit(parser: IQueryCriteriaParser): Collection<Predicate> {
|
override fun visit(parser: IQueryCriteriaParser): Collection<Predicate> {
|
||||||
super.visit(parser)
|
super.visit(parser)
|
||||||
return parser.parseCriteria(this)
|
return parser.parseCriteria(this)
|
||||||
@ -257,7 +279,8 @@ sealed class QueryCriteria : GenericQueryCriteria<QueryCriteria, IQueryCriteriaP
|
|||||||
issuer,
|
issuer,
|
||||||
issuerRef,
|
issuerRef,
|
||||||
status,
|
status,
|
||||||
contractStateTypes
|
contractStateTypes,
|
||||||
|
relevancyStatus
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -270,23 +293,17 @@ sealed class QueryCriteria : GenericQueryCriteria<QueryCriteria, IQueryCriteriaP
|
|||||||
* Params
|
* Params
|
||||||
* [expression] refers to a (composable) type safe [CriteriaExpression]
|
* [expression] refers to a (composable) type safe [CriteriaExpression]
|
||||||
*/
|
*/
|
||||||
data class VaultCustomQueryCriteria<L : StatePersistable> @JvmOverloads constructor(
|
data class VaultCustomQueryCriteria<L : StatePersistable> constructor(
|
||||||
val expression: CriteriaExpression<L, Boolean>,
|
val expression: CriteriaExpression<L, Boolean>,
|
||||||
override val status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
override val status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
||||||
override val contractStateTypes: Set<Class<out ContractState>>? = null
|
override val contractStateTypes: Set<Class<out ContractState>>? = null,
|
||||||
|
override val relevancyStatus: Vault.RelevancyStatus = Vault.RelevancyStatus.ALL
|
||||||
) : CommonQueryCriteria() {
|
) : CommonQueryCriteria() {
|
||||||
// These extra field is handled this way to preserve Kotlin wire compatibility wrt additional parameters with default values.
|
@JvmOverloads constructor(
|
||||||
constructor(
|
|
||||||
expression: CriteriaExpression<L, Boolean>,
|
expression: CriteriaExpression<L, Boolean>,
|
||||||
status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
status: Vault.StateStatus = Vault.StateStatus.UNCONSUMED,
|
||||||
contractStateTypes: Set<Class<out ContractState>>? = null,
|
contractStateTypes: Set<Class<out ContractState>>? = null
|
||||||
relevancyStatus: Vault.RelevancyStatus = Vault.RelevancyStatus.ALL
|
) : this(expression, status, contractStateTypes, Vault.RelevancyStatus.ALL)
|
||||||
) : this(expression, status, contractStateTypes) {
|
|
||||||
this.relevancyStatus = relevancyStatus
|
|
||||||
}
|
|
||||||
|
|
||||||
override var relevancyStatus: Vault.RelevancyStatus = Vault.RelevancyStatus.ALL
|
|
||||||
private set
|
|
||||||
|
|
||||||
override fun visit(parser: IQueryCriteriaParser): Collection<Predicate> {
|
override fun visit(parser: IQueryCriteriaParser): Collection<Predicate> {
|
||||||
super.visit(parser)
|
super.visit(parser)
|
||||||
@ -296,8 +313,7 @@ sealed class QueryCriteria : GenericQueryCriteria<QueryCriteria, IQueryCriteriaP
|
|||||||
fun copy(
|
fun copy(
|
||||||
expression: CriteriaExpression<L, Boolean> = this.expression,
|
expression: CriteriaExpression<L, Boolean> = this.expression,
|
||||||
status: Vault.StateStatus = this.status,
|
status: Vault.StateStatus = this.status,
|
||||||
contractStateTypes: Set<Class<out ContractState>>? = this.contractStateTypes,
|
contractStateTypes: Set<Class<out ContractState>>? = this.contractStateTypes
|
||||||
relevancyStatus: Vault.RelevancyStatus = this.relevancyStatus
|
|
||||||
): VaultCustomQueryCriteria<L> {
|
): VaultCustomQueryCriteria<L> {
|
||||||
return VaultCustomQueryCriteria(
|
return VaultCustomQueryCriteria(
|
||||||
expression,
|
expression,
|
||||||
@ -326,13 +342,20 @@ sealed class AttachmentQueryCriteria : GenericQueryCriteria<AttachmentQueryCrite
|
|||||||
/**
|
/**
|
||||||
* AttachmentsQueryCriteria:
|
* AttachmentsQueryCriteria:
|
||||||
*/
|
*/
|
||||||
data class AttachmentsQueryCriteria @JvmOverloads constructor(val uploaderCondition: ColumnPredicate<String>? = null,
|
data class AttachmentsQueryCriteria(val uploaderCondition: ColumnPredicate<String>? = null,
|
||||||
val filenameCondition: ColumnPredicate<String>? = null,
|
val filenameCondition: ColumnPredicate<String>? = null,
|
||||||
val uploadDateCondition: ColumnPredicate<Instant>? = null,
|
val uploadDateCondition: ColumnPredicate<Instant>? = null,
|
||||||
val contractClassNamesCondition: ColumnPredicate<List<ContractClassName>>? = null,
|
val contractClassNamesCondition: ColumnPredicate<List<ContractClassName>>? = null,
|
||||||
val signersCondition: ColumnPredicate<List<PublicKey>>? = null,
|
val signersCondition: ColumnPredicate<List<PublicKey>>? = null,
|
||||||
val isSignedCondition: ColumnPredicate<Boolean>? = null,
|
val isSignedCondition: ColumnPredicate<Boolean>? = null,
|
||||||
val versionCondition: ColumnPredicate<Int>? = null) : AttachmentQueryCriteria() {
|
val versionCondition: ColumnPredicate<Int>? = null) : AttachmentQueryCriteria() {
|
||||||
|
// V3 c'tors
|
||||||
|
constructor(uploaderCondition: ColumnPredicate<String>? = null,
|
||||||
|
filenameCondition: ColumnPredicate<String>? = null,
|
||||||
|
uploadDateCondition: ColumnPredicate<Instant>? = null) : this(uploaderCondition, filenameCondition, uploadDateCondition, null)
|
||||||
|
constructor(uploaderCondition: ColumnPredicate<String>?) : this(uploaderCondition, null)
|
||||||
|
constructor(uploaderCondition: ColumnPredicate<String>?, filenameCondition: ColumnPredicate<String>?) : this(uploaderCondition, filenameCondition, null)
|
||||||
|
|
||||||
override fun visit(parser: AttachmentsQueryCriteriaParser): Collection<Predicate> {
|
override fun visit(parser: AttachmentsQueryCriteriaParser): Collection<Predicate> {
|
||||||
return parser.parseCriteria(this)
|
return parser.parseCriteria(this)
|
||||||
}
|
}
|
||||||
@ -342,7 +365,15 @@ sealed class AttachmentQueryCriteria : GenericQueryCriteria<AttachmentQueryCrite
|
|||||||
filenameCondition: ColumnPredicate<String>? = this.filenameCondition,
|
filenameCondition: ColumnPredicate<String>? = this.filenameCondition,
|
||||||
uploadDateCondition: ColumnPredicate<Instant>? = this.uploadDateCondition
|
uploadDateCondition: ColumnPredicate<Instant>? = this.uploadDateCondition
|
||||||
): AttachmentsQueryCriteria {
|
): AttachmentsQueryCriteria {
|
||||||
return AttachmentsQueryCriteria(uploaderCondition, filenameCondition, uploadDateCondition)
|
return AttachmentsQueryCriteria(
|
||||||
|
uploaderCondition,
|
||||||
|
filenameCondition,
|
||||||
|
uploadDateCondition,
|
||||||
|
contractClassNamesCondition,
|
||||||
|
signersCondition,
|
||||||
|
isSignedCondition,
|
||||||
|
versionCondition
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun withUploader(uploaderPredicate: ColumnPredicate<String>) = copy(uploaderCondition = uploaderPredicate)
|
fun withUploader(uploaderPredicate: ColumnPredicate<String>) = copy(uploaderCondition = uploaderPredicate)
|
||||||
|
@ -264,7 +264,7 @@ data class ContractUpgradeLedgerTransaction(
|
|||||||
private fun verifyConstraints() {
|
private fun verifyConstraints() {
|
||||||
val attachmentForConstraintVerification = AttachmentWithContext(
|
val attachmentForConstraintVerification = AttachmentWithContext(
|
||||||
legacyContractAttachment as? ContractAttachment
|
legacyContractAttachment as? ContractAttachment
|
||||||
?: ContractAttachment(legacyContractAttachment, legacyContractClassName, signerKeys = legacyContractAttachment.signerKeys),
|
?: ContractAttachment.create(legacyContractAttachment, legacyContractClassName, signerKeys = legacyContractAttachment.signerKeys),
|
||||||
upgradedContract.legacyContract,
|
upgradedContract.legacyContract,
|
||||||
networkParameters)
|
networkParameters)
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ import kotlin.collections.component2
|
|||||||
* [TransactionState] with this notary specified will be generated automatically.
|
* [TransactionState] with this notary specified will be generated automatically.
|
||||||
*/
|
*/
|
||||||
@DeleteForDJVM
|
@DeleteForDJVM
|
||||||
open class TransactionBuilder @JvmOverloads constructor(
|
open class TransactionBuilder(
|
||||||
var notary: Party? = null,
|
var notary: Party? = null,
|
||||||
var lockId: UUID = (Strand.currentStrand() as? FlowStateMachine<*>)?.id?.uuid ?: UUID.randomUUID(),
|
var lockId: UUID = (Strand.currentStrand() as? FlowStateMachine<*>)?.id?.uuid ?: UUID.randomUUID(),
|
||||||
protected val inputs: MutableList<StateRef> = arrayListOf(),
|
protected val inputs: MutableList<StateRef> = arrayListOf(),
|
||||||
@ -48,39 +48,17 @@ open class TransactionBuilder @JvmOverloads constructor(
|
|||||||
protected val outputs: MutableList<TransactionState<ContractState>> = arrayListOf(),
|
protected val outputs: MutableList<TransactionState<ContractState>> = arrayListOf(),
|
||||||
protected val commands: MutableList<Command<*>> = arrayListOf(),
|
protected val commands: MutableList<Command<*>> = arrayListOf(),
|
||||||
protected var window: TimeWindow? = null,
|
protected var window: TimeWindow? = null,
|
||||||
protected var privacySalt: PrivacySalt = PrivacySalt()
|
protected var privacySalt: PrivacySalt = PrivacySalt(),
|
||||||
|
protected val references: MutableList<StateRef> = arrayListOf(),
|
||||||
|
protected val serviceHub: ServiceHub? = (Strand.currentStrand() as? FlowStateMachine<*>)?.serviceHub
|
||||||
) {
|
) {
|
||||||
|
constructor(notary: Party) : this(notary, window = null)
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
private val log = contextLogger()
|
private val log = contextLogger()
|
||||||
|
|
||||||
private fun defaultReferencesList(): MutableList<StateRef> = arrayListOf()
|
|
||||||
|
|
||||||
private fun defaultServiceHub(): ServiceHub? = (Strand.currentStrand() as? FlowStateMachine<*>)?.serviceHub
|
|
||||||
|
|
||||||
private const val CORDA_VERSION_THAT_INTRODUCED_FLATTENED_COMMANDS = 4
|
private const val CORDA_VERSION_THAT_INTRODUCED_FLATTENED_COMMANDS = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
|
||||||
notary: Party? = null,
|
|
||||||
lockId: UUID = (Strand.currentStrand() as? FlowStateMachine<*>)?.id?.uuid ?: UUID.randomUUID(),
|
|
||||||
inputs: MutableList<StateRef> = arrayListOf(),
|
|
||||||
attachments: MutableList<SecureHash> = arrayListOf(),
|
|
||||||
outputs: MutableList<TransactionState<ContractState>> = arrayListOf(),
|
|
||||||
commands: MutableList<Command<*>> = arrayListOf(),
|
|
||||||
window: TimeWindow? = null,
|
|
||||||
privacySalt: PrivacySalt = PrivacySalt(),
|
|
||||||
references: MutableList<StateRef> = defaultReferencesList(),
|
|
||||||
serviceHub: ServiceHub? = defaultServiceHub()
|
|
||||||
) : this(notary, lockId, inputs, attachments, outputs, commands, window, privacySalt) {
|
|
||||||
this.references = references
|
|
||||||
this.serviceHub = serviceHub
|
|
||||||
}
|
|
||||||
|
|
||||||
protected var references: MutableList<StateRef> = defaultReferencesList()
|
|
||||||
private set
|
|
||||||
protected var serviceHub: ServiceHub? = defaultServiceHub()
|
|
||||||
private set
|
|
||||||
|
|
||||||
private val inputsWithTransactionState = arrayListOf<StateAndRef<ContractState>>()
|
private val inputsWithTransactionState = arrayListOf<StateAndRef<ContractState>>()
|
||||||
private val referencesWithTransactionState = arrayListOf<TransactionState<ContractState>>()
|
private val referencesWithTransactionState = arrayListOf<TransactionState<ContractState>>()
|
||||||
|
|
||||||
@ -196,8 +174,8 @@ open class TransactionBuilder @JvmOverloads constructor(
|
|||||||
|
|
||||||
addAttachment(attachment.id)
|
addAttachment(attachment.id)
|
||||||
return true
|
return true
|
||||||
// Ignore these exceptions as they will break unit tests.
|
// Ignore these exceptions as they will break unit tests.
|
||||||
// The point here is only to detect missing dependencies. The other exceptions are irrelevant.
|
// The point here is only to detect missing dependencies. The other exceptions are irrelevant.
|
||||||
} catch (tve: TransactionVerificationException) {
|
} catch (tve: TransactionVerificationException) {
|
||||||
} catch (tre: TransactionResolutionException) {
|
} catch (tre: TransactionResolutionException) {
|
||||||
} catch (ise: IllegalStateException) {
|
} catch (ise: IllegalStateException) {
|
||||||
|
@ -48,7 +48,7 @@ import java.util.function.Predicate
|
|||||||
*/
|
*/
|
||||||
@CordaSerializable
|
@CordaSerializable
|
||||||
@KeepForDJVM
|
@KeepForDJVM
|
||||||
class WireTransaction(componentGroups: List<ComponentGroup>, val privacySalt: PrivacySalt) : TraversableTransaction(componentGroups) {
|
class WireTransaction(componentGroups: List<ComponentGroup>, val privacySalt: PrivacySalt = PrivacySalt()) : TraversableTransaction(componentGroups) {
|
||||||
@DeleteForDJVM
|
@DeleteForDJVM
|
||||||
constructor(componentGroups: List<ComponentGroup>) : this(componentGroups, PrivacySalt())
|
constructor(componentGroups: List<ComponentGroup>) : this(componentGroups, PrivacySalt())
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class TransactionBuilderTest {
|
|||||||
override val signerKeys: List<PublicKey> get() = emptyList()
|
override val signerKeys: List<PublicKey> get() = emptyList()
|
||||||
}, DummyContract.PROGRAM_ID)
|
}, DummyContract.PROGRAM_ID)
|
||||||
|
|
||||||
private fun signedAttachment(vararg parties: Party) = ContractAttachment(object : AbstractAttachment({ byteArrayOf() }) {
|
private fun signedAttachment(vararg parties: Party) = ContractAttachment.create(object : AbstractAttachment({ byteArrayOf() }) {
|
||||||
override val id: SecureHash get() = throw UnsupportedOperationException()
|
override val id: SecureHash get() = throw UnsupportedOperationException()
|
||||||
|
|
||||||
override val signerKeys: List<PublicKey> get() = parties.map { it.owningKey }
|
override val signerKeys: List<PublicKey> get() = parties.map { it.owningKey }
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package net.corda.node.internal.cordapp
|
package net.corda.node.internal.cordapp
|
||||||
|
|
||||||
import com.google.common.collect.HashBiMap
|
import com.google.common.collect.HashBiMap
|
||||||
import net.corda.core.contracts.ContractAttachment
|
|
||||||
import net.corda.core.contracts.ContractClassName
|
import net.corda.core.contracts.ContractClassName
|
||||||
import net.corda.core.cordapp.Cordapp
|
import net.corda.core.cordapp.Cordapp
|
||||||
import net.corda.core.cordapp.CordappContext
|
import net.corda.core.cordapp.CordappContext
|
||||||
@ -9,7 +8,6 @@ import net.corda.core.crypto.SecureHash
|
|||||||
import net.corda.core.flows.FlowLogic
|
import net.corda.core.flows.FlowLogic
|
||||||
import net.corda.core.internal.DEPLOYED_CORDAPP_UPLOADER
|
import net.corda.core.internal.DEPLOYED_CORDAPP_UPLOADER
|
||||||
import net.corda.core.internal.cordapp.CordappImpl
|
import net.corda.core.internal.cordapp.CordappImpl
|
||||||
import net.corda.core.internal.createCordappContext
|
|
||||||
import net.corda.core.node.services.AttachmentId
|
import net.corda.core.node.services.AttachmentId
|
||||||
import net.corda.core.node.services.AttachmentStorage
|
import net.corda.core.node.services.AttachmentStorage
|
||||||
import net.corda.core.serialization.SingletonSerializeAsToken
|
import net.corda.core.serialization.SingletonSerializeAsToken
|
||||||
@ -96,7 +94,7 @@ open class CordappProviderImpl(val cordappLoader: CordappLoader,
|
|||||||
*/
|
*/
|
||||||
fun getAppContext(cordapp: Cordapp): CordappContext {
|
fun getAppContext(cordapp: Cordapp): CordappContext {
|
||||||
return contextCache.computeIfAbsent(cordapp) {
|
return contextCache.computeIfAbsent(cordapp) {
|
||||||
createCordappContext(
|
CordappContext.create(
|
||||||
cordapp,
|
cordapp,
|
||||||
getCordappAttachmentId(cordapp),
|
getCordappAttachmentId(cordapp),
|
||||||
cordappLoader.appClassLoader,
|
cordappLoader.appClassLoader,
|
||||||
|
@ -235,7 +235,7 @@ object DefaultKryoCustomizer {
|
|||||||
override val id = attachmentHash
|
override val id = attachmentHash
|
||||||
}
|
}
|
||||||
|
|
||||||
return ContractAttachment(lazyAttachment, contract, additionalContracts, uploader, signers, version)
|
return ContractAttachment.create(lazyAttachment, contract, additionalContracts, uploader, signers, version)
|
||||||
} else {
|
} else {
|
||||||
val attachment = GeneratedAttachment(input.readBytesWithLength())
|
val attachment = GeneratedAttachment(input.readBytesWithLength())
|
||||||
val contract = input.readString()
|
val contract = input.readString()
|
||||||
@ -243,7 +243,7 @@ object DefaultKryoCustomizer {
|
|||||||
val uploader = input.readString()
|
val uploader = input.readString()
|
||||||
val signers = kryo.readClassAndObject(input) as List<PublicKey>
|
val signers = kryo.readClassAndObject(input) as List<PublicKey>
|
||||||
val version = input.readInt()
|
val version = input.readInt()
|
||||||
return ContractAttachment(attachment, contract, additionalContracts, uploader, signers, version)
|
return ContractAttachment.create(attachment, contract, additionalContracts, uploader, signers, version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ class NodeAttachmentService(
|
|||||||
val attachmentImpl = AttachmentImpl(id, { attachment.content }, checkAttachmentsOnLoad).let {
|
val attachmentImpl = AttachmentImpl(id, { attachment.content }, checkAttachmentsOnLoad).let {
|
||||||
val contracts = attachment.contractClassNames
|
val contracts = attachment.contractClassNames
|
||||||
if (contracts != null && contracts.isNotEmpty()) {
|
if (contracts != null && contracts.isNotEmpty()) {
|
||||||
ContractAttachment(it, contracts.first(), contracts.drop(1).toSet(), attachment.uploader, attachment.signers?.toList()
|
ContractAttachment.create(it, contracts.first(), contracts.drop(1).toSet(), attachment.uploader, attachment.signers?.toList()
|
||||||
?: emptyList(), attachment.version)
|
?: emptyList(), attachment.version)
|
||||||
} else {
|
} else {
|
||||||
it
|
it
|
||||||
|
@ -28,7 +28,7 @@ class ContractAttachmentSerializer(factory: SerializerFactory) : CustomSerialize
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun fromProxy(proxy: ContractAttachmentProxy): ContractAttachment {
|
override fun fromProxy(proxy: ContractAttachmentProxy): ContractAttachment {
|
||||||
return ContractAttachment(proxy.attachment, proxy.contract, proxy.contracts, proxy.uploader, proxy.signers, proxy.version)
|
return ContractAttachment.create(proxy.attachment, proxy.contract, proxy.contracts, proxy.uploader, proxy.signers, proxy.version)
|
||||||
}
|
}
|
||||||
|
|
||||||
@KeepForDJVM
|
@KeepForDJVM
|
||||||
|
@ -106,7 +106,7 @@ class MockAttachmentStorage : AttachmentStorage, SingletonSerializeAsToken() {
|
|||||||
val contractClassMetadata = ContractAttachmentMetadata(contractClassName, version, signers.isNotEmpty())
|
val contractClassMetadata = ContractAttachmentMetadata(contractClassName, version, signers.isNotEmpty())
|
||||||
_contractClasses[contractClassMetadata] = sha256
|
_contractClasses[contractClassMetadata] = sha256
|
||||||
}
|
}
|
||||||
ContractAttachment(baseAttachment, contractClassNames.first(), contractClassNames.toSet(), uploader, signers, version)
|
ContractAttachment.create(baseAttachment, contractClassNames.first(), contractClassNames.toSet(), uploader, signers, version)
|
||||||
}
|
}
|
||||||
_files[sha256] = Pair(attachment, bytes)
|
_files[sha256] = Pair(attachment, bytes)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user