Replace Party with Party.Full

Replace Party with Party.Full as an interim step to introducing the Party.Anonymised class.

Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
This commit is contained in:
Ross Nicoll
2017-02-01 11:13:50 +00:00
parent 3572b78372
commit 1b86ddfd6e
137 changed files with 415 additions and 411 deletions

View File

@ -27,9 +27,9 @@ object FxTransactionDemoTutorial {
private data class FxRequest(val tradeId: String,
val amount: Amount<Issued<Currency>>,
val owner: Party,
val counterparty: Party,
val notary: Party? = null)
val owner: Party.Full,
val counterparty: Party.Full,
val notary: Party.Full? = null)
private data class FxResponse(val inputs: List<StateAndRef<Cash.State>>,
val outputs: List<Cash.State>)
@ -39,7 +39,7 @@ private data class FxResponse(val inputs: List<StateAndRef<Cash.State>>,
// Which is brought here to make the filtering logic more visible in the example
private fun gatherOurInputs(serviceHub: ServiceHub,
amountRequired: Amount<Issued<Currency>>,
notary: Party?): Pair<List<StateAndRef<Cash.State>>, Long> {
notary: Party.Full?): Pair<List<StateAndRef<Cash.State>>, Long> {
// Collect cash type inputs
val cashStates = serviceHub.vaultService.currentVault.statesOfType<Cash.State>()
// extract our key identity for convenience
@ -56,7 +56,7 @@ private fun gatherOurInputs(serviceHub: ServiceHub,
// For simplicity we just filter on the first notary encountered
// A production quality flow would need to migrate notary if the
// the amounts were not sufficient in any one notary
val sourceNotary: Party = notary ?: suitableCashStates.first().state.notary
val sourceNotary: Party.Full = notary ?: suitableCashStates.first().state.notary
val inputsList = mutableListOf<StateAndRef<Cash.State>>()
// Iterate over filtered cash states to gather enough to pay
@ -102,8 +102,8 @@ private fun prepareOurInputsAndOutputs(serviceHub: ServiceHub, request: FxReques
class ForeignExchangeFlow(val tradeId: String,
val baseCurrencyAmount: Amount<Issued<Currency>>,
val quoteCurrencyAmount: Amount<Issued<Currency>>,
val baseCurrencyBuyer: Party,
val baseCurrencySeller: Party) : FlowLogic<SecureHash>() {
val baseCurrencyBuyer: Party.Full,
val baseCurrencySeller: Party.Full) : FlowLogic<SecureHash>() {
@Suspendable
override fun call(): SecureHash {
// Select correct sides of the Fx exchange to query for.
@ -208,7 +208,7 @@ class ForeignExchangeFlow(val tradeId: String,
// DOCEND 3
}
class ForeignExchangeRemoteFlow(val source: Party) : FlowLogic<Unit>() {
class ForeignExchangeRemoteFlow(val source: Party.Full) : FlowLogic<Unit>() {
@Suspendable
override fun call() {
// Initial receive from remote party

View File

@ -51,13 +51,13 @@ data class TradeApprovalContract(override val legalContractReference: SecureHash
* Truly minimal state that just records a tradeId string and the parties involved.
*/
data class State(val tradeId: String,
val source: Party,
val counterparty: Party,
val source: Party.Full,
val counterparty: Party.Full,
val state: WorkflowState = WorkflowState.NEW,
override val linearId: UniqueIdentifier = UniqueIdentifier(tradeId),
override val contract: TradeApprovalContract = TradeApprovalContract()) : LinearState {
val parties: List<Party> get() = listOf(source, counterparty)
val parties: List<Party.Full> get() = listOf(source, counterparty)
override val participants: List<CompositeKey> get() = parties.map { it.owningKey }
override fun isRelevant(ourKeys: Set<PublicKey>): Boolean {
@ -110,7 +110,7 @@ data class TradeApprovalContract(override val legalContractReference: SecureHash
* as their approval/rejection is to follow.
*/
class SubmitTradeApprovalFlow(val tradeId: String,
val counterparty: Party) : FlowLogic<StateAndRef<TradeApprovalContract.State>>() {
val counterparty: Party.Full) : FlowLogic<StateAndRef<TradeApprovalContract.State>>() {
@Suspendable
override fun call(): StateAndRef<TradeApprovalContract.State> {
// Manufacture an initial state
@ -225,7 +225,7 @@ class SubmitCompletionFlow(val ref: StateRef, val verdict: WorkflowState) : Flow
* Then after checking to sign it and eventually store the fully notarised
* transaction to the ledger.
*/
class RecordCompletionFlow(val source: Party) : FlowLogic<Unit>() {
class RecordCompletionFlow(val source: Party.Full) : FlowLogic<Unit>() {
@Suspendable
override fun call(): Unit {
// DOCSTART 3