Maciek refactor works + delete unnecesery interface (conception changed)

This commit is contained in:
Filip Izydorczyk
2020-09-23 18:17:52 +02:00
26 changed files with 152 additions and 232 deletions

View File

@ -10,6 +10,8 @@ import javax.persistence.ManyToOne;
import com.plannaplan.types.GroupType;
import com.plannaplan.types.WeekDay;
@Entity
public class Groups {
@Id
@ -17,7 +19,7 @@ public class Groups {
private Long id;
@ManyToOne
@JoinColumn(name = "course_id")
private Course courseId;
private Course course;
private int time;
private String room;
private int capacity;
@ -30,6 +32,16 @@ public class Groups {
public Groups() {
}
public Groups(int capacity, String room, Course course, int time, WeekDay day, Lecturer lecturer) {
this.capacity = capacity;
this.room = room;
this.course = course;
this.time = time;
this.day = day;
this.lecturer = lecturer;
this.type = capacity >= 50 ? GroupType.LECTURE : GroupType.CLASS;
}
public Long getId() {
return this.id;
}
@ -83,11 +95,11 @@ public class Groups {
}
public Course getCourseId() {
return courseId;
return course;
}
public void setCourseId(Course courseId) {
this.courseId = courseId;
this.course = courseId;
}
public String getTimeString() {
@ -99,4 +111,4 @@ public class Groups {
}
return String.format("%s.%s", hoursString, minutesString);
}
}
}