Skip to content

Commit

Permalink
Merge pull request #2 from ConnorMarcus/vahid
Browse files Browse the repository at this point in the history
Added more models (attrs are not final yet)
  • Loading branch information
va9id authored Nov 1, 2023
2 parents 39b8ad7 + a60403f commit 4ed8f77
Show file tree
Hide file tree
Showing 4 changed files with 391 additions and 8 deletions.
108 changes: 108 additions & 0 deletions src/main/java/sysc4806/project/models/Professor.java
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;
}
}
13 changes: 13 additions & 0 deletions src/main/java/sysc4806/project/models/Program.java
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
}
119 changes: 111 additions & 8 deletions src/main/java/sysc4806/project/models/Project.java
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);
}
}
Loading

0 comments on commit 4ed8f77

Please sign in to comment.