com.arm.mbed.cloud.sdk.security.model.TrustedCertificate Maven / Gradle / Ivy
Show all versions of foundation-models Show documentation
// This file was generated by the Pelion SDK foundation code generator.
// This model class was autogenerated on Thu May 02 19:21:45 BST 2019. Feel free to change its contents as you wish.
package com.arm.mbed.cloud.sdk.security.model;
import java.util.Date;
import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.common.SdkModel;
/**
* Model for a trusted certificate.
*/
@Preamble(description = "Model for a trusted certificate.")
@SuppressWarnings("PMD.CyclomaticComplexity")
public class TrustedCertificate extends AbstractTrustedCertificate {
/**
* Serialisation Id.
*/
private static final long serialVersionUID = 1727697502201821L;
/**
* Internal constructor.
*
*
* Constructor based on all fields.
*
* Note: Should not be used. Use {@link #TrustedCertificate()} instead.
*
* @param accountId
* The ID of the account.
* @param certificate
* X509.v3 trusted certificate in PEM format.
* @param certificateFingerprint
* A SHA-256 fingerprint of the certificate.
* @param createdAt
* Creation UTC time RFC3339.
* @param description
* Human readable description of this certificate.
* @param deviceExecutionMode
* Device execution mode where 1 means a developer certificate.
* @param enrollmentMode
* If true, signature is not required. Default value false.
* @param id
* Entity ID.
* @param issuer
* Issuer of the certificate.
* @param name
* Certificate name.
* @param ownerId
* The ID of the owner.
* @param service
* Service name where the certificate is used.
* @param status
* Status of the certificate.
* @param subject
* Subject of the certificate.
* @param updatedAt
* Last update UTC time RFC3339.
* @param valid
* This read-only flag indicates whether the certificate is valid or not.
* @param validity
* Expiration time in UTC formatted as RFC3339.
*/
@Internal
@SuppressWarnings("PMD.CyclomaticComplexity")
public TrustedCertificate(String accountId, String certificate, String certificateFingerprint, Date createdAt,
String description, int deviceExecutionMode, boolean enrollmentMode, String id,
String issuer, String name, String ownerId, TrustedCertificateService service,
TrustedCertificateStatus status, String subject, Date updatedAt, boolean valid,
Date validity) {
super(accountId, certificate, certificateFingerprint, createdAt, description, deviceExecutionMode,
enrollmentMode, id, issuer, name, ownerId, service, status, subject, updatedAt, valid, validity);
}
/**
* Internal constructor.
*
*
* Constructor based on a similar object.
*
* Note: Should not be used. Use {@link #TrustedCertificate()} instead.
*
* @param trustedCertificate
* a trusted certificate.
*/
@Internal
public TrustedCertificate(TrustedCertificate trustedCertificate) {
this(trustedCertificate == null ? (String) null : trustedCertificate.accountId,
trustedCertificate == null ? (String) null : trustedCertificate.certificate,
trustedCertificate == null ? (String) null : trustedCertificate.certificateFingerprint,
trustedCertificate == null ? new Date() : trustedCertificate.createdAt,
trustedCertificate == null ? (String) null : trustedCertificate.description,
trustedCertificate == null ? 0 : trustedCertificate.deviceExecutionMode,
trustedCertificate != null && trustedCertificate.enrollmentMode,
trustedCertificate == null ? (String) null : trustedCertificate.id,
trustedCertificate == null ? (String) null : trustedCertificate.issuer,
trustedCertificate == null ? (String) null : trustedCertificate.name,
trustedCertificate == null ? (String) null : trustedCertificate.ownerId,
trustedCertificate == null ? TrustedCertificateService.getDefault() : trustedCertificate.service,
trustedCertificate == null ? TrustedCertificateStatus.getDefault() : trustedCertificate.status,
trustedCertificate == null ? (String) null : trustedCertificate.subject,
trustedCertificate == null ? new Date() : trustedCertificate.updatedAt,
trustedCertificate != null && trustedCertificate.valid,
trustedCertificate == null ? new Date() : trustedCertificate.validity);
}
/**
* Constructor.
*/
public TrustedCertificate() {
this((String) null, (String) null, (String) null, new Date(), (String) null, 0, false, (String) null,
(String) null, (String) null, (String) null, TrustedCertificateService.getDefault(),
TrustedCertificateStatus.getDefault(), (String) null, new Date(), false, new Date());
}
/**
* Constructor.
*
*
* Constructor based on object identifier.
*
*
* @param id
* Entity ID.
*/
public TrustedCertificate(String id) {
this();
setId(id);
}
/**
* Internal constructor.
*
*
* Constructor based on read-only fields.
*
* Note: Should not be used. Use {@link #TrustedCertificate()} instead.
*
* @param accountId
* The ID of the account.
* @param certificateFingerprint
* A SHA-256 fingerprint of the certificate.
* @param createdAt
* Creation UTC time RFC3339.
* @param deviceExecutionMode
* Device execution mode where 1 means a developer certificate.
* @param isDeveloperCertificate
* whether or not this certificate is a developer certificate.
* @param issuer
* Issuer of the certificate.
* @param ownerId
* The ID of the owner.
* @param subject
* Subject of the certificate.
* @param updatedAt
* Last update UTC time RFC3339.
* @param valid
* This read-only flag indicates whether the certificate is valid or not.
* @param validity
* Expiration time in UTC formatted as RFC3339.
*/
@Internal
@SuppressWarnings({ "PMD.UnusedFormalParameter", "PMD.CyclomaticComplexity" })
public TrustedCertificate(String accountId, String certificateFingerprint, Date createdAt, int deviceExecutionMode,
boolean isDeveloperCertificate, String issuer, String ownerId, String subject,
Date updatedAt, boolean valid, Date validity) {
this(accountId, (String) null, certificateFingerprint, createdAt, (String) null, deviceExecutionMode, false,
(String) null, issuer, (String) null, ownerId, TrustedCertificateService.getDefault(),
TrustedCertificateStatus.getDefault(), subject, updatedAt, valid, validity);
}
/**
* Constructor.
*
*
* Constructor based on required fields.
*
*
* @param certificate
* X509.v3 trusted certificate in PEM format.
* @param name
* Certificate name.
* @param service
* Service name where the certificate is used.
*/
public TrustedCertificate(String certificate, String name, TrustedCertificateService service) {
this((String) null, certificate, (String) null, new Date(), (String) null, 0, false, (String) null,
(String) null, name, (String) null, service, TrustedCertificateStatus.getDefault(), (String) null,
new Date(), false, new Date());
}
/**
* Gets whether or not this certificate is a developer certificate.
*
* @return isDeveloperCertificate
*/
public boolean isDeveloperCertificate() {
return getDeviceExecutionMode() == 1;
}
/**
* Gets whether or not this certificate is a developer certificate.
*
* Note: Similar to {@link #isDeveloperCertificate()}
*
* @return isDeveloperCertificate
*/
@SuppressWarnings("PMD.BooleanGetMethodName")
@Internal
public boolean getIsDeveloperCertificate() {
return isDeveloperCertificate();
}
/**
* Checks whether the model is valid or not.
*
*
*
* @see SdkModel#isValid()
* @return true if the model is valid; false otherwise.
*/
@SuppressWarnings("PMD.UselessOverridingMethod")
@Override
public boolean isValid() {
return super.isValid();
}
/**
* Returns a string representation of the object.
*
*
*
* @see java.lang.Object#toString()
* @return the string representation
*/
@Override
public String toString() {
return "TrustedCertificate [isDeveloperCertificate=" + isDeveloperCertificate() + ", accountId=" + accountId
+ ", certificate=" + certificate + ", certificateFingerprint=" + certificateFingerprint + ", createdAt="
+ createdAt + ", description=" + description + ", deviceExecutionMode=" + deviceExecutionMode
+ ", enrollmentMode=" + enrollmentMode + ", id=" + id + ", issuer=" + issuer + ", name=" + name
+ ", ownerId=" + ownerId + ", service=" + service + ", status=" + status + ", subject=" + subject
+ ", updatedAt=" + updatedAt + ", valid=" + valid + ", validity=" + validity + "]";
}
/**
* Calculates the hash code of this instance based on field values.
*
*
*
* @see java.lang.Object#hashCode()
* @return hash code
*/
@SuppressWarnings("PMD.UselessOverridingMethod")
@Override
public int hashCode() {
return super.hashCode();
}
/**
* Indicates whether some other object is "equal to" this one.
*
*
*
* @see java.lang.Object#equals(java.lang.Object)
* @param obj
* an object to compare with this instance.
* @return true if this object is the same as the obj argument; false otherwise.
*/
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!super.equals(obj)) {
return false;
}
if (!(obj instanceof TrustedCertificate)) {
return false;
}
final TrustedCertificate other = (TrustedCertificate) obj;
if (!other.canEqual(this)) {
return false;
}
return true;
}
/**
* Clones this instance.
*
*
*
* @see java.lang.Object#clone()
* @return a cloned instance
*/
@Override
public TrustedCertificate clone() {
return new TrustedCertificate(this);
}
/**
* Method to ensure {@link #equals(Object)} is correct.
*
*
* Note: see this article: canEqual()
*
* @param other
* another object.
* @return true if the other object is an instance of the class in which canEqual is (re)defined, false otherwise.
*/
@Override
protected boolean canEqual(Object other) {
return other instanceof TrustedCertificate;
}
}