1 package org
.cvut
.skischool
.model
;
3 import java
.io
.Serializable
;
4 import javax
.persistence
.Entity
;
5 import javax
.persistence
.GeneratedValue
;
6 import javax
.persistence
.GenerationType
;
7 import javax
.persistence
.Id
;
8 import javax
.persistence
.Inheritance
;
9 import javax
.persistence
.InheritanceType
;
10 import javax
.persistence
.OneToOne
;
11 import javax
.validation
.constraints
.NotNull
;
12 import javax
.validation
.constraints
.Size
;
19 @Inheritance(strategy
= InheritanceType
.JOINED
)
20 public class Person
implements Serializable
{
22 private static final long serialVersionUID
= 1L;
24 @GeneratedValue(strategy
= GenerationType
.AUTO
)
26 private String firstName
;
27 @Size(min
= 1, message
= "{null}")
28 private String lastName
;
29 private String birthNumber
;
32 private String address
;
34 private boolean disabled
;
35 @OneToOne(mappedBy
= "person")
36 private Account account
;
42 public void setId(Long id
) {
46 public String
getAddress() {
50 public void setAddress(String address
) {
51 this.address
= address
;
54 public String
getBirthNumber() {
58 public void setBirthNumber(String birthNumber
) {
59 this.birthNumber
= birthNumber
;
62 public boolean isDisabled() {
66 public void setDisabled(boolean disabled
) {
67 this.disabled
= disabled
;
70 public String
getEmail() {
74 public void setEmail(String email
) {
78 public String
getFirstName() {
82 public void setFirstName(String firstName
) {
83 this.firstName
= firstName
;
86 public String
getLastName() {
90 public void setLastName(String lastName
) {
91 this.lastName
= lastName
;
94 public String
getPhone() {
98 public void setPhone(String phone
) {
102 public Account
getAccount() {
106 public void setAccount(Account account
) {
107 this.account
= account
;
111 public int hashCode() {
113 hash
+= (id
!= null ? id
.hashCode() : 0);
118 public boolean equals(Object object
) {
119 // TODO: Warning - this method won't work in the case the id fields are not set
120 if (!(object
instanceof Person
)) {
123 Person other
= (Person
) object
;
124 if ((this.id
== null && other
.id
!= null) || (this.id
!= null && !this.id
.equals(other
.id
))) {
131 public String
toString() {
132 return "org.cvut.x33eja.model.Person[id=" + id
+ "]";