package com crm entityBeans import java io Serializable import java ut

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package com.crm.entityBeans;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
@Entity
@Table(name="SPG_ACTIVATION_KEYS")
public class SpgActivationKey implements Serializable {
private static final long serialVersionUID = -3393979250125170658L;
private Long id;
private String companyId;
private User user;
private Date creationDate;
private Date expirationDate;
private byte[] activationKey;
@Id
@GeneratedValue(generator="SAK_SEQ_ID")
@SequenceGenerator(name="SAK_SEQ_ID", sequenceName="SPG_ACTIVATION_KEYS_SEQ")
@Column(name = "SAK_ID", nullable=false)
public Long getId() {
return id;
}
@Column(name = "SAK_COMPANY_ID", nullable=false)
public String getCompanyId() {
return companyId;
}
@OneToOne(targetEntity=User.class)
@JoinColumn(name="SAK_CREATION_UID", nullable=false)
public User getUser() {
return user;
}
@Column(name = "SAK_CREATION_DATE", nullable=false)
public Date getCreationDate() {
return creationDate;
}
@Column(name = "SAK_EXPIRATION_DATE", nullable=false)
public Date getExpirationDate() {
return expirationDate;
}
@Column(name="SAK_ACTIVATION_KEY", columnDefinition="blob", nullable=false)
public byte[] getActivationKey() {
return activationKey;
}
public void setId(Long id) {
this.id = id;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public void setUser(User user) {
this.user = user;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public void setExpirationDate(Date expirationDate) {
this.expirationDate = expirationDate;
}
public void setActivationKey(byte[] activationKey) {
this.activationKey = activationKey;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + Arrays.hashCode(activationKey);
result = prime * result
+ ((companyId == null) ? 0 : companyId.hashCode());
result = prime * result
+ ((creationDate == null) ? 0 : creationDate.hashCode());
result = prime * result
+ ((expirationDate == null) ? 0 : expirationDate.hashCode());
result = prime * result + ((user == null) ? 0 : user.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof SpgActivationKey))
return false;
SpgActivationKey other = (SpgActivationKey) obj;
if (!Arrays.equals(activationKey, other.activationKey))
return false;
if (companyId == null) {
if (other.companyId != null)
return false;
} else if (!companyId.equals(other.companyId))
return false;
if (creationDate == null) {
if (other.creationDate != null)
return false;
} else if (!creationDate.equals(other.creationDate))
return false;
if (expirationDate == null) {
if (other.expirationDate != null)
return false;
} else if (!expirationDate.equals(other.expirationDate))
return false;
if (user == null) {
if (other.user != null)
return false;
} else if (!user.equals(other.user))
return false;
return true;
}
}