Removed duplicate identity attribute (parties) from DealState. (#820)

All references to 'parties' now refer to the inherited 'participants' attribute from ContractState.

Samples: all duplicate references to `parties` now changed to `participants`.
This commit is contained in:
josecoll
2017-06-09 17:33:04 +01:00
committed by GitHub
parent 48bbcb8a57
commit b5a1cb5109
13 changed files with 23 additions and 49 deletions

View File

@ -275,21 +275,6 @@ interface DealState : LinearState {
/** Human readable well known reference (e.g. trade reference) */
val ref: String
/**
* Exposes the Parties involved in a generic way.
*
* Appears to duplicate [participants] a property of [ContractState]. However [participants] only holds public keys.
* Currently we need to hard code Party objects into [ContractState]s. [Party] objects are a wrapper for public
* keys which also contain some identity information about the public key owner. You can keep track of individual
* parties by adding a property for each one to the state, or you can append parties to the [parties] list if you
* are implementing [DealState]. We need to do this as identity management in Corda is currently incomplete,
* therefore the only way to record identity information is in the [ContractState]s themselves. When identity
* management is completed, parties to a transaction will only record public keys in the [DealState] and through a
* separate process exchange certificates to ascertain identities. Thus decoupling identities from
* [ContractState]s.
* */
val parties: List<AbstractParty>
/**
* Generate a partial transaction representing an agreement (command) to this deal, allowing a general
* deal/agreement flow to generate the necessary transaction for potential implementations.

View File

@ -366,7 +366,7 @@ inline fun <reified T : LinearState> VaultService.linearHeadsOfType() =
// TODO: Remove this from the interface
// @Deprecated("This function will be removed in a future milestone", ReplaceWith("queryBy(LinearStateQueryCriteria(dealPartyName = listOf(<String>)))"))
inline fun <reified T : DealState> VaultService.dealsWith(party: AbstractParty) = linearHeadsOfType<T>().values.filter {
it.state.data.parties.any { it == party }
it.state.data.participants.any { it == party }
}
class StatesNotAvailableException(override val message: String?, override val cause: Throwable? = null) : FlowException(message, cause) {

View File

@ -186,7 +186,7 @@ object TwoPartyDealFlow {
// And add a request for a time-window: it may be that none of the contracts need this!
// But it can't hurt to have one.
ptx.addTimeWindow(serviceHub.clock.instant(), 30.seconds)
return Pair(ptx, arrayListOf(deal.parties.single { it == serviceHub.myInfo.legalIdentity as AbstractParty }.owningKey))
return Pair(ptx, arrayListOf(deal.participants.single { it == serviceHub.myInfo.legalIdentity as AbstractParty }.owningKey))
}
}
}