From de719034a3470342ab3c0c86d2ca6cc5915557da Mon Sep 17 00:00:00 2001 From: Manos Batsis Date: Wed, 28 Oct 2020 01:39:10 +0200 Subject: [PATCH 1/4] Added basic installation instructions --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 6e7a2d9..40725fc 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,30 @@ only know about those in their group). In a business network, there is at least one *authorised member*. This member has sufficient permissions to execute management operations over the network and its members. +## Installation + +Add the `business-networks-contracts` dependency in your "contracts" (and states) cordapp module: + +```groovy +dependencies { + //... + cordapp("net.corda.bn:business-networks-contracts:$corda_bn_extension_version") + //... +} +``` + +... and the `business-networks-workflows` dependency in your "workflows" cordapp module: + +```groovy +dependencies { + //... + cordapp("net.corda.bn:business-networks-workflows:$corda_bn_extension_version") + //... +} +``` + +Remember to add both dependencies in your Cordform (i.e. `deployNodes`) task. + ## Creating and managing a business network BNE provides a set of workflows that allows a user to start a business network, on-board members and assign them to membership lists or groups. The flows can also be used to update the information From c71251016eb3668ba85f623a761fc5e080484620 Mon Sep 17 00:00:00 2001 From: Manos Batsis Date: Tue, 3 Nov 2020 12:22:54 +0200 Subject: [PATCH 2/4] Updated PersistentMembershipState with additional constraints and state member mappings --- .../bn/schemas/MembershipStateSchemaV1.kt | 19 +++++++++++++++---- .../net/corda/bn/states/MembershipState.kt | 7 ++++++- ...bership-state-schema-v1.changelog-init.xml | 19 +++++++++++++++++++ 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/business-networks-contracts/src/main/kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt b/business-networks-contracts/src/main/kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt index bc00be5..87521ce 100644 --- a/business-networks-contracts/src/main/kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt +++ b/business-networks-contracts/src/main/kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt @@ -1,11 +1,13 @@ package net.corda.bn.schemas +import net.corda.bn.states.BNIdentity import net.corda.bn.states.MembershipState import net.corda.bn.states.MembershipStatus import net.corda.core.identity.Party import net.corda.core.schemas.MappedSchema import net.corda.core.schemas.PersistentState import net.corda.core.serialization.CordaSerializable +import java.time.Instant import javax.persistence.Column import javax.persistence.Entity import javax.persistence.Table @@ -26,11 +28,20 @@ object MembershipStateSchemaV1 : MappedSchema(schemaFamily = MembershipState::cl @Entity @Table(name = "membership_state") class PersistentMembershipState( - @Column(name = "corda_identity") + @Column(name = "corda_identity", nullable = false) val cordaIdentity: Party, - @Column(name = "network_id") + /** String representation of custom [BNIdentity] */ + @Column(name = "business_identity", nullable = false) + val businessIdentity: String, + @Column(name = "network_id", nullable = false) val networkId: String, - @Column(name = "status") - val status: MembershipStatus + @Column(name = "status", nullable = false) + val status: MembershipStatus, + @Column(name = "issuer_identity", nullable = false) + val issuer: Party, + @Column(name = "issued", nullable = false) + val issued: Instant, + @Column(name = "modified", nullable = false) + val modified: Instant ) : PersistentState() } \ No newline at end of file diff --git a/business-networks-contracts/src/main/kotlin/net/corda/bn/states/MembershipState.kt b/business-networks-contracts/src/main/kotlin/net/corda/bn/states/MembershipState.kt index 988a180..4bf1132 100644 --- a/business-networks-contracts/src/main/kotlin/net/corda/bn/states/MembershipState.kt +++ b/business-networks-contracts/src/main/kotlin/net/corda/bn/states/MembershipState.kt @@ -39,8 +39,13 @@ data class MembershipState( override fun generateMappedObject(schema: MappedSchema) = when (schema) { is MembershipStateSchemaV1 -> MembershipStateSchemaV1.PersistentMembershipState( cordaIdentity = identity.cordaIdentity, + businessIdentity = identity.businessIdentity.toString(), networkId = networkId, - status = status + status = status, + issuer = issuer, + issued = issued, + modified = modified + ) else -> throw IllegalArgumentException("Unrecognised schema $schema") } diff --git a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml index e7c088d..e5e1ec0 100644 --- a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml +++ b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml @@ -18,4 +18,23 @@ constraintName="PK_MembershipStateSchemaV1" tableName="membership_state"/> + + + + + + + + + + + + + + + + + + + \ No newline at end of file From d5e308dacf8208e951cf5a83acb9b69260df2461 Mon Sep 17 00:00:00 2001 From: Manos Batsis Date: Tue, 3 Nov 2020 12:30:48 +0200 Subject: [PATCH 3/4] Make PersistentMembershipState.businessIdentity nullable --- .../kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt | 4 ++-- .../src/main/kotlin/net/corda/bn/states/MembershipState.kt | 2 +- .../migration/membership-state-schema-v1.changelog-init.xml | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/business-networks-contracts/src/main/kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt b/business-networks-contracts/src/main/kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt index 87521ce..5c9f4de 100644 --- a/business-networks-contracts/src/main/kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt +++ b/business-networks-contracts/src/main/kotlin/net/corda/bn/schemas/MembershipStateSchemaV1.kt @@ -31,8 +31,8 @@ object MembershipStateSchemaV1 : MappedSchema(schemaFamily = MembershipState::cl @Column(name = "corda_identity", nullable = false) val cordaIdentity: Party, /** String representation of custom [BNIdentity] */ - @Column(name = "business_identity", nullable = false) - val businessIdentity: String, + @Column(name = "business_identity") + val businessIdentity: String?, @Column(name = "network_id", nullable = false) val networkId: String, @Column(name = "status", nullable = false) diff --git a/business-networks-contracts/src/main/kotlin/net/corda/bn/states/MembershipState.kt b/business-networks-contracts/src/main/kotlin/net/corda/bn/states/MembershipState.kt index 4bf1132..51387fb 100644 --- a/business-networks-contracts/src/main/kotlin/net/corda/bn/states/MembershipState.kt +++ b/business-networks-contracts/src/main/kotlin/net/corda/bn/states/MembershipState.kt @@ -39,7 +39,7 @@ data class MembershipState( override fun generateMappedObject(schema: MappedSchema) = when (schema) { is MembershipStateSchemaV1 -> MembershipStateSchemaV1.PersistentMembershipState( cordaIdentity = identity.cordaIdentity, - businessIdentity = identity.businessIdentity.toString(), + businessIdentity = identity.businessIdentity?.toString(), networkId = networkId, status = status, issuer = issuer, diff --git a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml index e5e1ec0..792e3e6 100644 --- a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml +++ b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml @@ -23,9 +23,7 @@ - - - + From c46d3b9ef3caa31cc77d5845757300562836b436 Mon Sep 17 00:00:00 2001 From: Manos Batsis Date: Mon, 30 Nov 2020 12:30:44 +0200 Subject: [PATCH 4/4] Updated based on tubibuto's comments at https://github.com/corda/bn-extension/pull/33 --- ...-schema-v1.changelog-additional-fields.xml | 22 +++++++++++++++++++ ...bership-state-schema-v1.changelog-init.xml | 17 -------------- ...rship-state-schema-v1.changelog-master.xml | 1 + 3 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-additional-fields.xml diff --git a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-additional-fields.xml b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-additional-fields.xml new file mode 100644 index 0000000..06c7ca8 --- /dev/null +++ b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-additional-fields.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml index 792e3e6..e7c088d 100644 --- a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml +++ b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-init.xml @@ -18,21 +18,4 @@ constraintName="PK_MembershipStateSchemaV1" tableName="membership_state"/> - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-master.xml b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-master.xml index e5780df..77b6aae 100644 --- a/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-master.xml +++ b/business-networks-contracts/src/main/resources/migration/membership-state-schema-v1.changelog-master.xml @@ -3,4 +3,5 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd"> +