blob: 8bb5f44cde5c174d7943b2f41f2906599fa0312d [file] [log] [blame]
Matthias Andreas Benkardec7f8052020-01-24 11:08:34 +01001package eu.mulk.mulkcms2.cms.users;
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +01002
3import java.io.Serializable;
4import java.util.Arrays;
5import java.util.Objects;
6import javax.persistence.Column;
7import javax.persistence.Id;
8
9public class LoginCertificatePK implements Serializable {
10
11 private int userId;
12 private byte[] certificate;
13
14 @Column(name = "user", nullable = false)
15 @Id
16 public int getUserId() {
17 return userId;
18 }
19
20 public void setUserId(int userId) {
21 this.userId = userId;
22 }
23
24 @Column(name = "certificate", nullable = false)
25 @Id
26 public byte[] getCertificate() {
27 return certificate;
28 }
29
30 public void setCertificate(byte[] certificate) {
31 this.certificate = certificate;
32 }
33
34 @Override
35 public boolean equals(Object o) {
36 if (this == o) {
37 return true;
38 }
39 if (o == null || getClass() != o.getClass()) {
40 return false;
41 }
42 LoginCertificatePK that = (LoginCertificatePK) o;
Matthias Andreas Benkard571fd852020-01-12 20:30:21 +010043 return userId == that.userId && Arrays.equals(certificate, that.certificate);
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +010044 }
45
46 @Override
47 public int hashCode() {
48 int result = Objects.hash(userId);
49 result = 31 * result + Arrays.hashCode(certificate);
50 return result;
51 }
52}