mirror of
https://github.com/corda/corda.git
synced 2024-12-22 06:17:55 +00:00
Updates the cookbook to reflect vault API changes.
This commit is contained in:
parent
e62a54b74d
commit
849d5921d3
@ -12,7 +12,8 @@ import net.corda.core.flows.*;
|
|||||||
import net.corda.core.identity.Party;
|
import net.corda.core.identity.Party;
|
||||||
import net.corda.core.node.services.ServiceType;
|
import net.corda.core.node.services.ServiceType;
|
||||||
import net.corda.core.node.services.Vault;
|
import net.corda.core.node.services.Vault;
|
||||||
import net.corda.core.node.services.vault.QueryCriteria;
|
import net.corda.core.node.services.Vault.Page;
|
||||||
|
import net.corda.core.node.services.vault.QueryCriteria.VaultQueryCriteria;
|
||||||
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;
|
||||||
@ -26,13 +27,8 @@ import net.corda.flows.ResolveTransactionsFlow;
|
|||||||
import net.corda.flows.SignTransactionFlow;
|
import net.corda.flows.SignTransactionFlow;
|
||||||
import org.bouncycastle.asn1.x500.X500Name;
|
import org.bouncycastle.asn1.x500.X500Name;
|
||||||
|
|
||||||
import net.corda.core.node.services.vault.QueryCriteria.VaultQueryCriteria;
|
|
||||||
import rx.Observable;
|
|
||||||
|
|
||||||
import java.security.PublicKey;
|
import java.security.PublicKey;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -227,12 +223,8 @@ public class FlowCookbookJava {
|
|||||||
|
|
||||||
// For example, we would extract any unconsumed ``DummyState``s
|
// For example, we would extract any unconsumed ``DummyState``s
|
||||||
// from our vault as follows:
|
// from our vault as follows:
|
||||||
Vault.StateStatus status = Vault.StateStatus.UNCONSUMED;
|
VaultQueryCriteria criteria = new VaultQueryCriteria(Vault.StateStatus.UNCONSUMED);
|
||||||
Set<Class<DummyState>> dummyStateTypes = new HashSet<>(ImmutableList.of(DummyState.class));
|
Page<DummyState> results = getServiceHub().getVaultQueryService().queryBy(DummyState.class, criteria);
|
||||||
|
|
||||||
VaultQueryCriteria criteria = new VaultQueryCriteria(status, null, dummyStateTypes);
|
|
||||||
Vault.Page<DummyState> results = getServiceHub().getVaultService().queryBy(criteria);
|
|
||||||
|
|
||||||
List<StateAndRef<DummyState>> dummyStates = results.getStates();
|
List<StateAndRef<DummyState>> dummyStates = results.getStates();
|
||||||
|
|
||||||
// For a full list of the available ways of extracting states from
|
// For a full list of the available ways of extracting states from
|
||||||
|
@ -9,14 +9,18 @@ import net.corda.core.crypto.SecureHash
|
|||||||
import net.corda.core.flows.*
|
import net.corda.core.flows.*
|
||||||
import net.corda.core.identity.Party
|
import net.corda.core.identity.Party
|
||||||
import net.corda.core.node.services.ServiceType
|
import net.corda.core.node.services.ServiceType
|
||||||
import net.corda.core.node.services.Vault
|
import net.corda.core.node.services.Vault.Page
|
||||||
import net.corda.core.node.services.vault.QueryCriteria
|
import net.corda.core.node.services.queryBy
|
||||||
|
import net.corda.core.node.services.vault.QueryCriteria.VaultQueryCriteria
|
||||||
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 net.corda.core.utilities.*
|
import net.corda.core.utilities.DUMMY_PUBKEY_1
|
||||||
|
import net.corda.core.utilities.ProgressTracker
|
||||||
import net.corda.core.utilities.ProgressTracker.Step
|
import net.corda.core.utilities.ProgressTracker.Step
|
||||||
|
import net.corda.core.utilities.UntrustworthyData
|
||||||
|
import net.corda.core.utilities.unwrap
|
||||||
import net.corda.flows.CollectSignaturesFlow
|
import net.corda.flows.CollectSignaturesFlow
|
||||||
import net.corda.flows.FinalityFlow
|
import net.corda.flows.FinalityFlow
|
||||||
import net.corda.flows.ResolveTransactionsFlow
|
import net.corda.flows.ResolveTransactionsFlow
|
||||||
@ -202,8 +206,8 @@ object FlowCookbook {
|
|||||||
|
|
||||||
// For example, we would extract any unconsumed ``DummyState``s
|
// For example, we would extract any unconsumed ``DummyState``s
|
||||||
// from our vault as follows:
|
// from our vault as follows:
|
||||||
val criteria = QueryCriteria.VaultQueryCriteria() // default is UNCONSUMED
|
val criteria: VaultQueryCriteria = VaultQueryCriteria() // default is UNCONSUMED
|
||||||
val results: Vault.Page<DummyState> = serviceHub.vaultService.queryBy<DummyState>(criteria)
|
val results: Page<DummyState> = serviceHub.vaultQueryService.queryBy<DummyState>(criteria)
|
||||||
val dummyStates: List<StateAndRef<DummyState>> = results.states
|
val dummyStates: List<StateAndRef<DummyState>> = results.states
|
||||||
|
|
||||||
// For a full list of the available ways of extracting states from
|
// For a full list of the available ways of extracting states from
|
||||||
|
Loading…
Reference in New Issue
Block a user