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

82 lines
1.7 KiB
Java
Executable File

package com.plannaplan.responses.models;
import com.plannaplan.entities.Assignment;
import com.plannaplan.entities.Groups;
import com.plannaplan.types.GroupType;
/**
* Assignment detailed response for api
*/
public class AssignmentDetailedResponse {
public Long id;
public String name;
private int day;
private String time;
private String endTime;
private String lecturer;
private String type;
/**
* @param assignment Assignment instance to map
*/
public AssignmentDetailedResponse(Assignment assignment) {
final Groups group = assignment.getGroup();
this.id = assignment.getId();
this.name = group.getCourseId().getName();
this.day = group.getDay().label;
this.time = group.getTimeString();
this.endTime = group.getEndTimeString();
this.lecturer = group.getLecturer().toString();
this.type = GroupType.isLectureOrClass(group.getType()).toString();
}
/**
* @return type of the lecture
*/
public String getType() {
return type;
}
/**
* @return day as a value from 0-6
*/
public int getDay() {
return day;
}
/**
* @return lecturer string fromated
*/
public String getLecturer() {
return lecturer;
}
/**
* @return time formated string
*/
public String getEndTime() {
return endTime;
}
/**
* @return time formated string
*/
public String getTime() {
return time;
}
/**
* @return name of course that group belongs to
*/
public String getName() {
return this.name;
}
/**
* @return db id of assignment
*/
public Long getId() {
return this.id;
}
}