diff --git a/.gitignore b/.gitignore index 444afe9e..e199959b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,9 @@ Created by https://www.gitignore.io/api/vim,java,maven,gradle,java-web,intellij, .idea/**/gradle.xml .idea/**/libraries +.idea/*.xml +.idea/vcs.xml + # CMake cmake-build-debug/ diff --git a/build.gradle b/build.gradle index aa72a414..12e20020 100644 --- a/build.gradle +++ b/build.gradle @@ -2,16 +2,14 @@ buildscript { dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:2.4.3" + classpath "org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:1.1.2" } - - dependencies { - classpath "gradle.plugin.com.hierynomus.gradle.plugins:license-gradle-plugin:0.15.0" - } + } plugins { id 'com.github.spotbugs' version '4.7.0' - id "com.github.hierynomus.license" version "0.15.0" + id "com.github.hierynomus.license-report" version "0.15.0" } import com.github.spotbugs.snom.SpotBugsTask @@ -34,7 +32,7 @@ apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'idea' apply plugin: 'io.spring.dependency-management' -apply plugin: "com.github.hierynomus.license" +apply plugin: 'jsonschema2pojo' if (!gradle.startParameter.isOffline()) { apply plugin: 'checkstyle' @@ -82,13 +80,14 @@ List lombok = [ "org.projectlombok:lombok:1.18.10" ] +def log4j_version="2.18.0" List logger = [ "org.slf4j:jul-to-slf4j:1.7.30", - "org.apache.logging.log4j:log4j-api:2.15.0", - "org.apache.logging.log4j:log4j-core:2.15.0", - "org.apache.logging.log4j:log4j-slf4j-impl:2.15.0", - "org.apache.logging.log4j:log4j-web:2.15.0", - "org.apache.logging.log4j:log4j-jcl:2.15.0", + "org.apache.logging.log4j:log4j-api:$log4j_version", + "org.apache.logging.log4j:log4j-core:$log4j_version", + "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version", + "org.apache.logging.log4j:log4j-web:$log4j_version", + "org.apache.logging.log4j:log4j-jcl:$log4j_version", "com.lmax:disruptor:3.3.7" ] @@ -107,12 +106,18 @@ List jmockit = [ "org.jmockit:jmockit:1.47" ] +def jackson_version="2.13.3" List json = [ - "com.fasterxml.jackson.core:jackson-databind:2.11.4", - "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.11.0", - "com.github.fge:json-schema-validator:2.2.6", - "com.github.reinert:jjschema:1.16", - "org.jsonschema2pojo:jsonschema2pojo-core:1.1.1" + "com.fasterxml.jackson.core:jackson-databind:$jackson_version", + "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jackson_version", + "com.fasterxml.jackson.module:jackson-module-jsonSchema:$jackson_version", + "com.github.fge:json-schema-validator:2.2.6", //LGPL +// "com.github.reinert:jjschema:1.16", //LGPL + "org.jsonschema2pojo:jsonschema2pojo-core:1.1.2", //apache + "org.jsonschema2pojo:jsonschema2pojo-gradle-plugin:1.1.2", //apache + "com.networknt:json-schema-validator:1.0.71", // apache +// "com.github.victools:jsonschema-generator:4.25.0", // generate schema from java + ] List mysql_driver = [ @@ -156,6 +161,11 @@ configurations { } dependencies { + compile ("uk.co.gresearch.siembol:siembol-common:2.5.0") { + exclude group: "com.github.java-json-tools" + exclude group: "org.apache.kafka" + } + localDeps 'org.projectlombok:lombok:1.18.10' if (!gradle.startParameter.isOffline()) { @@ -322,7 +332,7 @@ if (!gradle.startParameter.isOffline()) { } } - uploadArchives { + uploadArchives { repositories { mavenDeployer { // beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } @@ -381,3 +391,44 @@ gradle.taskGraph.whenReady { taskGraph -> } } } + +// Each configuration is set to the default value +jsonSchema2Pojo { + + // Location of the JSON Schema file(s). This may refer to a single file or a directory of files. +// source = files("${sourceSets.main.output.resourcesDir}/json") + source = files("D:\\projects\\weid\\WeIdentity\\src\\test\\resources\\cpt") + + // Target directory for generated Java source files. The plugin will add this directory to the + // java source set so the compiler will find and compile the newly generated source files. + targetDirectory = file("${project.buildDir}/generated-sources/js2p") + + // Package name used for generated Java classes (for types where a fully qualified name has not + // been supplied in the schema using the 'javaType' property). + targetPackage = '' + +} + + +//downloadLicenses { +// ext.apacheTwo = license('Apache License, Version 2.0', 'http://opensource.org/licenses/Apache-2.0') +// ext.bsd = license('BSD License', 'http://www.opensource.org/licenses/bsd-license.php') +// +// includeProjectDependencies = true +// licenses = [ +// (group('com.myproject.foo')) : license('My Company License'), +// 'org.apache.james:apache-mime4j:0.6' : apacheTwo, +// 'org.some-bsd:project:1.0' : bsd +// ] +// +// aliases = [ +// (apacheTwo) : ['The Apache Software License, Version 2.0', 'Apache 2', 'Apache License Version 2.0', 'Apache License, Version 2.0', 'Apache License 2.0', license('Apache License', 'http://www.apache.org/licenses/LICENSE-2.0')], +// (bsd) : ['BSD', license('New BSD License', 'http://www.opensource.org/licenses/bsd-license.php')] +// ] +// +// excludeDependencies = [ +// 'com.some-other-project.bar:foobar:1.0' +// ] +// +// dependencyConfiguration = 'compile' +//} \ No newline at end of file diff --git a/src/main/java/com/webank/weid/protocol/cpt/Cpt109.java b/src/main/java/com/webank/weid/protocol/cpt/Cpt109.java index 2a0b18a1..1f7cd6d0 100644 --- a/src/main/java/com/webank/weid/protocol/cpt/Cpt109.java +++ b/src/main/java/com/webank/weid/protocol/cpt/Cpt109.java @@ -35,12 +35,12 @@ public class Cpt109 { /** - * caculate the hash from the entire list rather than from any single credential. + * calculate the hash from the entire list rather than from any single credential. */ String claimHash; /** - * trusted timestamping provided by the trusted third party or by the consensus of each node in + * trusted timestamp provided by the trusted third party or by the consensus of each node in * the consortium chain. */ Long timestamp; diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt101.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt101.java new file mode 100644 index 00000000..aa353512 --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt101.java @@ -0,0 +1,245 @@ +package com.webank.weid.protocol.cpt.v2; + +import java.util.LinkedHashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * Data Authorization Token + *

