Better information extraction from x509 command #20

Merged
MarkL4YG merged 22 commits from wip/38c3 into main 2025-04-21 10:16:27 +00:00
Showing only changes of commit cdd82443b0 - Show all commits

View file

@ -3,16 +3,18 @@ package de.mlessmann.certassist.models;
import jakarta.persistence.*;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotNull;
import lombok.*;
import org.hibernate.proxy.HibernateProxy;
import java.util.ArrayList;
import java.util.List;
import lombok.AccessLevel;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import java.util.Objects;
@Entity
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "fingerprint" }) })
@Data
@Getter
@Setter
@ToString
@RequiredArgsConstructor
public class Certificate {
@ -44,6 +46,7 @@ public class Certificate {
private String subjectLocality;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@ToString.Exclude
private List<CertificateExtension> certificateExtension = new ArrayList<>();
//@Lob - Cannot annotate column: https://github.com/xerial/sqlite-jdbc/issues/135
@ -60,4 +63,20 @@ public class Certificate {
@Column(nullable = false)
private String fingerprint;
@Override
public final boolean equals(Object o) {
if (this == o) return true;
if (o == null) return false;
Class<?> oEffectiveClass = o instanceof HibernateProxy ? ((HibernateProxy) o).getHibernateLazyInitializer().getPersistentClass() : o.getClass();
Class<?> thisEffectiveClass = this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass() : this.getClass();
if (thisEffectiveClass != oEffectiveClass) return false;
Certificate that = (Certificate) o;
return getId() != null && Objects.equals(getId(), that.getId());
}
@Override
public final int hashCode() {
return this instanceof HibernateProxy ? ((HibernateProxy) this).getHibernateLazyInitializer().getPersistentClass().hashCode() : getClass().hashCode();
}
}