Working with strings

This commit is contained in:
Richard Green 2017-02-15 11:23:49 +00:00 committed by Katarzyna Streich
parent 70e7a94310
commit f9ca498cb8
2 changed files with 7 additions and 23 deletions

View File

@ -13,16 +13,17 @@ import net.corda.core.node.services.StateMachineTransactionMapping
import net.corda.core.node.services.Vault import net.corda.core.node.services.Vault
import net.corda.core.seconds import net.corda.core.seconds
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
import net.corda.core.utilities.ProgressTracker
import rx.Observable import rx.Observable
import rx.subjects.PublishSubject import rx.subjects.PublishSubject
data class ProgressTrackingEvent(val stateMachineId: StateMachineRunId, val message: String, val sessionId: Long ) { // TODO: RG Not a string, but a proper tracking object. data class ProgressTrackingEvent(val stateMachineId: StateMachineRunId, val message: String, val currentState: ProgressTracker?) { // TODO: RG Not a string, but a proper tracking object.
companion object { companion object {
fun createStreamFromStateMachineInfo(stateMachine: StateMachineInfo): Observable<ProgressTrackingEvent>? { fun createStreamFromStateMachineInfo(stateMachine: StateMachineInfo): Observable<ProgressTrackingEvent>? {
return stateMachine.progressTrackerStepAndUpdates?.let { pair -> return stateMachine.progressTrackerStepAndUpdates?.let { pair ->
val (current, future) = pair val (current, future) = pair
future.map { ProgressTrackingEvent(stateMachine.id, it, stateMachine.sessionId ) }.startWith(ProgressTrackingEvent(stateMachine.id, current, stateMachine.sessionId))
future.map { ProgressTrackingEvent(stateMachine.id, it, null ) }.startWith(ProgressTrackingEvent(stateMachine.id, current, null))
} }
} }
} }

View File

@ -11,7 +11,6 @@ import net.corda.core.contracts.ContractState
import net.corda.core.contracts.StateAndRef import net.corda.core.contracts.StateAndRef
import net.corda.core.contracts.StateRef import net.corda.core.contracts.StateRef
import net.corda.core.crypto.SecureHash import net.corda.core.crypto.SecureHash
import net.corda.core.flows.FlowLogic
import net.corda.core.flows.StateMachineRunId import net.corda.core.flows.StateMachineRunId
import net.corda.core.messaging.StateMachineUpdate import net.corda.core.messaging.StateMachineUpdate
import net.corda.core.transactions.SignedTransaction import net.corda.core.transactions.SignedTransaction
@ -61,7 +60,7 @@ data class PartiallyResolvedTransaction(
} }
data class FlowStatus(val status: String) data class FlowStatus(val status: String)
//todo after rebase //todo after rebase - remove it rather
//class FlowStatus( //class FlowStatus(
// val status: String, // val status: String,
// pt: ProgressTrackingEvent?, // pt: ProgressTrackingEvent?,
@ -125,17 +124,8 @@ class TransactionDataModel {
} }
} }
val stateMachineDataList = LeftOuterJoinedMap(stateMachineStatus, progressEvents) { val stateMachineDataList = LeftOuterJoinedMap(stateMachineStatus, progressEvents) { id, status, progress ->
id, status, progress -> Bindings.createObjectBinding({ StateMachineData(id, progress.value?.message?.let(::FlowStatus), status.get()) }, arrayOf(progress, status))
Bindings.createObjectBinding(
{ StateMachineData(id,
// FlowStatus(progress.value?.message!!, null),
progress.value?.message?.let{
FlowStatus(progress.value!!.message!!.toString(),progress.value)
},
status.get()) }
, arrayOf(progress, status)
)
}.getObservableValues().flatten() }.getObservableValues().flatten()
/* /*
@ -183,14 +173,7 @@ class StateMachineDataModel {
val stateMachineDataList = LeftOuterJoinedMap(stateMachineStatus, progressEvents) { id, status, progress -> val stateMachineDataList = LeftOuterJoinedMap(stateMachineStatus, progressEvents) { id, status, progress ->
Bindings.createObjectBinding({ Bindings.createObjectBinding({ StateMachineData(id, progress.value?.message?.let(::FlowStatus), status.get()) }, arrayOf(progress, status))
StateMachineData(id,
progress.value?.message?.let{
FlowStatus(progress.value!!.message!!.toString(),null)
},
// progress.value?.message?.let(::FlowStatus),
status.get())
}, arrayOf(progress, status))
}.getObservableValues().flatten() }.getObservableValues().flatten()
/* /*