com.safelayer.rap.json.model.issuance.JsonIssuanceKeysPendingResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pki-connector-restapi Show documentation
Show all versions of pki-connector-restapi Show documentation
The PKI Connector RESTAPI is a library that helps developing new PKI Connectors for TrustedX
The newest version!
package com.safelayer.rap.json.model.issuance;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.safelayer.rap.api.model.EcKeyTemplate;
import com.safelayer.rap.api.model.KeyTemplate;
import com.safelayer.rap.api.model.RsaKeyTemplate;
import com.safelayer.rap.api.model.issuance.IssuanceKeysPendingResponse;
import com.safelayer.rap.impl.model.NotSupportedException;
import com.safelayer.rap.json.CertificatesKeysPendingMapDeserialize;
import com.safelayer.rap.json.CertificatesKeysPendingMapSerialize;
import com.safelayer.rap.json.model.JsonEcKeyTemplate;
import com.safelayer.rap.json.model.JsonKeyTemplate;
import com.safelayer.rap.json.model.JsonRsaKeyTemplate;
public class JsonIssuanceKeysPendingResponse extends JsonIssuanceResponse implements IssuanceKeysPendingResponse{
static public class JsonCertificatesKeysPending implements CertificatesKeysPending {
@JsonProperty(value="key_template")
private JsonKeyTemplate keyTemplate;
@JsonCreator
public JsonCertificatesKeysPending() {}
public JsonCertificatesKeysPending(CertificatesKeysPending other) throws Exception {
KeyTemplate keyTemplate = other.getKeyTemplate();
if (keyTemplate instanceof EcKeyTemplate){
this.keyTemplate = new JsonEcKeyTemplate((EcKeyTemplate)keyTemplate);
}
else if (keyTemplate instanceof RsaKeyTemplate){
this.keyTemplate = new JsonRsaKeyTemplate((RsaKeyTemplate)keyTemplate);
}
else {
throw new NotSupportedException(other);
}
}
@JsonIgnore
public KeyTemplate getKeyTemplate() {
return keyTemplate;
}
}
@JsonProperty
@JsonDeserialize(using=CertificatesKeysPendingMapDeserialize.class)
@JsonSerialize(using=CertificatesKeysPendingMapSerialize.class)
private Map tasks;
@JsonCreator
public JsonIssuanceKeysPendingResponse() {
super(null);
}
public JsonIssuanceKeysPendingResponse(IssuanceKeysPendingResponse other) {
super(other.getState());
this.tasks = other.getTasks();
}
@JsonIgnore
public Map getTasks() {
return tasks;
}
}