forked from Vidhee1411/Internship-Application
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.java
255 lines (229 loc) · 8.64 KB
/
Student.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
import java.util.UUID;
import java.util.ArrayList;
/**
* The Student class creates a Student account in the internship system and
* allows them to create a resume to apply for a job.
* @author Vidhee Patel and Joshua DuPuis
*/
public class Student extends User{
private String yearInSchool;
private Resume resume;
private ArrayList<Review> reviewsFromCompanies;
private static final int PERMISSION = 0;
private ArrayList<String> skills;
private ArrayList<String> classes;
/**
* The Student constructor creates a student object with their first name
* @param firstName The first name of the student
* @param lastName The last name of the student
* @param email The student's school email
* @param password The password for the student's account
* @param yearInSchool The student's year in school
*/
public Student(String firstName, String lastName, String email, String password, String yearInSchool) {
super(firstName, lastName, email, password);
this.yearInSchool = yearInSchool;
this.id = UUID.randomUUID();
this.resume = null;
reviewsFromCompanies = new ArrayList<Review>();
skills = new ArrayList<String>();
classes = new ArrayList<String>();
}
/**
* This student constructor creates a student with every field set. Used in loading students from json
* @param firstName The first name of the student
* @param lastName The last name of the student
* @param email The student's school email
* @param password The password for the student's account
* @param yearInSchool The student's year in school
* @param id The students uuid
* @param skills An ArrayList<String> containing the students skills
* @param classes An ArrayList,String> containing the classes that the student has taken
* @param reviews An arrayList<Review> containing all the reviews of the student
*/
public Student(String firstName, String lastName, String email, String password, String yearInSchool, UUID id, ArrayList<String> skills, ArrayList<String> classes, ArrayList<Review> reviews) {
super(firstName, lastName, email, password, id);
this.yearInSchool = yearInSchool;
this.skills = skills;
this.classes = classes;
this.reviewsFromCompanies = reviews;
}
/**
* The createResume method allows the student to create a resume. It adds
* the student's first name, last name, and email to the resume.
*/
public void createResume(ArrayList<Integer> skillindexs, ArrayList<Integer> class_indexs, ArrayList<WorkExperience> workExperiences, ArrayList<Education> education) {
Resume resume = new Resume(super.getFirstName(), super.getLastName(), super.getEmail(), this.yearInSchool);
resume.setEducation(education);
resume.setWorkExperience(workExperiences);
for(Integer index:skillindexs){
resume.addSkill(this.skills.get(index));
}
for(Integer index:class_indexs){
resume.addClass(this.classes.get(index));
}
this.resume = resume;
}
/**
* The setResume method sets a student's resume to the resume passed in by
* the user.
* @param resume The resume being added to the student.
*/
public void setResume(Resume resume){
this.resume = resume;
}
/**
* The getResume method returns the student's resume.
* @return The student's resume
*/
public Resume getResume() {
return this.resume;
}
/**
* The setYearInSchool method changes the student's year in school
* @param yearInSchool The student's new year in school
*/
public void setYearInSchool(String yearInSchool) {
this.yearInSchool = yearInSchool;
}
/**
* The getYearInSchool method returns the student's year in school.
* @return The student's year in school
*/
public String getYearInSchool() {
return this.yearInSchool;
}
/**
* The reviewCompany method allows students to review a company they have
* previously worked for and adds the newly created review to the company's
* page.
* @param rating The rating out of five that the student gives the company
* @param comment The comment to accompany the review
* @param company The company that the student is reviewing
*/
public void reviewCompany(int rating, String comment, CompanyProfile company) {
Review studentReview = new Review(super.getFirstName(), super.getLastName(), rating, comment);
company.addReview(studentReview);
}
/**
* The getReviews method returns an ArrayList containing all of the reviews
* that employers have written about the student.
* @return The list of reviews employers have written about the student
*/
public ArrayList<Review> getReviews() {
return reviewsFromCompanies;
}
/**
* The applyForInternship method allows a student to apply for any
* internship in the system.
* @param listing The internship a student wants to apply for
*/
public void applyForInternship(JobListing listing) {
listing.apply(this);
}
/**
* The add review method accepts a review from an employer and adds it to
* the list of reviews about the student.
* @param review The review written by an employer to be added to the
* student's ArrayList of reviews
*/
public void addReview(Review review) {
reviewsFromCompanies.add(review);
}
/**
* The setReviews method accepts an Arraylist<Review> and sets reviewsFromCompanies to it.
* used in loading data from JSON
* @param reviews an ArrayList<Review> of reviews
*/
public void setReviews(ArrayList<Review> reviews) {
this.reviewsFromCompanies = reviews;
}
/**
* The getSkills method returns all of the skills the student has entered on their account.
* @return An ArrayList<String> of skills
*/
public ArrayList<String> getSkills() {
return this.skills;
}
/**
* The setSkills method accepts an ArrayList<String> and sets the user's
* list of skills equal to it.
* @param skills An ArrayList<String> containing the student's skills
*/
public void setSkills(ArrayList<String> skills){
this.skills = skills;
}
/**
* The addSkill method adds a skill to the student's list of skills.
* @param skill The student's new skill
*/
public void addSkill(String skill) {
skills.add(skill);
}
/**
* The getClasses method returns all of the classes the student has entered on their account.
* @return An ArrayList<String> of classes
*/
public ArrayList<String> getClasses() {
return this.classes;
}
/**
* The setClasses method accpets an ArrayList<String> and sets the
* student's list of classes equal to it
* @param classes An ArrayList<String> containing the students classes
*/
public void setClasses(ArrayList<String> classes){
this.classes = classes;
}
/**
* The addClass method adds a class to the student's list of classes.
* @param class The student's new class
*/
public void addClass(String classe) {
classes.add(classe);
}
/**
* The getUUID method gets the Student's UUID
* @return The UUID of the student
*/
public UUID getUUID() {
return super.getUserUUID();
}
/**
* gets the index of a skill
* @param skill the skill being searched for
* @return returns the index of the skill if found or -1 if not found
*/
public int getSkillIndex(String skill){
return skills.indexOf(skill);
}
/**
* gets the index of a class
* @param course the class being searched for.
* @return returns the index of the class if found or -1 if not found
*/
public int getClassIndex(String course){
return classes.indexOf(course);
}
/**
* The getPermission method returns the permission value for a student
* @return An int containing the value 0 - a student's user's permission
* value
*/
public int getPermission() {
return PERMISSION;
}
public String toString() {
String output = firstName + " " + lastName + "\nSchool Year: " + yearInSchool;
if(resume != null) {
output+= "\nResume: " + resume.toString();
}
if(!reviewsFromCompanies.isEmpty()) {
output += "\nReviews: \n";
for(Review review : reviewsFromCompanies) {
output += review.toString() + "\n";
}
}
return output;
}
}