backend/restservice/src/main/java/com/plannaplan/responses/models/DefaultGroupResponse.java

54 lines
1.3 KiB
Java
Raw Normal View History

2020-10-08 15:57:42 +02:00
package com.plannaplan.responses.models;
import com.plannaplan.entities.Assignment;
2020-10-08 15:57:42 +02:00
import com.plannaplan.entities.Groups;
import com.plannaplan.types.GroupType;
2020-10-13 17:07:04 +02:00
public class DefaultGroupResponse {
2020-10-08 15:57:42 +02:00
private Long id;
private int day;
private String time;
private String lecturer;
private String room;
private GroupType type;
2020-10-13 17:07:04 +02:00
public DefaultGroupResponse(Groups group) {
this.id = group.getId() != null ? group.getId() : null;
this.day = group.getDay() != null ? group.getDay().label : -1;
this.time = group.getTimeString() != null ? group.getTimeString() : "";
this.lecturer = group.getLecturer() != null ? group.getLecturer().toString() : "";
this.room = group.getRoom() != null ? group.getRoom() : "";
this.type = group.getType() != null ? group.getType() : null;
}
2020-10-13 17:07:04 +02:00
public DefaultGroupResponse(Assignment assignment) {
this(assignment.getGroup());
2020-10-08 15:57:42 +02:00
}
public GroupType getType() {
return type;
}
public String getRoom() {
return room;
}
public String getLecturer() {
return lecturer;
}
public String getTime() {
return time;
}
public int getDay() {
return day;
}
public Long getId() {
return id;
}
}