Skip to content

Commit ef7c12f

Browse files
committed
Merge branch 'featuresrevamp' of https://github.com/corda/samples-java into featuresrevamp
2 parents 513128e + ce27b50 commit ef7c12f

File tree

28 files changed

+264
-185
lines changed

28 files changed

+264
-185
lines changed

Features/README.md

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,45 @@
1-
## samples-java/feature-specific-cordapps
1+
## Feature Specific Cordapps
22

33
This folder features several sample projects, each of them demonstrates different specific features of corda.
44

5-
### [attachment-blacklist](./attachment-blacklist):
5+
### [Blacklist -- Attachment](./attachment-blacklist):
66
This CorDapp allows nodes to reach agreement over arbitrary strings of text, but only with parties that are not included in the blacklist uploaded to the nodes as an [attachment](https://training.corda.net/corda-details/attachments/).
7-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/attachment-blacklist)
87

9-
### [attachment-sendfile](./attachment-sendfile):
8+
### [Sendfile -- Attachment](./attachment-sendfile):
109
This Cordapp shows how to upload and download an [attachment](https://training.corda.net/corda-details/attachments/) via a flow.
11-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/attachment-sendfile)
10+
<p align="center">
11+
<img src="./attachment-sendfile/graph.png" alt="Corda" width="700">
12+
</p>
1213

13-
### [confidential identity whistleblower](./confidentialidentity-whistleblower):
14+
### [Whistleblower -- Confidential Identity ](./confidentialidentity-whistleblower):
1415
This CorDapp is a simple showcase of [confidential identities](https://docs.corda.net/docs/corda-os/api-identity.html#confidential-identities) (i.e. anonymous public keys).
15-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/confidentialidentity-whistleblower)
1616

17-
### [service autopayroll](./cordaservice-autopayroll):
17+
### [Autopayroll -- CordaService](./cordaservice-autopayroll):
1818
This Cordapp shows how to trigger a flow with vault update(completion of prior flows) using [CordaService](https://training.corda.net/corda-details/automation/#services) & [trackby](https://training.corda.net/corda-details/automation-solution/#track-and-notify).
19-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/cordaservice-autopayroll)
19+
<p align="center">
20+
<img src="./cordaservice-autopayroll/webpic/Business%20Logic.png" alt="Corda" width="500">
21+
</p>
2022

21-
### [observable states trade reporting](./observablestates-tradereporting):
23+
### [Trade Reporting -- ObservableStates](./observablestates-tradereporting):
2224
This CorDapp shows how Corda's [observable states](https://docs.corda.net/docs/corda-os/4.4/tutorial-observer-nodes.html#observer-nodes) feature works. Observable states is the ability for nodes who are not participants in a transaction to still store them if the transactions are sent to them.
23-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/observablestates-tradereporting)
2425

25-
### [oracle prime number](./oracle-primenumber):
26+
### [Prime Number -- Oracle](./oracle-primenumber):
2627
This CorDapp implements an [oracle service](https://training.corda.net/corda-details/oracles) that allows nodes to:
2728

2829
* Request the Nth prime number
2930
* Request the oracle's signature to prove that the number included in their transaction is actually the Nth prime number
3031

31-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/oracle-primenumber)
3232

33-
### [queryable state car insurance](./queryablestate-carinsurance):
33+
### [Car Insurance -- QueryableState](./queryablestate-carinsurance):
3434
This CorDapp demonstrates [QueryableState](https://docs.corda.net/docs/corda-os/api-persistence.html) works in Corda. Corda allows developers to have the ability to expose some or all parts of their states to a custom database table using an ORM tools. To support this feature the state must implement `QueryableState`.
35-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/queryablestate-carinsurance)
3635

37-
### [reference states and sanctionsbody](./referencestates-sanctionsbody):
36+
### [Sanctionsbody -- ReferenceStates](./referencestates-sanctionsbody):
3837
This CorDapp demonstrates the use of [reference states](https://training.corda.net/corda-details/reference-states/) in a transaction and in the verification method of a contract.
3938

4039
This CorDapp allows two nodes to enter into an IOU agreement, but enforces that both parties belong to a list of sanctioned entities. This list of sanctioned entities is taken from a referenced SanctionedEntities state.
41-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/referencestates-sanctionsbody)
4240