+ * Authorize data between WeIDs via the exposed Service Endpoint + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "duration", + "fromWeId", + "resourceId", + "serviceUrl", + "toWeId" +}) +@Generated("jsonschema2pojo") +public class Cpt101 { + + /** + * Authorize to this WeID + * (Required) + * + */ + @JsonProperty("duration") + @JsonPropertyDescription("Authorize to this WeID") + private Integer duration; + /** + * Authorize from this WeID + * (Required) + * + */ + @JsonProperty("fromWeId") + @JsonPropertyDescription("Authorize from this WeID") + private String fromWeId; + /** + * Authorized Resource ID + * (Required) + * + */ + @JsonProperty("resourceId") + @JsonPropertyDescription("Authorized Resource ID") + private String resourceId; + /** + * Service Endpoint URL + * (Required) + * + */ + @JsonProperty("serviceUrl") + @JsonPropertyDescription("Service Endpoint URL") + private String serviceUrl; + /** + * Duration of Validity in seconds + * (Required) + * + */ + @JsonProperty("toWeId") + @JsonPropertyDescription("Duration of Validity in seconds") + private String toWeId; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * Authorize to this WeID + * (Required) + * + */ + @JsonProperty("duration") + public Integer getDuration() { + return duration; + } + + /** + * Authorize to this WeID + * (Required) + * + */ + @JsonProperty("duration") + public void setDuration(Integer duration) { + this.duration = duration; + } + + /** + * Authorize from this WeID + * (Required) + * + */ + @JsonProperty("fromWeId") + public String getFromWeId() { + return fromWeId; + } + + /** + * Authorize from this WeID + * (Required) + * + */ + @JsonProperty("fromWeId") + public void setFromWeId(String fromWeId) { + this.fromWeId = fromWeId; + } + + /** + * Authorized Resource ID + * (Required) + * + */ + @JsonProperty("resourceId") + public String getResourceId() { + return resourceId; + } + + /** + * Authorized Resource ID + * (Required) + * + */ + @JsonProperty("resourceId") + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + /** + * Service Endpoint URL + * (Required) + * + */ + @JsonProperty("serviceUrl") + public String getServiceUrl() { + return serviceUrl; + } + + /** + * Service Endpoint URL + * (Required) + * + */ + @JsonProperty("serviceUrl") + public void setServiceUrl(String serviceUrl) { + this.serviceUrl = serviceUrl; + } + + /** + * Duration of Validity in seconds + * (Required) + * + */ + @JsonProperty("toWeId") + public String getToWeId() { + return toWeId; + } + + /** + * Duration of Validity in seconds + * (Required) + * + */ + @JsonProperty("toWeId") + public void setToWeId(String toWeId) { + this.toWeId = toWeId; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt101 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("duration"); + sb.append('='); + sb.append(((this.duration == null)?"":this.duration)); + sb.append(','); + sb.append("fromWeId"); + sb.append('='); + sb.append(((this.fromWeId == null)?"":this.fromWeId)); + sb.append(','); + sb.append("resourceId"); + sb.append('='); + sb.append(((this.resourceId == null)?"":this.resourceId)); + sb.append(','); + sb.append("serviceUrl"); + sb.append('='); + sb.append(((this.serviceUrl == null)?"":this.serviceUrl)); + sb.append(','); + sb.append("toWeId"); + sb.append('='); + sb.append(((this.toWeId == null)?"":this.toWeId)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.duration == null)? 0 :this.duration.hashCode())); + result = ((result* 31)+((this.fromWeId == null)? 0 :this.fromWeId.hashCode())); + result = ((result* 31)+((this.resourceId == null)? 0 :this.resourceId.hashCode())); + result = ((result* 31)+((this.toWeId == null)? 0 :this.toWeId.hashCode())); + result = ((result* 31)+((this.serviceUrl == null)? 0 :this.serviceUrl.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt101) == false) { + return false; + } + Cpt101 rhs = ((Cpt101) other); + return (((((((this.duration == rhs.duration)||((this.duration!= null)&&this.duration.equals(rhs.duration)))&&((this.fromWeId == rhs.fromWeId)||((this.fromWeId!= null)&&this.fromWeId.equals(rhs.fromWeId))))&&((this.resourceId == rhs.resourceId)||((this.resourceId!= null)&&this.resourceId.equals(rhs.resourceId))))&&((this.toWeId == rhs.toWeId)||((this.toWeId!= null)&&this.toWeId.equals(rhs.toWeId))))&&((this.serviceUrl == rhs.serviceUrl)||((this.serviceUrl!= null)&&this.serviceUrl.equals(rhs.serviceUrl))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt103.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt103.java new file mode 100644 index 00000000..3488019b --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt103.java @@ -0,0 +1,171 @@ +package com.webank.weid.protocol.cpt.v2; + +import com.webank.weid.protocol.base.Challenge; +import java.util.LinkedHashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "challenge", + "id", + "proof" +}) +@Generated("jsonschema2pojo") +public class Cpt103 { + + /** + * The challenge + * (Required) + * + */ + @JsonProperty("challenge") + @JsonPropertyDescription("The challenge") + private Challenge challenge; + /** + * The entity's weidentity did + * (Required) + * + */ + @JsonProperty("id") + @JsonPropertyDescription("The entity's weidentity did") + private String id; + /** + * The proof + * (Required) + * + */ + @JsonProperty("proof") + @JsonPropertyDescription("The proof") + private String proof; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * The challenge + * (Required) + * + */ + @JsonProperty("challenge") + public Challenge getChallenge() { + return challenge; + } + + /** + * The challenge + * (Required) + * + */ + @JsonProperty("challenge") + public void setChallenge(Challenge challenge) { + this.challenge = challenge; + } + + /** + * The entity's weidentity did + * (Required) + * + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * The entity's weidentity did + * (Required) + * + */ + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + /** + * The proof + * (Required) + * + */ + @JsonProperty("proof") + public String getProof() { + return proof; + } + + /** + * The proof + * (Required) + * + */ + @JsonProperty("proof") + public void setProof(String proof) { + this.proof = proof; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt103 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("challenge"); + sb.append('='); + sb.append(((this.challenge == null)?"":this.challenge)); + sb.append(','); + sb.append("id"); + sb.append('='); + sb.append(((this.id == null)?"":this.id)); + sb.append(','); + sb.append("proof"); + sb.append('='); + sb.append(((this.proof == null)?"":this.proof)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.challenge == null)? 0 :this.challenge.hashCode())); + result = ((result* 31)+((this.id == null)? 0 :this.id.hashCode())); + result = ((result* 31)+((this.proof == null)? 0 :this.proof.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt103) == false) { + return false; + } + Cpt103 rhs = ((Cpt103) other); + return (((((this.challenge == rhs.challenge)||((this.challenge!= null)&&this.challenge.equals(rhs.challenge)))&&((this.id == rhs.id)||((this.id!= null)&&this.id.equals(rhs.id))))&&((this.proof == rhs.proof)||((this.proof!= null)&&this.proof.equals(rhs.proof))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt105.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt105.java new file mode 100644 index 00000000..97e4e979 --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt105.java @@ -0,0 +1,279 @@ +package com.webank.weid.protocol.cpt.v2; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * API Endpoint + *

+ * API Endpoint address disclosure + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "argType", + "description", + "endpointName", + "hostport", + "id", + "version" +}) +@Generated("jsonschema2pojo") +public class Cpt105 { + + /** + * Argument types in sequence + * (Required) + * + */ + @JsonProperty("argType") + @JsonPropertyDescription("Argument types in sequence") + private List argType = new ArrayList(); + /** + * + * (Required) + * + */ + @JsonProperty("description") + private String description; + /** + * + * (Required) + * + */ + @JsonProperty("endpointName") + private String endpointName; + /** + * Network host and port + * (Required) + * + */ + @JsonProperty("hostport") + @JsonPropertyDescription("Network host and port") + private String hostport; + /** + * Owner WeIdentity DID + * (Required) + * + */ + @JsonProperty("id") + @JsonPropertyDescription("Owner WeIdentity DID") + private String id; + /** + * API Version + * (Required) + * + */ + @JsonProperty("version") + @JsonPropertyDescription("API Version") + private String version; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * Argument types in sequence + * (Required) + * + */ + @JsonProperty("argType") + public List getArgType() { + return argType; + } + + /** + * Argument types in sequence + * (Required) + * + */ + @JsonProperty("argType") + public void setArgType(List argType) { + this.argType = argType; + } + + /** + * + * (Required) + * + */ + @JsonProperty("description") + public String getDescription() { + return description; + } + + /** + * + * (Required) + * + */ + @JsonProperty("description") + public void setDescription(String description) { + this.description = description; + } + + /** + * + * (Required) + * + */ + @JsonProperty("endpointName") + public String getEndpointName() { + return endpointName; + } + + /** + * + * (Required) + * + */ + @JsonProperty("endpointName") + public void setEndpointName(String endpointName) { + this.endpointName = endpointName; + } + + /** + * Network host and port + * (Required) + * + */ + @JsonProperty("hostport") + public String getHostport() { + return hostport; + } + + /** + * Network host and port + * (Required) + * + */ + @JsonProperty("hostport") + public void setHostport(String hostport) { + this.hostport = hostport; + } + + /** + * Owner WeIdentity DID + * (Required) + * + */ + @JsonProperty("id") + public String getId() { + return id; + } + + /** + * Owner WeIdentity DID + * (Required) + * + */ + @JsonProperty("id") + public void setId(String id) { + this.id = id; + } + + /** + * API Version + * (Required) + * + */ + @JsonProperty("version") + public String getVersion() { + return version; + } + + /** + * API Version + * (Required) + * + */ + @JsonProperty("version") + public void setVersion(String version) { + this.version = version; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt105 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("argType"); + sb.append('='); + sb.append(((this.argType == null)?"":this.argType)); + sb.append(','); + sb.append("description"); + sb.append('='); + sb.append(((this.description == null)?"":this.description)); + sb.append(','); + sb.append("endpointName"); + sb.append('='); + sb.append(((this.endpointName == null)?"":this.endpointName)); + sb.append(','); + sb.append("hostport"); + sb.append('='); + sb.append(((this.hostport == null)?"":this.hostport)); + sb.append(','); + sb.append("id"); + sb.append('='); + sb.append(((this.id == null)?"":this.id)); + sb.append(','); + sb.append("version"); + sb.append('='); + sb.append(((this.version == null)?"":this.version)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.argType == null)? 0 :this.argType.hashCode())); + result = ((result* 31)+((this.description == null)? 0 :this.description.hashCode())); + result = ((result* 31)+((this.endpointName == null)? 0 :this.endpointName.hashCode())); + result = ((result* 31)+((this.hostport == null)? 0 :this.hostport.hashCode())); + result = ((result* 31)+((this.id == null)? 0 :this.id.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + result = ((result* 31)+((this.version == null)? 0 :this.version.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt105) == false) { + return false; + } + Cpt105 rhs = ((Cpt105) other); + return ((((((((this.argType == rhs.argType)||((this.argType!= null)&&this.argType.equals(rhs.argType)))&&((this.description == rhs.description)||((this.description!= null)&&this.description.equals(rhs.description))))&&((this.endpointName == rhs.endpointName)||((this.endpointName!= null)&&this.endpointName.equals(rhs.endpointName))))&&((this.hostport == rhs.hostport)||((this.hostport!= null)&&this.hostport.equals(rhs.hostport))))&&((this.id == rhs.id)||((this.id!= null)&&this.id.equals(rhs.id))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.version == rhs.version)||((this.version!= null)&&this.version.equals(rhs.version)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt106.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt106.java new file mode 100644 index 00000000..53df8869 --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt106.java @@ -0,0 +1,112 @@ +package com.webank.weid.protocol.cpt.v2; + +import com.webank.weid.protocol.base.Credential; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * Embedded Signature + *

+ * Embedded Signature object for multi-sign + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "credentialList" +}) +@Generated("jsonschema2pojo") +public class Cpt106 { + + /** + * Original credential list to be signed + * (Required) + * + */ + @JsonProperty("credentialList") + @JsonPropertyDescription("Original credential list to be signed") + private List credentialList = new ArrayList(); + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * Original credential list to be signed + * (Required) + * + */ + @JsonProperty("credentialList") + public List getCredentialList() { + return credentialList; + } + + /** + * Original credential list to be signed + * (Required) + * + */ + @JsonProperty("credentialList") + public void setCredentialList(List credentialList) { + this.credentialList = credentialList; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt106 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("credentialList"); + sb.append('='); + sb.append(((this.credentialList == null)?"":this.credentialList)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.credentialList == null)? 0 :this.credentialList.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt106) == false) { + return false; + } + Cpt106 rhs = ((Cpt106) other); + return (((this.credentialList == rhs.credentialList)||((this.credentialList!= null)&&this.credentialList.equals(rhs.credentialList)))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt107.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt107.java new file mode 100644 index 00000000..dfdf4171 --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt107.java @@ -0,0 +1,110 @@ +package com.webank.weid.protocol.cpt.v2; + +import com.webank.weid.protocol.base.CredentialPojo; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * Embedded Signature + *

+ * Embedded Signature object for multi-sign + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "credentialList" +}) +@Generated("jsonschema2pojo") +public class Cpt107 { + + /** + * + * (Required) + * + */ + @JsonProperty("credentialList") + private List credentialList = new ArrayList(); + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * + * (Required) + * + */ + @JsonProperty("credentialList") + public List getCredentialList() { + return credentialList; + } + + /** + * + * (Required) + * + */ + @JsonProperty("credentialList") + public void setCredentialList(List credentialList) { + this.credentialList = credentialList; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt107 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("credentialList"); + sb.append('='); + sb.append(((this.credentialList == null)?"":this.credentialList)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.credentialList == null)? 0 :this.credentialList.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt107) == false) { + return false; + } + Cpt107 rhs = ((Cpt107) other); + return (((this.credentialList == rhs.credentialList)||((this.credentialList!= null)&&this.credentialList.equals(rhs.credentialList)))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt108.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt108.java new file mode 100644 index 00000000..de77678a --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt108.java @@ -0,0 +1,248 @@ +package com.webank.weid.protocol.cpt.v2; + +import com.webank.weid.protocol.base.CredentialPojo; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * Trusted timestamping + *

+ * Trusted timestamping envelope + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "authoritySignature", + "claimHash", + "credentialList", + "timestamp", + "timestampAuthority" +}) +@Generated("jsonschema2pojo") +public class Cpt108 { + + /** + * Signature value from Authority, signed by Timestamp authority. authoritySignature = sign( hashKey ) + * (Required) + * + */ + @JsonProperty("authoritySignature") + @JsonPropertyDescription("Signature value from Authority, signed by Timestamp authority. authoritySignature = sign( hashKey )") + private String authoritySignature; + /** + * calculate the hash from the credentials. + * (Required) + * + */ + @JsonProperty("claimHash") + @JsonPropertyDescription("calculate the hash from the credentials.") + private String claimHash; + /** + * Original credential list to be signed + * (Required) + * + */ + @JsonProperty("credentialList") + @JsonPropertyDescription("Original credential list to be signed") + private List credentialList = new ArrayList(); + /** + * trusted timestamping provided by the trusted third party or by the consensus of each node in the consortium chain + * (Required) + * + */ + @JsonProperty("timestamp") + @JsonPropertyDescription("trusted timestamping provided by the trusted third party or by the consensus of each node in the consortium chain") + private Integer timestamp; + /** + * information about timestamp authority + * (Required) + * + */ + @JsonProperty("timestampAuthority") + @JsonPropertyDescription("information about timestamp authority") + private String timestampAuthority; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * Signature value from Authority, signed by Timestamp authority. authoritySignature = sign( hashKey ) + * (Required) + * + */ + @JsonProperty("authoritySignature") + public String getAuthoritySignature() { + return authoritySignature; + } + + /** + * Signature value from Authority, signed by Timestamp authority. authoritySignature = sign( hashKey ) + * (Required) + * + */ + @JsonProperty("authoritySignature") + public void setAuthoritySignature(String authoritySignature) { + this.authoritySignature = authoritySignature; + } + + /** + * calculate the hash from the credentials. + * (Required) + * + */ + @JsonProperty("claimHash") + public String getClaimHash() { + return claimHash; + } + + /** + * calculate the hash from the credentials. + * (Required) + * + */ + @JsonProperty("claimHash") + public void setClaimHash(String claimHash) { + this.claimHash = claimHash; + } + + /** + * Original credential list to be signed + * (Required) + * + */ + @JsonProperty("credentialList") + public List getCredentialList() { + return credentialList; + } + + /** + * Original credential list to be signed + * (Required) + * + */ + @JsonProperty("credentialList") + public void setCredentialList(List credentialList) { + this.credentialList = credentialList; + } + + /** + * trusted timestamping provided by the trusted third party or by the consensus of each node in the consortium chain + * (Required) + * + */ + @JsonProperty("timestamp") + public Integer getTimestamp() { + return timestamp; + } + + /** + * trusted timestamping provided by the trusted third party or by the consensus of each node in the consortium chain + * (Required) + * + */ + @JsonProperty("timestamp") + public void setTimestamp(Integer timestamp) { + this.timestamp = timestamp; + } + + /** + * information about timestamp authority + * (Required) + * + */ + @JsonProperty("timestampAuthority") + public String getTimestampAuthority() { + return timestampAuthority; + } + + /** + * information about timestamp authority + * (Required) + * + */ + @JsonProperty("timestampAuthority") + public void setTimestampAuthority(String timestampAuthority) { + this.timestampAuthority = timestampAuthority; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt108 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("authoritySignature"); + sb.append('='); + sb.append(((this.authoritySignature == null)?"":this.authoritySignature)); + sb.append(','); + sb.append("claimHash"); + sb.append('='); + sb.append(((this.claimHash == null)?"":this.claimHash)); + sb.append(','); + sb.append("credentialList"); + sb.append('='); + sb.append(((this.credentialList == null)?"":this.credentialList)); + sb.append(','); + sb.append("timestamp"); + sb.append('='); + sb.append(((this.timestamp == null)?"":this.timestamp)); + sb.append(','); + sb.append("timestampAuthority"); + sb.append('='); + sb.append(((this.timestampAuthority == null)?"":this.timestampAuthority)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.timestampAuthority == null)? 0 :this.timestampAuthority.hashCode())); + result = ((result* 31)+((this.authoritySignature == null)? 0 :this.authoritySignature.hashCode())); + result = ((result* 31)+((this.claimHash == null)? 0 :this.claimHash.hashCode())); + result = ((result* 31)+((this.credentialList == null)? 0 :this.credentialList.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + result = ((result* 31)+((this.timestamp == null)? 0 :this.timestamp.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt108) == false) { + return false; + } + Cpt108 rhs = ((Cpt108) other); + return (((((((this.timestampAuthority == rhs.timestampAuthority)||((this.timestampAuthority!= null)&&this.timestampAuthority.equals(rhs.timestampAuthority)))&&((this.authoritySignature == rhs.authoritySignature)||((this.authoritySignature!= null)&&this.authoritySignature.equals(rhs.authoritySignature))))&&((this.claimHash == rhs.claimHash)||((this.claimHash!= null)&&this.claimHash.equals(rhs.claimHash))))&&((this.credentialList == rhs.credentialList)||((this.credentialList!= null)&&this.credentialList.equals(rhs.credentialList))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.timestamp == rhs.timestamp)||((this.timestamp!= null)&&this.timestamp.equals(rhs.timestamp)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt109.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt109.java new file mode 100644 index 00000000..fbe0ef63 --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt109.java @@ -0,0 +1,211 @@ +package com.webank.weid.protocol.cpt.v2; + +import java.util.LinkedHashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * Trusted Timestamp + *

+ * Trusted Timestamp from authorized 3rd-party, or chain consensus + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "claimHash", + "hashKey", + "signatureList", + "timestamp" +}) +@Generated("jsonschema2pojo") +public class Cpt109 { + + /** + * calculate the hash from the entire list rather than from any single credential + * (Required) + * + */ + @JsonProperty("claimHash") + @JsonPropertyDescription("calculate the hash from the entire list rather than from any single credential") + private String claimHash; + /** + * hashKey = hash(claimHash + timestamp) hashKey will be the key in the smart contract + * (Required) + * + */ + @JsonProperty("hashKey") + @JsonPropertyDescription("hashKey = hash(claimHash + timestamp) hashKey will be the key in the smart contract") + private String hashKey; + /** + * signed by Timestamp authority signature = sign( hashKey ) + * (Required) + * + */ + @JsonProperty("signatureList") + @JsonPropertyDescription("signed by Timestamp authority signature = sign( hashKey )") + private String signatureList; + /** + * trusted timestamp provided by the trusted third party or by the consensus of each node in the consortium chain + * (Required) + * + */ + @JsonProperty("timestamp") + @JsonPropertyDescription("trusted timestamp provided by the trusted third party or by the consensus of each node in the consortium chain") + private Integer timestamp; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * calculate the hash from the entire list rather than from any single credential + * (Required) + * + */ + @JsonProperty("claimHash") + public String getClaimHash() { + return claimHash; + } + + /** + * calculate the hash from the entire list rather than from any single credential + * (Required) + * + */ + @JsonProperty("claimHash") + public void setClaimHash(String claimHash) { + this.claimHash = claimHash; + } + + /** + * hashKey = hash(claimHash + timestamp) hashKey will be the key in the smart contract + * (Required) + * + */ + @JsonProperty("hashKey") + public String getHashKey() { + return hashKey; + } + + /** + * hashKey = hash(claimHash + timestamp) hashKey will be the key in the smart contract + * (Required) + * + */ + @JsonProperty("hashKey") + public void setHashKey(String hashKey) { + this.hashKey = hashKey; + } + + /** + * signed by Timestamp authority signature = sign( hashKey ) + * (Required) + * + */ + @JsonProperty("signatureList") + public String getSignatureList() { + return signatureList; + } + + /** + * signed by Timestamp authority signature = sign( hashKey ) + * (Required) + * + */ + @JsonProperty("signatureList") + public void setSignatureList(String signatureList) { + this.signatureList = signatureList; + } + + /** + * trusted timestamp provided by the trusted third party or by the consensus of each node in the consortium chain + * (Required) + * + */ + @JsonProperty("timestamp") + public Integer getTimestamp() { + return timestamp; + } + + /** + * trusted timestamp provided by the trusted third party or by the consensus of each node in the consortium chain + * (Required) + * + */ + @JsonProperty("timestamp") + public void setTimestamp(Integer timestamp) { + this.timestamp = timestamp; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt109 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("claimHash"); + sb.append('='); + sb.append(((this.claimHash == null)?"":this.claimHash)); + sb.append(','); + sb.append("hashKey"); + sb.append('='); + sb.append(((this.hashKey == null)?"":this.hashKey)); + sb.append(','); + sb.append("signatureList"); + sb.append('='); + sb.append(((this.signatureList == null)?"":this.signatureList)); + sb.append(','); + sb.append("timestamp"); + sb.append('='); + sb.append(((this.timestamp == null)?"":this.timestamp)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.signatureList == null)? 0 :this.signatureList.hashCode())); + result = ((result* 31)+((this.hashKey == null)? 0 :this.hashKey.hashCode())); + result = ((result* 31)+((this.claimHash == null)? 0 :this.claimHash.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + result = ((result* 31)+((this.timestamp == null)? 0 :this.timestamp.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt109) == false) { + return false; + } + Cpt109 rhs = ((Cpt109) other); + return ((((((this.signatureList == rhs.signatureList)||((this.signatureList!= null)&&this.signatureList.equals(rhs.signatureList)))&&((this.hashKey == rhs.hashKey)||((this.hashKey!= null)&&this.hashKey.equals(rhs.hashKey))))&&((this.claimHash == rhs.claimHash)||((this.claimHash!= null)&&this.claimHash.equals(rhs.claimHash))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.timestamp == rhs.timestamp)||((this.timestamp!= null)&&this.timestamp.equals(rhs.timestamp)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt11.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt11.java new file mode 100644 index 00000000..4fa3022f --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt11.java @@ -0,0 +1,243 @@ +package com.webank.weid.protocol.cpt.v2; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * test cpt + *

+ * Reserved CPT 11 + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "cptId", + "gender", + "tags", + "userId", + "userName" +}) +@Generated("jsonschema2pojo") +public class Cpt11 { + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + private Integer cptId; + /** + * + * (Required) + * + */ + @JsonProperty("gender") + private String gender; + /** + * Registered Tags + * (Required) + * + */ + @JsonProperty("tags") + @JsonPropertyDescription("Registered Tags") + private List tags = new ArrayList(); + /** + * + * (Required) + * + */ + @JsonProperty("userId") + private String userId; + /** + * + * (Required) + * + */ + @JsonProperty("userName") + private String userName; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + public Integer getCptId() { + return cptId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + public void setCptId(Integer cptId) { + this.cptId = cptId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("gender") + public String getGender() { + return gender; + } + + /** + * + * (Required) + * + */ + @JsonProperty("gender") + public void setGender(String gender) { + this.gender = gender; + } + + /** + * Registered Tags + * (Required) + * + */ + @JsonProperty("tags") + public List getTags() { + return tags; + } + + /** + * Registered Tags + * (Required) + * + */ + @JsonProperty("tags") + public void setTags(List tags) { + this.tags = tags; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userId") + public String getUserId() { + return userId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userId") + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userName") + public String getUserName() { + return userName; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userName") + public void setUserName(String userName) { + this.userName = userName; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt11 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("cptId"); + sb.append('='); + sb.append(((this.cptId == null)?"":this.cptId)); + sb.append(','); + sb.append("gender"); + sb.append('='); + sb.append(((this.gender == null)?"":this.gender)); + sb.append(','); + sb.append("tags"); + sb.append('='); + sb.append(((this.tags == null)?"":this.tags)); + sb.append(','); + sb.append("userId"); + sb.append('='); + sb.append(((this.userId == null)?"":this.userId)); + sb.append(','); + sb.append("userName"); + sb.append('='); + sb.append(((this.userName == null)?"":this.userName)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.gender == null)? 0 :this.gender.hashCode())); + result = ((result* 31)+((this.cptId == null)? 0 :this.cptId.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + result = ((result* 31)+((this.userName == null)? 0 :this.userName.hashCode())); + result = ((result* 31)+((this.userId == null)? 0 :this.userId.hashCode())); + result = ((result* 31)+((this.tags == null)? 0 :this.tags.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt11) == false) { + return false; + } + Cpt11 rhs = ((Cpt11) other); + return (((((((this.gender == rhs.gender)||((this.gender!= null)&&this.gender.equals(rhs.gender)))&&((this.cptId == rhs.cptId)||((this.cptId!= null)&&this.cptId.equals(rhs.cptId))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.userName == rhs.userName)||((this.userName!= null)&&this.userName.equals(rhs.userName))))&&((this.userId == rhs.userId)||((this.userId!= null)&&this.userId.equals(rhs.userId))))&&((this.tags == rhs.tags)||((this.tags!= null)&&this.tags.equals(rhs.tags)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt110.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt110.java new file mode 100644 index 00000000..9c143571 --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt110.java @@ -0,0 +1,272 @@ +package com.webank.weid.protocol.cpt.v2; + +import java.util.LinkedHashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * Metadata CPT + *

+ * User request issuer to sign credential + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "context", + "cptId", + "credentialId", + "expirationDate", + "issuanceDate", + "issuer" +}) +@Generated("jsonschema2pojo") +public class Cpt110 { + + /** + * + * (Required) + * + */ + @JsonProperty("context") + private String context; + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + private Integer cptId; + /** + * + * (Required) + * + */ + @JsonProperty("credentialId") + private String credentialId; + /** + * + * (Required) + * + */ + @JsonProperty("expirationDate") + private Integer expirationDate; + /** + * + * (Required) + * + */ + @JsonProperty("issuanceDate") + private Integer issuanceDate; + /** + * + * (Required) + * + */ + @JsonProperty("issuer") + private String issuer; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * + * (Required) + * + */ + @JsonProperty("context") + public String getContext() { + return context; + } + + /** + * + * (Required) + * + */ + @JsonProperty("context") + public void setContext(String context) { + this.context = context; + } + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + public Integer getCptId() { + return cptId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + public void setCptId(Integer cptId) { + this.cptId = cptId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("credentialId") + public String getCredentialId() { + return credentialId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("credentialId") + public void setCredentialId(String credentialId) { + this.credentialId = credentialId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("expirationDate") + public Integer getExpirationDate() { + return expirationDate; + } + + /** + * + * (Required) + * + */ + @JsonProperty("expirationDate") + public void setExpirationDate(Integer expirationDate) { + this.expirationDate = expirationDate; + } + + /** + * + * (Required) + * + */ + @JsonProperty("issuanceDate") + public Integer getIssuanceDate() { + return issuanceDate; + } + + /** + * + * (Required) + * + */ + @JsonProperty("issuanceDate") + public void setIssuanceDate(Integer issuanceDate) { + this.issuanceDate = issuanceDate; + } + + /** + * + * (Required) + * + */ + @JsonProperty("issuer") + public String getIssuer() { + return issuer; + } + + /** + * + * (Required) + * + */ + @JsonProperty("issuer") + public void setIssuer(String issuer) { + this.issuer = issuer; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt110 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("context"); + sb.append('='); + sb.append(((this.context == null)?"":this.context)); + sb.append(','); + sb.append("cptId"); + sb.append('='); + sb.append(((this.cptId == null)?"":this.cptId)); + sb.append(','); + sb.append("credentialId"); + sb.append('='); + sb.append(((this.credentialId == null)?"":this.credentialId)); + sb.append(','); + sb.append("expirationDate"); + sb.append('='); + sb.append(((this.expirationDate == null)?"":this.expirationDate)); + sb.append(','); + sb.append("issuanceDate"); + sb.append('='); + sb.append(((this.issuanceDate == null)?"":this.issuanceDate)); + sb.append(','); + sb.append("issuer"); + sb.append('='); + sb.append(((this.issuer == null)?"":this.issuer)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.cptId == null)? 0 :this.cptId.hashCode())); + result = ((result* 31)+((this.issuanceDate == null)? 0 :this.issuanceDate.hashCode())); + result = ((result* 31)+((this.context == null)? 0 :this.context.hashCode())); + result = ((result* 31)+((this.credentialId == null)? 0 :this.credentialId.hashCode())); + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + result = ((result* 31)+((this.issuer == null)? 0 :this.issuer.hashCode())); + result = ((result* 31)+((this.expirationDate == null)? 0 :this.expirationDate.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt110) == false) { + return false; + } + Cpt110 rhs = ((Cpt110) other); + return ((((((((this.cptId == rhs.cptId)||((this.cptId!= null)&&this.cptId.equals(rhs.cptId)))&&((this.issuanceDate == rhs.issuanceDate)||((this.issuanceDate!= null)&&this.issuanceDate.equals(rhs.issuanceDate))))&&((this.context == rhs.context)||((this.context!= null)&&this.context.equals(rhs.context))))&&((this.credentialId == rhs.credentialId)||((this.credentialId!= null)&&this.credentialId.equals(rhs.credentialId))))&&((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties))))&&((this.issuer == rhs.issuer)||((this.issuer!= null)&&this.issuer.equals(rhs.issuer))))&&((this.expirationDate == rhs.expirationDate)||((this.expirationDate!= null)&&this.expirationDate.equals(rhs.expirationDate)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt111.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt111.java new file mode 100644 index 00000000..b33ff06a --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt111.java @@ -0,0 +1,175 @@ +package com.webank.weid.protocol.cpt.v2; + +import java.util.LinkedHashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyDescription; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + + +/** + * User CPT + *

+ * User request issuer to sign credential + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "cptId", + "credentialSignatureRequest", + "userNonce" +}) +@Generated("jsonschema2pojo") +public class Cpt111 { + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + private String cptId; + /** + * credential Signature Request + * (Required) + * + */ + @JsonProperty("credentialSignatureRequest") + @JsonPropertyDescription("credential Signature Request") + private String credentialSignatureRequest; + /** + * + * (Required) + * + */ + @JsonProperty("userNonce") + private String userNonce; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + public String getCptId() { + return cptId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + public void setCptId(String cptId) { + this.cptId = cptId; + } + + /** + * credential Signature Request + * (Required) + * + */ + @JsonProperty("credentialSignatureRequest") + public String getCredentialSignatureRequest() { + return credentialSignatureRequest; + } + + /** + * credential Signature Request + * (Required) + * + */ + @JsonProperty("credentialSignatureRequest") + public void setCredentialSignatureRequest(String credentialSignatureRequest) { + this.credentialSignatureRequest = credentialSignatureRequest; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userNonce") + public String getUserNonce() { + return userNonce; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userNonce") + public void setUserNonce(String userNonce) { + this.userNonce = userNonce; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt111 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("cptId"); + sb.append('='); + sb.append(((this.cptId == null)?"":this.cptId)); + sb.append(','); + sb.append("credentialSignatureRequest"); + sb.append('='); + sb.append(((this.credentialSignatureRequest == null)?"":this.credentialSignatureRequest)); + sb.append(','); + sb.append("userNonce"); + sb.append('='); + sb.append(((this.userNonce == null)?"":this.userNonce)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + result = ((result* 31)+((this.cptId == null)? 0 :this.cptId.hashCode())); + result = ((result* 31)+((this.credentialSignatureRequest == null)? 0 :this.credentialSignatureRequest.hashCode())); + result = ((result* 31)+((this.userNonce == null)? 0 :this.userNonce.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt111) == false) { + return false; + } + Cpt111 rhs = ((Cpt111) other); + return (((((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))&&((this.cptId == rhs.cptId)||((this.cptId!= null)&&this.cptId.equals(rhs.cptId))))&&((this.credentialSignatureRequest == rhs.credentialSignatureRequest)||((this.credentialSignatureRequest!= null)&&this.credentialSignatureRequest.equals(rhs.credentialSignatureRequest))))&&((this.userNonce == rhs.userNonce)||((this.userNonce!= null)&&this.userNonce.equals(rhs.userNonce)))); + } + +} diff --git a/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt11Salt.java b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt11Salt.java new file mode 100644 index 00000000..271e7d3a --- /dev/null +++ b/src/main/java/com/webank/weid/protocol/cpt/v2/Cpt11Salt.java @@ -0,0 +1,166 @@ +package com.webank.weid.protocol.cpt.v2; + +import java.util.LinkedHashMap; +import java.util.Map; +import javax.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "cptId", + "userId", + "userName" +}) +@Generated("jsonschema2pojo") +public class Cpt11Salt { + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + private String cptId; + /** + * + * (Required) + * + */ + @JsonProperty("userId") + private String userId; + /** + * + * (Required) + * + */ + @JsonProperty("userName") + private String userName; + @JsonIgnore + private Map additionalProperties = new LinkedHashMap(); + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + public String getCptId() { + return cptId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("cptId") + public void setCptId(String cptId) { + this.cptId = cptId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userId") + public String getUserId() { + return userId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userId") + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userName") + public String getUserName() { + return userName; + } + + /** + * + * (Required) + * + */ + @JsonProperty("userName") + public void setUserName(String userName) { + this.userName = userName; + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(Cpt11Salt.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('['); + sb.append("cptId"); + sb.append('='); + sb.append(((this.cptId == null)?"":this.cptId)); + sb.append(','); + sb.append("userId"); + sb.append('='); + sb.append(((this.userId == null)?"":this.userId)); + sb.append(','); + sb.append("userName"); + sb.append('='); + sb.append(((this.userName == null)?"":this.userName)); + sb.append(','); + sb.append("additionalProperties"); + sb.append('='); + sb.append(((this.additionalProperties == null)?"":this.additionalProperties)); + sb.append(','); + if (sb.charAt((sb.length()- 1)) == ',') { + sb.setCharAt((sb.length()- 1), ']'); + } else { + sb.append(']'); + } + return sb.toString(); + } + + @Override + public int hashCode() { + int result = 1; + result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode())); + result = ((result* 31)+((this.userName == null)? 0 :this.userName.hashCode())); + result = ((result* 31)+((this.cptId == null)? 0 :this.cptId.hashCode())); + result = ((result* 31)+((this.userId == null)? 0 :this.userId.hashCode())); + return result; + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if ((other instanceof Cpt11Salt) == false) { + return false; + } + Cpt11Salt rhs = ((Cpt11Salt) other); + return (((((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))&&((this.userName == rhs.userName)||((this.userName!= null)&&this.userName.equals(rhs.userName))))&&((this.cptId == rhs.cptId)||((this.cptId!= null)&&this.cptId.equals(rhs.cptId))))&&((this.userId == rhs.userId)||((this.userId!= null)&&this.userId.equals(rhs.userId)))); + } + +} diff --git a/src/test/java/com/webank/weid/full/cpt/TestGenerateSchema.java b/src/test/java/com/webank/weid/full/cpt/TestGenerateSchema.java index 71a0d79f..ece184c7 100644 --- a/src/test/java/com/webank/weid/full/cpt/TestGenerateSchema.java +++ b/src/test/java/com/webank/weid/full/cpt/TestGenerateSchema.java @@ -14,62 +14,54 @@ package com.webank.weid.full.cpt; -import com.fasterxml.jackson.databind.JsonNode; -import com.github.victools.jsonschema.generator.FieldScope; -import com.github.victools.jsonschema.generator.OptionPreset; -import com.github.victools.jsonschema.generator.SchemaGenerator; -import com.github.victools.jsonschema.generator.SchemaGeneratorConfig; -import com.github.victools.jsonschema.generator.SchemaGeneratorConfigBuilder; -import com.github.victools.jsonschema.generator.SchemaVersion; -import com.webank.weid.protocol.cpt.Cpt101; -import com.webank.weid.protocol.cpt.Cpt103; -import com.webank.weid.protocol.cpt.Cpt105; -import com.webank.weid.protocol.cpt.Cpt106; -import com.webank.weid.protocol.cpt.Cpt107; -import com.webank.weid.protocol.cpt.Cpt108; -import com.webank.weid.protocol.cpt.Cpt109; import com.webank.weid.protocol.cpt.Cpt11; -import com.webank.weid.protocol.cpt.Cpt110; -import com.webank.weid.protocol.cpt.Cpt111; -import com.webank.weid.protocol.cpt.Cpt11Salt; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; +import com.webank.weid.util.DataToolUtils; import org.junit.Test; public class TestGenerateSchema { +// @Test +// public void testGenerate() throws IOException { +// SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_6, OptionPreset.PLAIN_JSON); +// SchemaGeneratorConfigPart requiredCheck = configBuilder.forFields().withRequiredCheck(filed -> true); +//// configBuilder +// SchemaGeneratorConfig config = configBuilder.build(); +// +// SchemaGenerator generator = new SchemaGenerator(config); +// JsonNode Cpt101 = generator.generateSchema(Cpt101.class); +// JsonNode Cpt103 = generator.generateSchema(Cpt103.class); +// JsonNode Cpt105 = generator.generateSchema(Cpt105.class); +// JsonNode Cpt106 = generator.generateSchema(Cpt106.class); +// JsonNode Cpt107 = generator.generateSchema(Cpt107.class); +// JsonNode Cpt108 = generator.generateSchema(Cpt108.class); +// JsonNode Cpt109 = generator.generateSchema(Cpt109.class); +// JsonNode Cpt110 = generator.generateSchema(Cpt110.class); +// JsonNode Cpt111 = generator.generateSchema(Cpt111.class); +// JsonNode Cpt11 = generator.generateSchema(Cpt11.class); +// JsonNode Cpt11Salt = generator.generateSchema(Cpt11Salt.class); +// JsonNode newCpt11Salt = generator.generateSchema(com.webank.weid.protocol.cpt.v2.Cpt11Salt.class); +// +//// String path = "D:\\projects\\weid\\WeIdentity\\src\\test\\resources\\cpt_new\\"; +//// Files.write(Paths.get(path + "Cpt101" + ".json"), Cpt101.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt103" + ".json"), Cpt103.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt105" + ".json"), Cpt105.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt106" + ".json"), Cpt106.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt107" + ".json"), Cpt107.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt108" + ".json"), Cpt108.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt109" + ".json"), Cpt109.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt110" + ".json"), Cpt110.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt111" + ".json"), Cpt111.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt11" + ".json"), Cpt11.toPrettyString().getBytes()); +//// Files.write(Paths.get(path + "Cpt11Salt" + ".json"), Cpt11Salt.toPrettyString().getBytes()); +// System.out.println(newCpt11Salt.toPrettyString()); +// } + @Test - public void testGenerate() throws IOException { - SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_6, OptionPreset.PLAIN_JSON); - SchemaGeneratorConfig config = configBuilder.build(); - SchemaGenerator generator = new SchemaGenerator(config); - JsonNode Cpt101 = generator.generateSchema(Cpt101.class); - JsonNode Cpt103 = generator.generateSchema(Cpt103.class); - JsonNode Cpt105 = generator.generateSchema(Cpt105.class); - JsonNode Cpt106 = generator.generateSchema(Cpt106.class); - JsonNode Cpt107 = generator.generateSchema(Cpt107.class); - JsonNode Cpt108 = generator.generateSchema(Cpt108.class); - JsonNode Cpt109 = generator.generateSchema(Cpt109.class); - JsonNode Cpt110 = generator.generateSchema(Cpt110.class); - JsonNode Cpt111 = generator.generateSchema(Cpt111.class); - JsonNode Cpt11 = generator.generateSchema(Cpt11.class); - JsonNode Cpt11Salt = generator.generateSchema(Cpt11Salt.class); + public void testJjschema() { + String result = DataToolUtils.generateDefaultCptJsonSchema(Cpt11.class); + System.out.println(result); - String path = "D:\\projects\\weid\\WeIdentity\\src\\test\\resources\\cpt_new\\"; - Files.write(Paths.get(path + "Cpt101" + ".json"), Cpt101.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt103" + ".json"), Cpt103.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt105" + ".json"), Cpt105.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt106" + ".json"), Cpt106.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt107" + ".json"), Cpt107.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt108" + ".json"), Cpt108.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt109" + ".json"), Cpt109.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt110" + ".json"), Cpt110.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt111" + ".json"), Cpt111.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt11" + ".json"), Cpt11.toPrettyString().getBytes()); - Files.write(Paths.get(path + "Cpt11Salt" + ".json"), Cpt11Salt.toPrettyString().getBytes()); -// System.out.println(jsonSchema.toPrettyString()); } } diff --git a/src/test/resources/cpt/Cpt_test.json b/src/test/resources/cpt/Cpt_test.json new file mode 100644 index 00000000..94cacf66 --- /dev/null +++ b/src/test/resources/cpt/Cpt_test.json @@ -0,0 +1,28 @@ +{ + "$schema" : "http://json-schema.org/draft-06/schema#", + "type" : "object", + "title": "test cpt", + "description": "Reserved CPT 11", + "properties" : { + "cptId" : { + "type" : "integer" + }, + "gender" : { + "type" : "string" + }, + "tags" : { + "type" : "array", + "items" : { + "type" : "string" + }, + "description": "Registered Tags" + }, + "userId" : { + "type" : "string" + }, + "userName" : { + "type" : "string" + } + }, + "required": ["cptId"] +} \ No newline at end of file