-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApplication.java
114 lines (97 loc) · 3.86 KB
/
Application.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import java.io.Serializable;
import java.util.ArrayList;
class Application implements Serializable {
private static int count = 0;
private int applicant_id;
private int id;
private String status;
private String cover_letter;
private ArrayList<String> extraDocuments;
Application(Applicant applicant, String cover, ArrayList<String> extras) {
this.id = count;
count++;
this.applicant_id = applicant.getId();
this.status = "Pending";
this.cover_letter = cover;
this.extraDocuments = extras;
}
/**
* Register a new round in this applcation
*/
void nextRound(ApplicantManager manager, JobPosting jobPosting) {
this.status = "Pending";
Applicant applicant = manager.getApplicant(this.applicant_id);
Mailbox mailbox = applicant.getMailbox();
mailbox.enter("A new round has started for the job posting \"" + jobPosting.getTitle() + "\" with id " +
jobPosting.getId() + ".");
}
/**
* Get rejected in parameter jobPosting
*/
void rejected(ApplicantManager manager, JobPosting jobPosting) {
this.status = "Rejected";
Applicant applicant = manager.getApplicant(this.applicant_id);
Mailbox mailbox = applicant.getMailbox();
mailbox.enter("We regret to inform you that you have been rejected by the job posting \"" +
jobPosting.getTitle() + "\" with id " + jobPosting.getId() + ".\n Of course, your application " +
"information will be removed from the system.");
this.clearInfo();
}
/**
* Get accepted into the next round of parameter jobPosting
*/
void acceptedToNextRound(ApplicantManager manager, JobPosting jobPosting) {
this.status = "Accepted into next round";
Applicant applicant = manager.getApplicant(this.applicant_id);
Mailbox mailbox = applicant.getMailbox();
mailbox.enter("We are delighted to inform you that you have been accepted into the next round of the job " +
"posting \"" + jobPosting.getTitle() + "\" with id " + jobPosting.getId() + ".");
}
/**
* Get accepted for a job posting
*/
void accepted(ApplicantManager manager, JobPosting jobPosting) {
this.status = "Accepted for job position";
Applicant applicant = manager.getApplicant(this.applicant_id);
Mailbox mailbox = applicant.getMailbox();
mailbox.enter("We are delighted to inform you that you have been accepted into the job position of the job " +
"posting \"" + jobPosting.getTitle() + "\" with id " + jobPosting.getId() + ".\n Of course, your " +
"application information will be removed from the system.");
this.clearInfo();
}
void read(ApplicantManager manager) {
Applicant applicant = manager.getApplicant(this.applicant_id);
System.out.println("Applicant info: ");
System.out.println("-" + applicant);
System.out.println("Application info: ");
System.out.println("-Cover letter: " + this.cover_letter);
System.out.println("-CV: " + applicant.getCV());
System.out.println("-Reference letters: ");
applicant.printReferenceLetters();
System.out.println("-Extra documents: ");
for (String extra : this.extraDocuments) {
System.out.println(extra);
}
System.out.println();
}
void clearInfo() {
this.cover_letter = "";
this.extraDocuments = new ArrayList<>();
}
// GETTER METHODS
int getApplicant_id() {
return this.applicant_id;
}
int getId() {
return this.id;
}
String getStatus() {
return this.status;
}
String getCover_letter() {
return this.cover_letter;
}
ArrayList<String> getExtraDocuments() {
return this.extraDocuments;
}
}