-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ConnorMarcus/vahid
Added more models (attrs are not final yet)
- Loading branch information
Showing
4 changed files
with
391 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package sysc4806.project.models; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
|
||
import java.util.Date; | ||
|
||
/** | ||
* Professor model | ||
*/ | ||
@Entity | ||
public class Professor { | ||
|
||
@Id | ||
@GeneratedValue | ||
private long id; | ||
|
||
private String name; | ||
|
||
private String email; | ||
|
||
private String password; | ||
|
||
private Date oralPresentationAvailability; | ||
|
||
public Professor() {} | ||
|
||
/** | ||
* Get professor's id | ||
* @return long | ||
*/ | ||
public long getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* Set professor's id | ||
* @param id long | ||
*/ | ||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
|
||
/** | ||
* Get professor's name | ||
* @return String | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
/** | ||
* Set professor's name | ||
* @param name String | ||
*/ | ||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
/** | ||
* Get professor's email | ||
* @return String | ||
*/ | ||
public String getEmail() { | ||
return email; | ||
} | ||
|
||
/** | ||
* Set professor's email | ||
* @param email String | ||
*/ | ||
public void setEmail(String email) { | ||
this.email = email; | ||
} | ||
|
||
/** | ||
* Get professor's password | ||
* @return String | ||
*/ | ||
public String getPassword() { | ||
return password; | ||
} | ||
|
||
/** | ||
* Set professor's password | ||
* @param password String | ||
*/ | ||
public void setPassword(String password) { | ||
this.password = password; | ||
} | ||
|
||
/** | ||
* Get professor's oral presentation availability | ||
* @return Date | ||
*/ | ||
public Date getOralPresentationAvailability() { | ||
return oralPresentationAvailability; | ||
} | ||
|
||
/** | ||
* Set professor's oral presentation availability | ||
* @param oralPresentationAvailability Date | ||
*/ | ||
public void setOralPresentationAvailability(Date oralPresentationAvailability) { | ||
this.oralPresentationAvailability = oralPresentationAvailability; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package sysc4806.project.models; | ||
|
||
/** | ||
* Program enumerator for all possible programs students can be apart of. | ||
*/ | ||
public enum Program { | ||
MECHANICAL_ENGINEERING, | ||
CIVIL_ENGINEERING, | ||
SOFTWARE_ENGINEERING, | ||
ELECTRICAL_ENGINEERING, | ||
COMPUTER_ENGINEERING, | ||
CHEMICAL_ENGINEERING | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,133 @@ | ||
package sysc4806.project.models; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.*; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
/** | ||
* Project model | ||
*/ | ||
@Entity | ||
public class Project { | ||
@Id | ||
@GeneratedValue | ||
private long id; | ||
|
||
private String name; | ||
private String title; | ||
|
||
private String description; | ||
|
||
private int maxStudents; | ||
|
||
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER) | ||
private List<Student> students; | ||
|
||
@ManyToOne | ||
private Professor professors; | ||
|
||
public Project() { | ||
this.students = new ArrayList<>(); | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
public Project(String title, String description, int maxStudents) { | ||
this.title= title; | ||
this.description = description; | ||
this.maxStudents = maxStudents; | ||
this.students = new ArrayList<>(); | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
/** | ||
* Get project title | ||
*/ | ||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
/** | ||
* Set project title | ||
* @param title String | ||
*/ | ||
public void setTitle(String title) { | ||
this.title = title; | ||
} | ||
|
||
/** | ||
* Get project id | ||
*/ | ||
public long getId() { | ||
return id; | ||
} | ||
|
||
/** | ||
* Set project id | ||
* @param id long | ||
*/ | ||
public void setId(long id) { | ||
this.id = id; | ||
} | ||
|
||
/** | ||
* Get project description | ||
*/ | ||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
/** | ||
* Set project description | ||
* @param description String | ||
*/ | ||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
/** | ||
* Get project professor(s) | ||
* @return Professor | ||
*/ | ||
public Professor getProfessors() { | ||
return professors; | ||
} | ||
|
||
/** | ||
* Get maximum number of students assigned to a project | ||
* @return int maximum amount of students on project | ||
*/ | ||
public int getMaxStudents() { | ||
return maxStudents; | ||
} | ||
|
||
/** | ||
* Set maximum number of students for a project | ||
* @param maxStudents int maximum number of students on project | ||
*/ | ||
public void setMaxStudents(int maxStudents) { | ||
this.maxStudents = maxStudents; | ||
} | ||
|
||
/** | ||
* Get students assigned to the project | ||
* @return List of students on the project | ||
*/ | ||
public List<Student> getStudents() { | ||
return students; | ||
} | ||
|
||
/** | ||
* Add a student to the project | ||
* @param student Student to be added to the project | ||
*/ | ||
public void addStudent(Student student) { | ||
students.add(student); | ||
} | ||
|
||
/** | ||
* Remove student from the project | ||
* @param student Student to be removed from the project | ||
*/ | ||
public void removeStudent(Student student) { | ||
students.remove(student); | ||
} | ||
} |
Oops, something went wrong.