Skip to content

Commit

Permalink
addded schema
Browse files Browse the repository at this point in the history
  • Loading branch information
alkopnin committed Jun 15, 2018
1 parent 2bf48d2 commit e1c08d9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ publishing {
}
}
publications {
shadowJar(MavenPublication) {
mavenJava(MavenPublication) {
from components.java
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@ object ClaimProofSchema
object ClaimProofSchemaV1 : MappedSchema(
version = 1,
schemaFamily = ClaimProofSchema.javaClass,
mappedTypes = listOf(ClaimProofRecord::class.java)) {
mappedTypes = listOf(PersistentClaim::class.java)) {

@Entity
@Table(name = "claim_proofs")
class ClaimProofRecord (
@Table(name = "proofs")
class PersistentClaim(
@Column(name = "id")
val id: String,

@Column(name = "proofReq", length = 200000)
var proofReq: String,

@Column(name = "proof", length = 200000)
var proof: String
val id: String
) : PersistentState()
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
package com.luxoft.blockchainlab.corda.hyperledger.indy.data.state

import com.luxoft.blockchainlab.corda.hyperledger.indy.data.schema.ClaimProofSchemaV1
import com.luxoft.blockchainlab.hyperledger.indy.model.Proof
import com.luxoft.blockchainlab.hyperledger.indy.model.ProofReq
import net.corda.core.contracts.LinearState
import net.corda.core.contracts.UniqueIdentifier
import net.corda.core.identity.AbstractParty
import net.corda.core.schemas.MappedSchema
import net.corda.core.schemas.PersistentState
import net.corda.core.schemas.QueryableState

open class IndyClaimProof(val id: String,
val proofReq: ProofReq,
val proof: Proof,
override val participants: List<AbstractParty>,
override val linearId: UniqueIdentifier = UniqueIdentifier()): LinearState
override val linearId: UniqueIdentifier = UniqueIdentifier()): QueryableState, LinearState {

override fun generateMappedObject(schema: MappedSchema): PersistentState {
return when(schema) {
is ClaimProofSchemaV1 -> ClaimProofSchemaV1.PersistentClaim(
id = id
)
else -> throw IllegalArgumentException("Unrecognised schema $schema")
}
}

override fun supportedSchemas(): Iterable<MappedSchema> = listOf(ClaimProofSchemaV1)

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ object IssueClaimFlow {
val newClaimOut = flowSession.sendAndReceive<ClaimReq>(offer).unwrap { claimReq ->
verifyClaimAttributeValues(claimReq)
val claim = indyUser().issueClaim(claimReq, proposal)
val claimOut = IndyClaim(identifier, claimReq, claim, listOf(prover))
val claimOut = IndyClaim(identifier, claimReq, claim, listOf(ourIdentity, prover))
StateAndContract(claimOut, ClaimChecker::class.java.name)
}

Expand Down

0 comments on commit e1c08d9

Please sign in to comment.