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 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..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 @@ -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") + 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..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,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-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-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"> +