-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathApplicant.java
92 lines (77 loc) · 2.29 KB
/
Applicant.java
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
package com.cruru.applicant.domain;
import com.cruru.BaseEntity;
import com.cruru.dashboard.domain.Dashboard;
import com.cruru.process.domain.Process;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.FetchType;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import java.util.Objects;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@Entity
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
@Getter
public class Applicant extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "applicant_id")
private Long id;
private String name;
private String email;
private String phone;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "process_id")
private Process process;
@Column(name = "is_rejected")
private Boolean isRejected;
public Applicant(String name, String email, String phone, Process process, Boolean isRejected) {
this.name = name;
this.email = email;
this.phone = phone;
this.process = process;
this.isRejected = isRejected;
}
public void updateProcess(Process process) {
this.process = process;
}
public void reject() {
this.isRejected = true;
}
public Dashboard getDashboard() {
return process.getDashboard();
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Applicant applicant = (Applicant) o;
return Objects.equals(id, applicant.id);
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "Applicant{" +
"id=" + id +
", name='" + name + '\'' +
", email='" + email + '\'' +
", phone='" + phone + '\'' +
", process=" + process +
", isRejected=" + isRejected +
'}';
}
}