mirror of
https://github.com/corda/corda.git
synced 2025-06-13 04:38:19 +00:00
Unification of VaultQuery And VaultService APIs (into single VaultService interface) to simplify node bootstrapping and usability. (#1677)
This commit is contained in:
@ -223,7 +223,7 @@ public class FlowCookbookJava {
|
||||
// For example, we would extract any unconsumed ``DummyState``s
|
||||
// from our vault as follows:
|
||||
VaultQueryCriteria criteria = new VaultQueryCriteria(Vault.StateStatus.UNCONSUMED);
|
||||
Page<DummyState> results = getServiceHub().getVaultQueryService().queryBy(DummyState.class, criteria);
|
||||
Page<DummyState> results = getServiceHub().getVaultService().queryBy(DummyState.class, criteria);
|
||||
List<StateAndRef<DummyState>> dummyStates = results.getStates();
|
||||
|
||||
// For a full list of the available ways of extracting states from
|
||||
|
@ -206,7 +206,7 @@ object FlowCookbook {
|
||||
// For example, we would extract any unconsumed ``DummyState``s
|
||||
// from our vault as follows:
|
||||
val criteria: VaultQueryCriteria = VaultQueryCriteria() // default is UNCONSUMED
|
||||
val results: Page<DummyState> = serviceHub.vaultQueryService.queryBy<DummyState>(criteria)
|
||||
val results: Page<DummyState> = serviceHub.vaultService.queryBy<DummyState>(criteria)
|
||||
val dummyStates: List<StateAndRef<DummyState>> = results.states
|
||||
|
||||
// For a full list of the available ways of extracting states from
|
||||
|
@ -129,7 +129,7 @@ class SubmitCompletionFlow(private val ref: StateRef, private val verdict: Workf
|
||||
override fun call(): StateAndRef<TradeApprovalContract.State> {
|
||||
// DOCSTART 1
|
||||
val criteria = VaultQueryCriteria(stateRefs = listOf(ref))
|
||||
val latestRecord = serviceHub.vaultQueryService.queryBy<TradeApprovalContract.State>(criteria).states.single()
|
||||
val latestRecord = serviceHub.vaultService.queryBy<TradeApprovalContract.State>(criteria).states.single()
|
||||
// DOCEND 1
|
||||
|
||||
// Check the protocol hasn't already been run
|
||||
|
@ -27,7 +27,7 @@ class WorkflowTransactionBuildTutorialTest {
|
||||
|
||||
// Helper method to locate the latest Vault version of a LinearState
|
||||
private inline fun <reified T : LinearState> ServiceHub.latest(ref: UniqueIdentifier): StateAndRef<T> {
|
||||
val linearHeads = vaultQueryService.queryBy<T>(QueryCriteria.LinearStateQueryCriteria(uuid = listOf(ref.id)))
|
||||
val linearHeads = vaultService.queryBy<T>(QueryCriteria.LinearStateQueryCriteria(uuid = listOf(ref.id)))
|
||||
return linearHeads.states.single()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user