backend/buisnesslogic/src/main/java/com/plannaplan/entities/Groups.java

102 lines
2.1 KiB
Java
Raw Normal View History

package com.plannaplan.entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
2020-07-25 10:21:42 +02:00
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
2020-07-25 09:58:40 +02:00
import com.plannaplan.types.GroupType;
import com.plannaplan.types.WeekDay;
@Entity
public class Groups {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
2020-07-25 10:56:11 +02:00
@ManyToOne
@JoinColumn(name = "course_id")
private Course courseId;
private int time;
private String room;
private int capacity;
2020-07-25 09:58:40 +02:00
private GroupType type;
private WeekDay day;
2020-07-25 10:21:42 +02:00
@ManyToOne
@JoinColumn(name = "lecturer_id")
private Lecturer lecturer;
public Groups() {
}
2020-08-11 17:36:58 +02:00
public Long getId() {
return this.id;
}
2020-07-25 10:21:42 +02:00
public Lecturer getLecturer() {
return lecturer;
}
public void setLecturer(Lecturer lecturer) {
this.lecturer = lecturer;
}
2020-07-25 09:58:40 +02:00
public WeekDay getDay() {
return day;
}
public void setDay(WeekDay day) {
this.day = day;
}
public GroupType getType() {
return type;
}
public void setType(GroupType type) {
this.type = type;
}
public int getCapacity() {
return capacity;
}
public void setCapacity(int capacity) {
this.capacity = capacity;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
public int getTime() {
return time;
}
public void setTime(int time) {
this.time = time;
}
2020-07-25 10:56:11 +02:00
public Course getCourseId() {
return courseId;
}
2020-07-25 10:56:11 +02:00
public void setCourseId(Course courseId) {
this.courseId = courseId;
}
2020-08-18 15:41:03 +02:00
public String getTimeString() {
int minutes = this.getTime() % 60;
2020-08-18 16:10:46 +02:00
String hoursString = Integer.toString(this.getTime() / 60);
2020-08-18 15:41:03 +02:00
String minutesString = Integer.toString(minutes);
if (minutes < 10) {
minutesString = "0" + minutesString;
}
2020-08-18 16:10:46 +02:00
return String.format("%s.%s", hoursString, minutesString);
2020-08-18 15:41:03 +02:00
}
}