Chenged newest plan response

This commit is contained in:
BuildTools
2020-10-28 13:44:13 +01:00
parent db0115280f
commit 7073e3b1d8
7 changed files with 114 additions and 25 deletions

View File

@ -1,11 +1,41 @@
package com.plannaplan.responses.models;
import com.plannaplan.entities.Assignment;
import com.plannaplan.entities.Course;
import com.plannaplan.entities.Groups;
import com.plannaplan.types.GroupType;
public class GetCurrentAssignmentsResponse extends WithCapacityGroupResponse {
public class GetCurrentAssignmentsResponse {
private Long id;
private String name;
private WithCapacityGroupResponse classes;
private WithCapacityGroupResponse lecture;
public GetCurrentAssignmentsResponse(Assignment assignment) {
super(assignment);
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;
}
}