com.arm.mbed.cloud.sdk.security.model.CertificateEnrollment Maven / Gradle / Ivy
Show all versions of foundation-models Show documentation
// This file was generated by the Pelion SDK foundation code generator.
// This is an autogenerated class. Do not modify its content as modifications will be lost at next code generation.
package com.arm.mbed.cloud.sdk.security.model;
import com.arm.mbed.cloud.sdk.annotations.Internal;
import com.arm.mbed.cloud.sdk.annotations.Preamble;
import com.arm.mbed.cloud.sdk.common.SdkModel;
import java.util.Date;
/**
* Model for a certificate enrollment.
*/
@Preamble(description = "Model for a certificate enrollment.")
@SuppressWarnings("PMD.CyclomaticComplexity")
public class CertificateEnrollment implements SdkModel {
/**
* Serialisation Id.
*/
private static final long serialVersionUID = -748424711351820L;
/**
* The certificate name.
*/
private final String certificateName;
/**
* Creation UTC time RFC3339.
*/
private final Date createdAt;
/**
* The device ID.
*/
private final String deviceId;
/**
* The result of certificate enrollment request.
*/
private final CertificateEnrollmentEnrollResult enrollResult;
/**
* Additional information in case of failure.
*/
private final String enrollResultDetail;
/**
* The status of certificate enrollment request.
*/
private final CertificateEnrollmentEnrollStatus enrollStatus;
/**
* The certificate enrollment ID.
*/
private String id;
/**
* Update UTC time RFC3339.
*/
private final Date updatedAt;
/**
* Internal constructor.
*
*
* Constructor based on all fields.
*
* Note: Should not be used. Use {@link #CertificateEnrollment()} instead.
*
* @param certificateName
* The certificate name.
* @param createdAt
* Creation UTC time RFC3339.
* @param deviceId
* The device ID.
* @param enrollResult
* The result of certificate enrollment request.
* @param enrollResultDetail
* Additional information in case of failure.
* @param enrollStatus
* The status of certificate enrollment request.
* @param id
* The certificate enrollment ID.
* @param updatedAt
* Update UTC time RFC3339.
*/
@Internal
@SuppressWarnings("PMD.CyclomaticComplexity")
public CertificateEnrollment(String certificateName, Date createdAt, String deviceId,
CertificateEnrollmentEnrollResult enrollResult, String enrollResultDetail,
CertificateEnrollmentEnrollStatus enrollStatus, String id, Date updatedAt) {
super();
this.certificateName = certificateName;
this.createdAt = createdAt;
this.deviceId = deviceId;
this.enrollResult = enrollResult;
this.enrollResultDetail = enrollResultDetail;
this.enrollStatus = enrollStatus;
this.updatedAt = updatedAt;
setId(id);
}
/**
* Internal constructor.
*
*
* Constructor based on a similar object.
*
* Note: Should not be used. Use {@link #CertificateEnrollment()} instead.
*
* @param certificateEnrollment
* a certificate enrollment.
*/
@Internal
public CertificateEnrollment(CertificateEnrollment certificateEnrollment) {
this(certificateEnrollment == null ? (String) null : certificateEnrollment.certificateName,
certificateEnrollment == null ? new Date() : certificateEnrollment.createdAt,
certificateEnrollment == null ? (String) null : certificateEnrollment.deviceId,
certificateEnrollment == null ? CertificateEnrollmentEnrollResult.getDefault()
: certificateEnrollment.enrollResult,
certificateEnrollment == null ? (String) null : certificateEnrollment.enrollResultDetail,
certificateEnrollment == null ? CertificateEnrollmentEnrollStatus.getDefault()
: certificateEnrollment.enrollStatus,
certificateEnrollment == null ? (String) null : certificateEnrollment.id,
certificateEnrollment == null ? new Date() : certificateEnrollment.updatedAt);
}
/**
* Constructor.
*/
public CertificateEnrollment() {
this((String) null, new Date(), (String) null, CertificateEnrollmentEnrollResult.getDefault(), (String) null,
CertificateEnrollmentEnrollStatus.getDefault(), (String) null, new Date());
}
/**
* Constructor.
*
*
* Constructor based on object identifier.
*
*
* @param id
* The certificate enrollment ID.
*/
public CertificateEnrollment(String id) {
this();
setId(id);
}
/**
* Internal constructor.
*
*
* Constructor based on read-only fields.
*
* Note: Should not be used. Use {@link #CertificateEnrollment()} instead.
*
* @param certificateName
* The certificate name.
* @param createdAt
* Creation UTC time RFC3339.
* @param deviceId
* The device ID.
* @param enrollResult
* The result of certificate enrollment request.
* @param enrollResultDetail
* Additional information in case of failure.
* @param enrollStatus
* The status of certificate enrollment request.
* @param updatedAt
* Update UTC time RFC3339.
*/
@Internal
public CertificateEnrollment(String certificateName, Date createdAt, String deviceId,
CertificateEnrollmentEnrollResult enrollResult, String enrollResultDetail,
CertificateEnrollmentEnrollStatus enrollStatus, Date updatedAt) {
this(certificateName, createdAt, deviceId, enrollResult, enrollResultDetail, enrollStatus, (String) null,
updatedAt);
}
/**
* Gets the certificate name.
*
* @return certificateName
*/
public String getCertificateName() {
return certificateName;
}
/**
* Gets creation utc time rfc3339.
*
* @return createdAt
*/
public Date getCreatedAt() {
return createdAt;
}
/**
* Gets the device id.
*
* @return deviceId
*/
public String getDeviceId() {
return deviceId;
}
/**
* Gets the result of certificate enrollment request.
*
* @return enrollResult
*/
public CertificateEnrollmentEnrollResult getEnrollResult() {
return enrollResult;
}
/**
* Gets additional information in case of failure.
*
* @return enrollResultDetail
*/
public String getEnrollResultDetail() {
return enrollResultDetail;
}
/**
* Gets the status of certificate enrollment request.
*
* @return enrollStatus
*/
public CertificateEnrollmentEnrollStatus getEnrollStatus() {
return enrollStatus;
}
/**
* Gets the certificate enrollment id.
*
* @return id
*/
@Override
public String getId() {
return id;
}
/**
* Sets the certificate enrollment id.
*
* @param id
* The certificate enrollment ID.
*/
@Override
public void setId(String id) {
this.id = id;
}
/**
* Sets the certificate enrollment id.
*
*
* Similar to {@link #setId(String)}
*
* @param certificateEnrollmentId
* The certificate enrollment ID.
*/
@Internal
public void setCertificateEnrollmentId(String certificateEnrollmentId) {
setId(certificateEnrollmentId);
}
/**
* Gets update utc time rfc3339.
*
* @return updatedAt
*/
public Date getUpdatedAt() {
return updatedAt;
}
/**
* Returns a string representation of the object.
*
*
*
* @see java.lang.Object#toString()
* @return the string representation
*/
@Override
public String toString() {
return "CertificateEnrollment [certificateName=" + certificateName + ", createdAt=" + createdAt + ", deviceId="
+ deviceId + ", enrollResult=" + enrollResult + ", enrollResultDetail=" + enrollResultDetail
+ ", enrollStatus=" + enrollStatus + ", id=" + id + ", updatedAt=" + updatedAt + "]";
}
/**
* Calculates the hash code of this instance based on field values.
*
*
*
* @see java.lang.Object#hashCode()
* @return hash code
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((certificateName == null) ? 0 : certificateName.hashCode());
result = prime * result + ((createdAt == null) ? 0 : createdAt.hashCode());
result = prime * result + ((deviceId == null) ? 0 : deviceId.hashCode());
result = prime * result + ((enrollResult == null) ? 0 : enrollResult.hashCode());
result = prime * result + ((enrollResultDetail == null) ? 0 : enrollResultDetail.hashCode());
result = prime * result + ((enrollStatus == null) ? 0 : enrollStatus.hashCode());
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result + ((updatedAt == null) ? 0 : updatedAt.hashCode());
return result;
}
/**
* 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.
*/
protected boolean canEqual(Object other) {
return other instanceof CertificateEnrollment;
}
/**
* 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
@SuppressWarnings({ "PMD.ExcessiveMethodLength", "PMD.NcssMethodCount" })
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof CertificateEnrollment)) {
return false;
}
final CertificateEnrollment other = (CertificateEnrollment) obj;
if (!other.canEqual(this)) {
return false;
}
if (certificateName == null) {
if (other.certificateName != null) {
return false;
}
} else if (!certificateName.equals(other.certificateName)) {
return false;
}
if (createdAt == null) {
if (other.createdAt != null) {
return false;
}
} else if (!createdAt.equals(other.createdAt)) {
return false;
}
if (deviceId == null) {
if (other.deviceId != null) {
return false;
}
} else if (!deviceId.equals(other.deviceId)) {
return false;
}
if (enrollResult != other.enrollResult) {
return false;
}
if (enrollResultDetail == null) {
if (other.enrollResultDetail != null) {
return false;
}
} else if (!enrollResultDetail.equals(other.enrollResultDetail)) {
return false;
}
if (enrollStatus != other.enrollStatus) {
return false;
}
if (id == null) {
if (other.id != null) {
return false;
}
} else if (!id.equals(other.id)) {
return false;
}
if (updatedAt == null) {
if (other.updatedAt != null) {
return false;
}
} else if (!updatedAt.equals(other.updatedAt)) {
return false;
}
return true;
}
/**
* Checks whether the model is valid or not.
*
*
*
* @see SdkModel#isValid()
* @return true if the model is valid; false otherwise.
*/
@Override
public boolean isValid() {
return true;
}
/**
* Clones this instance.
*
*
*
* @see java.lang.Object#clone()
* @return a cloned instance
*/
@Override
public CertificateEnrollment clone() {
return new CertificateEnrollment(this);
}
}