Class BaseUserCertificate<C extends BaseUserCertificate<C>>

java.lang.Object
net.solarnetwork.dao.BasicIdentity<UserStringCompositePK>
net.solarnetwork.dao.BasicEntity<UserStringCompositePK>
net.solarnetwork.central.dao.BaseUserModifiableEntity<C,UserStringCompositePK>
net.solarnetwork.central.domain.BaseUserCertificate<C>
All Implemented Interfaces:
Serializable, Cloneable, Comparable<UserStringCompositePK>, UserRelatedEntity<UserStringCompositePK>, UserIdRelated, net.solarnetwork.dao.Entity<UserStringCompositePK>, net.solarnetwork.domain.CopyingIdentity<UserStringCompositePK,C>, net.solarnetwork.domain.Differentiable<C>, net.solarnetwork.domain.Identity<UserStringCompositePK>

public abstract class BaseUserCertificate<C extends BaseUserCertificate<C>> extends BaseUserModifiableEntity<C,UserStringCompositePK>
Base user-related certificate entity.
See Also:
  • Constructor Details

    • BaseUserCertificate

      public BaseUserCertificate(UserStringCompositePK id, Instant created)
      Constructor.
      Parameters:
      id - the ID
      created - the creation date
      Throws:
      IllegalArgumentException - if any argument is null
    • BaseUserCertificate

      public BaseUserCertificate(Long userId, String subjectDn, Instant created)
      Constructor.
      Parameters:
      subjectDn - the normalized certificate subject DN
      created - the creation date
      user - ID the user ID
      Throws:
      IllegalArgumentException - if any argument is null
    • BaseUserCertificate

      public BaseUserCertificate(Long userId, X509Certificate certificate, Instant created)
      Constructor.

      The subjectDn value will be extracted from the certificate.

      Parameters:
      certificate - the certificate
      created - the creation date
      user - ID the user ID
      Throws:
      IllegalArgumentException - if any argument is null
  • Method Details

    • copyTo

      public void copyTo(C entity)
      Specified by:
      copyTo in interface net.solarnetwork.domain.CopyingIdentity<UserStringCompositePK,C extends BaseUserCertificate<C>>
      Overrides:
      copyTo in class BaseUserModifiableEntity<C extends BaseUserCertificate<C>,UserStringCompositePK>
    • isSameAs

      public boolean isSameAs(C other)
      Test if this entity has the same property values as another.

      The id, created, and modified properties are not compared.

      Overrides:
      isSameAs in class BaseUserModifiableEntity<C extends BaseUserCertificate<C>,UserStringCompositePK>
      Parameters:
      other - the entity to compare to
      Returns:
      true if the properties of this entity are equal to the other's
    • getSubjectDn

      public String getSubjectDn()
      Get the certificate subject DN.
      Returns:
      the subject DN
    • getCertificate

      public X509Certificate getCertificate()
      Get the certificate.
      Returns:
      the certificate
    • setCertificate

      public void setCertificate(X509Certificate certificate)
      Set the certificate.
      Parameters:
      certificate - the certificate to set
    • getExpires

      public Instant getExpires()
      Get the certificate expiration date.
      Returns:
      the expiration date, or null if the certificate is not set
    • certificateData

      public byte[] certificateData()
      Get the DER-encoded certificate data.
      Returns:
      the certificate data