Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add An Example Of Custom Queries Over RPC #48

Open
opticyclic opened this issue Apr 4, 2021 · 0 comments
Open

Add An Example Of Custom Queries Over RPC #48

opticyclic opened this issue Apr 4, 2021 · 0 comments

Comments

@opticyclic
Copy link

In the original example repo there was an example of using custom queries:
https://github.com/corda/cordapp-example/blob/release-V4/java-source/src/main/java/com/example/api/ExampleApi.java#L132-L137

    QueryCriteria generalCriteria = new QueryCriteria.VaultQueryCriteria(Vault.StateStatus.ALL);
    FieldInfo lenderField = QueryCriteriaUtils.getField("lender", IOUSchemaV1.PersistentIOU.class);
    CriteriaExpression lenderIndex = Builder.equal(lenderField, myLegalName.toString());
    QueryCriteria lenderCriteria = new QueryCriteria.VaultCustomQueryCriteria(lenderIndex);
    QueryCriteria criteria = generalCriteria.and(lenderCriteria);
    List<StateAndRef<IOUState>> results = rpcOps.vaultQueryByCriteria(criteria,IOUState.class).getStates();

There doesn't appear to be a similar example in this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant