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

45 lines
1.3 KiB
Java
Raw Normal View History

2020-10-13 17:07:04 +02:00
package com.plannaplan.responses.models;
2020-10-28 13:44:13 +01:00
import com.plannaplan.entities.Course;
import com.plannaplan.entities.Groups;
import com.plannaplan.types.GroupType;
2020-10-13 17:07:04 +02:00
import io.swagger.annotations.ApiModel;
@ApiModel(description = "Response shows information about given assigment to course.", value = "GetCurrentAssignmentsResponse")
2020-10-28 13:44:13 +01:00
public class GetCurrentAssignmentsResponse {
private Long id;
private String name;
private WithCapacityGroupResponse classes;
private WithCapacityGroupResponse lecture;
2020-10-13 17:07:04 +02:00
2020-10-28 13:44:13 +01:00
public GetCurrentAssignmentsResponse(Course course, Groups lecture, Groups classes) {
this.id = course.getId();
this.name = course.getName();
this.lecture = lecture == null ? null : new WithCapacityGroupResponse(lecture);
this.classes = classes == null ? null : new WithCapacityGroupResponse(classes);
}
public GetCurrentAssignmentsResponse(Course course, Groups group) {
this(course, group.getType() == GroupType.LECTURE ? group : null,
group.getType() == GroupType.CLASS ? group : null);
}
public WithCapacityGroupResponse getLecture() {
return this.lecture;
}
public WithCapacityGroupResponse getClasses() {
return this.classes;
}
public String getName() {
return this.name;
}
public Long getId() {
return this.id;
2020-10-13 17:07:04 +02:00
}
}