43-
### [heartbeat schedulable state](./schedulablestate-heartbeat):
41+
### [Heartbeat -- SchedulableState](./schedulablestate-heartbeat):
4442
This CorDapp is a simple showcase of [scheduled activities](https://docs.corda.net/docs/corda-os/event-scheduling.html#how-to-implement-scheduled-events) (i.e. activities started by a node at a specific time without direct input from the node owner).
45-
[<img src="../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/schedulablestate-heartbeat)
46-
43+
<p align="center">
44+
<img src="./schedulablestate-heartbeat/heart.jpg" alt="Corda" width="500">
45+
</p>

Features/attachment-blacklist/README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# blacklist cordapp [<img src="../../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/attachment-blacklist)
1+
# Blacklist -- Attachment
22

33
This CorDapp allows nodes to reach agreement over arbitrary strings of text, but only with parties that are not included in the blacklist uploaded to the nodes as an [attachment](https://training.corda.net/corda-details/attachments/).
44

@@ -15,22 +15,15 @@ parties as being banned from entering into agreements:
1515
* Tifton Banking Company
1616

1717
The blacklist jar is uploaded as an attachment when building a transaction, and used in the `AgreementContract` to
18-
check that the parties to the `AgreementState` are not blacklisted.
19-
20-
### Flows
21-
22-
There aren't many flows here, so it's quick to cover.
23-
24-
There's a [proposal](./workflows/src/main/java/net/corda/examples/attachments/ProposeFlow.java) and [acceptance](./workflows/src/main/java/net/corda/examples/attachments/AgreeFlow.java) flow, and the blacklist is added as an attachment [here](./workflows/src/main/java/net/corda/examples/attachments/ProposeFlow.java#L47-L50).
18+
check that the parties to the `AgreementState` are not blacklisted. There aren't many flows here, so it's quick to cover. There's a proposal and acceptance flow, and the blacklist is added as an attachment.
2519

2620

2721

2822
## Usage
2923

24+
## Pre-Requisites
3025

31-
### Pre-requisites:
32-
33-
See https://docs.corda.net/getting-set-up.html.
26+
For development environment setup, please refer to: [Setup Guide](https://docs.corda.net/getting-set-up.html).
3427

3528

3629
### Running the CorDapp

Features/attachment-sendfile/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# attachzip -- attachment demo [<img src="../../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/attachment-sendfile)
2-
1+
# Sendfile -- Attachment
32
This Cordapp shows how to upload and download an [attachment](https://training.corda.net/corda-details/attachments/) via flow.
43

54

@@ -12,8 +11,7 @@ In this Cordapp, there are two parties:
1211

1312
### States
1413

15-
You'll want to take a quick look at [InvoiceState.java](./contracts/src/main/java/net/corda/examples/sendfile/states/InvoiceState.java#L21)
16-
14+
You'll want to take a quick look at `InvoiceState.java`
1715
```java
1816
public InvoiceState(String invoiceAttachmentID, List<AbstractParty> participants) {
1917
this.invoiceAttachmentID = invoiceAttachmentID;
@@ -24,7 +22,7 @@ public InvoiceState(String invoiceAttachmentID, List<AbstractParty> participants
2422

2523
### Flows
2624

27-
There are two flows [`sendAttachment`](./workflows/src/main/java/net/corda/examples/sendfile/flows/SendAttachment.java#L47-L67) and [`downloadAttachment`](./workflows/src/main/java/net/corda/examples/sendfile/flows/DownloadAttachment.java#L47-L66).
25+
There are two flows `sendAttachment`and `downloadAttachment`.
2826

2927
The flow logic is the following:
3028

Features/confidentialidentity-whistleblower/README.md

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# whistle blower cordapp [<img src="../../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/confidentialidentity-whistleblower)
1+
# Whistleblower -- Confidential Identity
22

33
This CorDapp is a simple showcase of [confidential identities](https://docs.corda.net/docs/corda-os/api-identity.html#confidential-identities) (i.e. anonymous public keys).
44

@@ -12,16 +12,12 @@ who manage to get ahold of the state cannot identity the whistle-blower or inves
1212
automatically by the `SwapIdentitiesFlow`.
1313

1414

15-
You can find `SwapIdentitiesFlow` [here](./workflows/src/main/java/net/corda/examples/whistleblower/flows/BlowWhistleFlow.java#L117-L121).
16-
17-
18-
1915
## Usage
2016

2117

22-
### Pre-requisites:
18+
## Pre-Requisites
2319

24-
See https://docs.corda.net/getting-set-up.html.
20+
For development environment setup, please refer to: [Setup Guide](https://docs.corda.net/getting-set-up.html).
2521

2622

2723
### Running the CorDapp

Features/cordaservice-autopayroll/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# autopayroll -- cordaservice demo [<img src="../../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/cordaservice-autopayroll)
1+
# Auto Payroll -- CordaService
22

33
This Cordapp shows how to trigger a flow with vault update(completion of prior flows) using [CordaService](https://training.corda.net/corda-details/automation/#services) & [trackby](https://training.corda.net/corda-details/automation-solution/#track-and-notify).
44

@@ -10,7 +10,7 @@ In this Cordapp, there are four parties:
1010
- PetersonThomas: worker #1 will accept money
1111
- GeorgeJefferson: worker #2 will accept money
1212

13-
There are two states [`PaymentRequestState`](./contracts/src/main/java/net/corda/examples/autopayroll/states/PaymentRequestState.java#L20-L24) & [`MoneyState`](./contracts/src/main/java/net/corda/examples/autopayroll/states/MoneyState.java#L23-L26), and two flows `RequestFlow` & `PaymentFlow`. The business logic looks like the following:
13+
There are two states `PaymentRequestState` & `MoneyState`, and two flows `RequestFlow` & `PaymentFlow`. The business logic looks like the following:
1414
![alt text](./webpic/Business%20Logic.png)
1515

1616
1. Finance team put in payroll request to the bank operators
@@ -20,9 +20,9 @@ There are two states [`PaymentRequestState`](./contracts/src/main/java/net/corda
2020
## Usage
2121

2222

23-
### Pre-Requisites
23+
## Pre-Requisites
2424

25-
See https://docs.corda.net/getting-set-up.html.
25+
For development environment setup, please refer to: [Setup Guide](https://docs.corda.net/getting-set-up.html).
2626

2727
### Running the CorDapp
2828

Features/notarychange-iou/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# IOU - NotaryChange Demo [<img src="../../webIDE.png" height=25 />](https://ide.corda.net/?folder=/home/coder/samples-java/Features/notarychange-iou)
1+
# IOU - NotaryChange
22

33
This CorDapp serves as a demo of a Notary Change Transaction in Corda which can be performed
44
using one of the Corda library flow called `NotaryChangeFlow`.
@@ -71,4 +71,4 @@ start SwitchNotaryFlow linearId: <linear id received from issue transaction>, ne
7171
Now, we should be able to settle the IOU at NotaryB successfully. To settle go to PartyB terminal and run:
7272
```
7373
start SettleFlow linearId: <linear id received from issue transaction>, notary: NotaryB
74-
```
74+
```

Features/notarychange-iou/build.gradle

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ buildscript {
1515
log4j_version = constants.getProperty("log4jVersion")
1616
slf4j_version = constants.getProperty("slf4jVersion")
1717
corda_platform_version = constants.getProperty("platformVersion").toInteger()
18-
//springboot
19-
spring_boot_version = '2.0.2.RELEASE'
20-
spring_boot_gradle_plugin_version = '2.0.2.RELEASE'
2118
}
2219

2320
repositories {
@@ -31,7 +28,6 @@ buildscript {
3128
classpath "net.corda.plugins:cordapp:$corda_gradle_plugins_version"
3229
classpath "net.corda.plugins:cordformation:$corda_gradle_plugins_version"
3330
classpath "net.corda.plugins:quasar-utils:$corda_gradle_plugins_version"
34-
classpath "org.springframework.boot:spring-boot-gradle-plugin:$spring_boot_gradle_plugin_version"
3531

3632
}
3733
}
@@ -91,15 +87,6 @@ dependencies {
9187
cordaCompile "org.slf4j:jul-to-slf4j:$slf4j_version"
9288
}
9389

94-
cordapp {
95-
info {
96-
name "Notary Change Demo"
97-
vendor "Corda Open Source"
98-
targetPlatformVersion corda_platform_version
99-
minimumPlatformVersion corda_platform_version
100-
}
101-
}
102-
10390
task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
10491
nodeDefaults {
10592
projectCordapp {

Features/notarychange-iou/contracts/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cordapp {
44
targetPlatformVersion corda_platform_version
55
minimumPlatformVersion corda_platform_version
66
contract {
7-
name "AutoPayroll Contracts"
7+
name "Notary-Change Contracts"
88
vendor "Corda Open Source"
99
licence "Apache License, Version 2.0"
1010
versionId 1

Features/notarychange-iou/contracts/src/main/java/net/corda/examples/notarychange/contracts/IOUContract.java

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package net.corda.samples.notarychange.contracts;
2+
3+
import net.corda.core.contracts.CommandData;
4+
import net.corda.core.contracts.Contract;
5+
import net.corda.core.transactions.LedgerTransaction;
6+
import net.corda.core.contracts.CommandWithParties;
7+
import net.corda.samples.notarychange.states.IOUState;
8+
import static net.corda.core.contracts.ContractsDSL.requireThat;
9+
10+
public class IOUContract implements Contract {
11+
public static final String ID = "net.corda.samples.notarychange.contracts.IOUContract";
12+
13+
/**
14+
* The verify() function of all the states' contracts must not throw an exception for a transaction to be
15+
* considered valid.
16+
*/
17+
@Override
18+
public void verify(LedgerTransaction tx) {
19+
requireThat(require -> {
20+
final CommandWithParties<CommandData> command = tx.getCommands().get(0);
21+
if( command.getValue() instanceof Commands.Create) {
22+
final IOUState out = tx.outputsOfType(IOUState.class).get(0);
23+
// IOU-specific constraints.
24+
require.using("The IOU's value must be non-negative.", out.getValue() > 0);
25+
}
26+
return null;
27+
});
28+
}
29+
30+
public interface Commands extends CommandData {
31+
class Create implements Commands { }
32+
class Settle implements Commands { }
33+
}
34+
}

0 commit comments

Comments
 (0)